Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

marked for drawing 1

Status
Not open for further replies.

Westerfield

Mechanical
Jul 8, 2005
7
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.

 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor