Již 10.000+ CAD tipů.
Přes 118.000 registrovaných u nás, celkem 1.092.000 registrovaných (CZ+EN), přes 53.000 CAD/BIM bloků.
Vyzkoušejte nový přesný Inženýrský kalkulátor.
Kompletní příkazy AutoCADu a proměnné AutoCADu 2026.
CAD tip # 13501:
Otázka
A
Chcete-li v IDW/DWG výkresu Inventoru snadno zarovnat dva nebo více výkresových pohledů podle konkrétní vybrané hrany (horizontální nebo vertikální), můžete použít následující předpis (pravidlo) iLogic.
'-------------------------- iLogic code
Sub Main()
Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
Dim oCurve1, oCurve2 As DrawingCurveSegment
oCurve1 = GetCurve1(oDoc)
oCurve2 = GetCurve2(oDoc)
Dim oView1, oView2 As DrawingView
oView1 = oCurve1.Parent.Parent
oView2 = oCurve2.Parent.Parent
Dim Curve1Point1, Curve1Point2, Curve2Point1, Curve2Point2, View1Point, View2Point As Point2d
Curve1Point1=oCurve1.StartPoint
Curve1Point2=oCurve1.EndPoint
Curve2Point1=oCurve2.StartPoint
Curve2Point2=oCurve2.EndPoint
If oView1.Name = oView2.Name Then
MessageBox.Show("Select lines from different views", "Align view error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Exit Sub
End If
If (Round((Curve1Point1.X - Curve1Point2.X)*1e8) = 0 And Round((Curve2Point1.X - Curve2Point2.X)*1e8) = 0) Then
MoveView = Curve1Point1.X - Curve2Point1.X
oView2Point = oView2.Position
oView2Point.X = oView2Point.X + MoveView
oView2.Position = oView2Point
Else If(Round((Curve1Point1.Y - Curve1Point2.Y)*1e8) = 0 And Round((Curve2Point1.Y - Curve2Point2.Y)*1e8) = 0) Then
MoveView = Curve1Point1.Y - Curve2Point1.Y
oView2Point = oView2.Position
oView2Point.Y = oView2Point.Y + MoveView
oView2.Position = oView2Point
Else
MessageBox.Show("Lines are not horizontal or vertical or not in the same orientation.", "Align view error", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
MsgBox(Curve1Point1.Y - Curve1Point2.Y)
MsgBox(Curve2Point1.Y - Curve2Point2.Y)
Exit Sub
End If
End Sub
Private Function GetCurve1(ByVal oDoc As DrawingDocument) As DrawingCurveSegment
Dim Curve As DrawingCurveSegment
Curve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select first line to align")
Return Curve
End Function
Private Function GetCurve2(ByVal oDoc As DrawingDocument) As DrawingCurveSegment
Dim Curve As DrawingCurveSegment
Curve = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select second line to align")
Return Curve
End Function
'--------------------End of iLogic code
platí pro: Inventor ·