Make Line Infinite Example (VBA)
This example shows how to make the selected finite line an infinite
line.
'---------------------------------------------
'
' Preconditions: Document is open and a finite sketched
' line
is selected.
'
' Postconditions: The finite line becomes a infinite line
and
' its
angle is modified.
'
'---------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSketchLine As SldWorks.SketchLine
Dim boolstatus As Boolean
Dim AngleOut As Double
Sub main()
Set
swApp = Application.SldWorks
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swSketchLine = swSelMgr.GetSelectedObject6(1,
0)
boolstatus
= swSketchLine.Infinite
Debug.Print
"Infinite line: " & boolstatus
boolstatus
= swSketchLine.MakeInfinite
boolstatus
= swSketchLine.Infinite
Debug.Print
"Infinite line: " & boolstatus
AngleOut
= swSketchLine.Angle
Debug.Print
"Original angle: " & AngleOut
swSketchLine.Angle = 6.2831853071796
Debug.Print
"New angle: " & AngleOut
End Sub