I am looking to change a 3D drawing dimension from driven to driving and vise versa.
This code works perfect for 2D, but not at all for 3D. Any thoughts?
http://www.eng-tips.com/faqs.cfm?fid=331
SolidworksApi macros' This Macro Checks the current selected group for dimensions, determines if they
' are driven or driving dimensions, and toggles them from one to the other.
Dim swApp As Object
Dim Part As Object
Dim i As Integer
Dim ObjType, objCount As Variant
Dim SelMgr, SelDim As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.ActiveDoc
Set SelMgr = Part.SelectionManager()
'Make sure there are selected objects
If SelMgr.GetSelectedObjectCount <> 0 Then
objCount = SelMgr.GetSelectedObjectCount
For i = 1 To objCount
ObjType = SelMgr.GetSelectedObjectType(i)
If (ObjType = 14) Then 'If the object is a dimension...
Set SelDim = SelMgr.GetSelectedObject(i)
If SelDim.DrivenState = 2 Then 'if driving dim then
SelDim.DrivenState = 1 ' set to driven
Else
SelDim.DrivenState = 2 ' set to driving
End If
End If
Part.GraphicsRedraw2
Next i
End If
End
End Sub