×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

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

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

marked for drawing

marked for drawing

marked for drawing

(OP)
Is there a way to set all dimensions in a part (preferably in the template) to not be marked for drawings? I would like to just have tight tolleranced dimensions show up when new drawings are made.

RE: marked for drawing

Try this out.  It will un-mark all dimensions in the active part for which the tolerance type is set to none and mark all dimensions for which the tolerance type is not none.

CODE


Sub UnMarkAllDimsForDwg()
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swAnnot As SldWorks.Annotation
Dim swDispDim As SldWorks.DisplayDimension
Dim swFeat As SldWorks.Feature
Dim swSubFeat As SldWorks.Feature
Dim swDim As SldWorks.Dimension
Dim swDimTol As SldWorks.DimensionTolerance

Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc

'Un-mark all added reference dimensions
If swDoc.GetType <> swDocPART Then
    MsgBox "This macro should only be run on parts."
    Exit Sub
End If

If MsgBox("Un-mark no tolerance dims and mark all tolerance dims for dwg?", vbYesNo) = vbNo Then
    Exit Sub
End If

Set swAnnot = swDoc.GetFirstAnnotation2
While Not (swAnnot Is Nothing)
    If swAnnot.GetType = swDisplayDimension Then
        Set swDispDim = swAnnot.GetSpecificAnnotation
        Set swDim = swDispDim.GetDimension
        Set swDimTol = swDim.Tolerance
        If swDimTol.Type = swTolNONE Then
            swDispDim.MarkedForDrawing = False
        Else
            swDispDim.MarkedForDrawing = True
        End If
    End If
    Set swAnnot = swAnnot.GetNext3
Wend

'Un-mark all
Set swFeat = swDoc.FirstFeature
While Not (swFeat Is Nothing)
    Set swSubFeat = swFeat.GetFirstSubFeature
    While Not (swSubFeat Is Nothing)
        Set swDispDim = swSubFeat.GetFirstDisplayDimension
        While Not (swDispDim Is Nothing)
            Set swDim = swDispDim.GetDimension
            Set swDimTol = swDim.Tolerance
            If swDimTol.Type = swTolNONE Then
                swDispDim.MarkedForDrawing = False
            Else
                swDispDim.MarkedForDrawing = True
            End If
            Set swDispDim = swSubFeat.GetNextDisplayDimension(swDispDim)
        Wend
        Set swSubFeat = swSubFeat.GetNextSubFeature
    Wend
    Set swDispDim = swFeat.GetFirstDisplayDimension
    While Not (swDispDim Is Nothing)
        Set swDim = swDispDim.GetDimension
        Set swDimTol = swDim.Tolerance
        If swDimTol.Type = swTolNONE Then
            swDispDim.MarkedForDrawing = False
        Else
            swDispDim.MarkedForDrawing = True
        End If
        Set swDispDim = swFeat.GetNextDisplayDimension(swDispDim)
    Wend
    Set swFeat = swFeat.GetNextFeature
Wend

Set swDispDim = Nothing
Set swDim = Nothing
Set swDimTol = Nothing
Set swAnnot = Nothing
Set swFeat = Nothing
Set swDoc = Nothing
Set swApp = Nothing


End Sub

RE: marked for drawing

(OP)
Thanks handleman, I think this will work!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources