Get Break Line Data Example (VBA)
This example shows how to get information on all break lines in a view.
'----------------------------------------------------------------------------
' Preconditions:
' 1. Create or open a drawing with one or more views that contain
' one or more break lines.
' 2. Open an Immediate Window.
'
' Postconditions: Inspect the Immediate Window.
' ---------------------------------------------------------------------------
Dim swApp As SldWorks.SldWorks
Dim Draw As SldWorks.DrawingDoc
Dim swActiveView As SldWorks.View
Dim Size As Long
Dim Breaks As Long
Dim info As Variant
Option Explicit
Sub main()
Set swApp = Application.SldWorks
Set Draw = swApp.ActiveDoc
Dim count As Long
count = Draw.GetViewCount
Debug.Print "There are " & count & " views in this drawing
including the sheet view."
Dim i As Long
Dim j As Long
Set swActiveView = Draw.GetFirstView ' get the sheet
Set swActiveView = swActiveView.GetNextView ' get the first
view
For i = 0 To count - 2
Debug.Print "View " & i + 1
Breaks = swActiveView.GetBreakLineCount2(Size)
Debug.Print " Number of
breaks is " & Breaks
Debug.Print " Size of
break line data array is " & Size
If Not Breaks = 0
Then
info = swActiveView.GetBreakLineInfo2
' Break line information
Debug.Print " First break line:"
Debug.Print " Break line style: " & info(0)
Debug.Print " Break line color: " & info(1)
Debug.Print " Break line linetype: " & info(2)
Debug.Print " Break line linestyleindex: " & info(3)
Debug.Print " Break line lineweight: " & info(4)
Debug.Print " Break line layerid: " & info(5)
Debug.Print " Break line layerOverride: " & info(6)
Debug.Print " Number of line segments in this break
line: " & info(7)
Debug.Print " Number of arcs in this break line: " &
info(8)
' Start and end point data for all segments in this break line
' and data for other break lines in this view
Debug.Print ""
Debug.Print " Start and end point data for the break
line above"
Debug.Print " and data for other break lines in this
view:"
For j = 9 To Size - 1
Debug.Print " " & info(j)
Next j
End If
Set swActiveView =
swActiveView.GetNextView
Next i
End Sub