MACRO LIBRARY

Insert broken view and set break line positions

Free public access. No account or subscription required.

Files

Insert broken view and set break line positions

Code

'Preconditions: drawing view is selected
'Results: Break view is added; break lines are +/- 5mm from view origin (the center)
    
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
    
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swSelMgr As SldWorks.SelectionMgr
Dim swBreakLine As SldWorks.BreakLine
Dim vBreakLines As Variant
Dim i As Integer
    
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    Set swSelMgr = swModel.SelectionManager
    Set swView = swSelMgr.GetSelectedObject6(1, -1)
    swDraw.InsertBreakVertical
    vBreakLines = swView.GetBreakLines
    Set swBreakLine = vBreakLines(0)
    swBreakLine.SetPosition -0.005, 0.005
    swModel.EditRebuild3
    swDraw.BreakView
End Sub
    
'Broken view gap size cannot be controlled with the API it appears