Set and Get Maximum Extension Line Length Example (VBA)
This example shows how to set and get the maximum extension line length
for a display dimension.
'--------------------------------------------
'
' Preconditions: Part document is open and a display dimension
with
extension lines is selected.
'
' Postconditions: The maximum extension line length is
set to the specified value.
'
'--------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModelDoc As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDisplayDim As SldWorks.DisplayDimension
Dim selType As Long
Dim maxLineLength As Double
Sub main()
Set
swApp = Application.SldWorks
Set
swModelDoc = swApp.ActiveDoc
Set
swModelDocExt = swModelDoc.Extension
Set
swSelMgr = swModelDoc.SelectionManager
selType
= swSelMgr.GetSelectedObjectType2(1)
If
selType = swSelDIMENSIONS Then
Set
swDisplayDim = swSelMgr.GetSelectedObject5(1)
swDisplayDim.MaxWitnessLineLength = 10
End
If
maxLineLength
= swDisplayDim.MaxWitnessLineLength
Debug.Print
maxLineLength
End Sub