Hello,
New to SW API, long time user on the NX API boards , new company has SW which I haven't used in a few years.
Im trying to use GetSelectedObject6 to cycle thru dimensions and split them into linear dimensions, radius, diameter, angle etc.
Sofar I have. My Issue is that swDisplayDimension.Type2 is giving a value of 2 for linear dimensions and also diameters....
I am basing this code off a similar API instructions to get dimension types. Thanks!
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim swDisplayDimension As SldWorks.DisplayDimension
Dim swDimension As SldWorks.Dimension
Dim swDimensionTolerance As SldWorks.DimensionTolerance
Dim status As Boolean
Dim fontHeight As Double
Dim fontScale As Double
Dim swView As SldWorks.View
Dim swAnn As SldWorks.Annotation
Dim swPart As SldWorks.PartDoc
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Dim DimVal As Double
Dim index As Long
Dim Tol As String
Dim DimType As Integer
Dim DimTypeSel As String
Dim Post As String
Dim CalcNum As Double
CalcNum = 0.0254
For index = 1 To swSelMgr.GetSelectedObjectCount
'Get the selection
Set swDisplayDimension = swSelMgr.GetSelectedObject6(index, 0)
'Set swAnn = swSelMgr.GetSelectedObject6(index, 0)
Set swDimension = swDisplayDimension.GetDimension
DimVal = swDimension.Value
Set swDimensionTolerance = swDimension.Tolerance
Set swAnn = swDisplayDimension.GetAnnotation
'Debug.Print swAnn.GetName
'Debug.Print swAnn.GetType
Set swDisplayDimension = swAnn.GetSpecificAnnotation
DimType = swDisplayDimension.Type2
Debug.Print DimType
' CASE SELECTION
Select Case (DimType)
Case 1
DimTypeSel = ""
'Debug.Print DimTypeSel
Case 2
DimTypeSel = "Ø" ' Dia
'Debug.Print DimTypeSel
Case 3
DimTypeSel = "" ' Angle
'Debug.Print DimTypeSel
CalcNum = 0.01745329
Case 4
DimTypeSel = ""
'Debug.Print DimTypeSel
Case 5
DimTypeSel = "R" ' R
'Debug.Print DimTypeSel
Case Else
DimTypeSel = ""
'Debug.Print DimTypeSel
End Select
' END SELECTION
blah blah some stuff to export to Excel
SolidworksApi macros