INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • Turn Off Ad Banners
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...Your site is one of the cleanest and BEST forums that I have seen. I have sent quite a few people your way. Keep up the good work!!!"

Geography

Where in the world do Eng-Tips members come from?

API and Macros

Toggle dimension between driven and driving
Posted: 6 Aug 02

' 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

Back to SolidWorks 3D CAD products FAQ Index
Back to SolidWorks 3D CAD products Forum
My FAQ Archive
Email This FAQ To A Friend

My Archive

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close