Traverse Feature Dimensions Example (VBA)
This example shows how to traverse all of the
IDisplayDimension objects belonging to the feature, grab the underlying
IDimension object, and query its value. It is assumed that you have a
feature selected.
'------------------------------------------------------------------
Dim swApp As Object
Dim Part As Object
Dim Feature As Object
Dim theDimen As Object
Dim theDispDimen As Object
Sub main()
Set swApp = CreateObject
("SldWorks.Application")
Set Part = swApp.ActiveDoc
Set Feature
= Part.SelectionManager.GetSelectedObject5(1)
If (Feature is Nothing)
Then
Exit Sub
End if
Set theDispDimen
= Feature.GetFirstDisplayDimension
i = 0
While (Not theDispDimen
Is Nothing)
i = i + 1
Set theDimen
= theDispDimen.GetDimension
thevalue = theDimen.Value
swApp.SendMsgToUser "Dimension Value
" + STR(i) + " = " + STR(thevalue)
Set theDispDimen
= Feature.GetNextDisplayDimension
(theDispDimen)
Wend
End Sub