Does anyone know how to set the text in a display dimension? I cant get it to work
Dim swApp As SldWorks.SldWorks
Dim moddoc As SldWorks.IModelDoc2
Dim selmgr As SldWorks.ISelectionMgr
Dim comp As SldWorks.Component2
Dim test As Object
Dim testDim As SldWorks.IDisplayDimension
Dim mark As Long
Dim complete As Boolean
Sub main()
Set swApp = Application.SldWorks
Set moddoc = swApp.ActiveDoc
Set selmgr = moddoc.SelectionManager
For ii = 1 To selmgr.GetSelectedObjectCount
Dim partinfo As String
Dim Part As SldWorks.ModelDoc2
MsgBox selmgr.GetSelectedObjectType3(ii, mark)
If selmgr.GetSelectedObjectType3(ii, mark) = 14 Then '14=dimension
Set testDim = selmgr.GetSelectedObject6(ii, mark)
MsgBox testDim.ShowDimensionValue
MsgBox "Get dimension " & Round(testDim.GetDimension2(1).Value, 5)
MsgBox "Precision: " & testDim.GetPrimaryPrecision
MsgBox "Precision2: " & testDim.GetPrimaryPrecision2
MsgBox "Alternate: " & testDim.GetAlternatePrecision
MsgBox "Gettext: " & testDim.GetText(1)
MsgBox "Use dual dim: " & testDim.GetUseDocDual
MsgBox "Linked text: " & testDim.GetLinkedText
MsgBox "Use doc precision" & testDim.GetUseDocPrecision
complete = testDim.SetText(1, "nej")
complete = moddoc.GraphicsRedraw2()
End If
Next
End Sub
SolidworksApi macros