Hi all,
I am trying to use VBA to get the type of a dimension in a drawing.
for example, there are two circles and a dimension between them.
I need to know whether this dimension is center to center or minimum distance.
Any ideas?
BTW, the dimension is not selected, preferably the macro loops through all the dimensions and prints the type of each one.
Thanks
Hi,
Try this:
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim swDraw As DrawingDoc
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim DispDim As DisplayDimension
Dim swDim As Dimension
Dim ArcVal1 As Long
Dim ArcVal2 As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set swDraw = Part
Dim swAnn As Annotation
Dim arrAnnotation As Variant
Dim swView As View
Set swView = swDraw.GetFirstView
Do While Not swView Is Nothing
arrAnnotation = swView.GetDisplayDimensions
If IsEmpty(arrAnnotation) = False Then
For i = 0 To UBound(arrAnnotation)
Set DispDim = arrAnnotation(i)
Set swDim = DispDim.GetDimension
Set swAnn = DispDim.GetAnnotation
swAnn.Select False
ArcVal1 = swDim.GetArcEndCondition(1) '>>First End Condition, Will return swArcEndCondition_e enum
ArcVal2 = swDim.GetArcEndCondition(2) '>>Second End Condition, Will return swArcEndCondition_e enum
Next i
End If
Set swView = swView.GetNextView
Loop
End Sub