×
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

How to find OVERRIDE Dimensions in a drawing?
3

How to find OVERRIDE Dimensions in a drawing?

How to find OVERRIDE Dimensions in a drawing?

(OP)
Hi,

I want to find override dimensions seperately in a drawing which has lot of model dimensions, driven dimensions and override dimensions.
Any way to sort out the override dimensions to show  in a different color?

Thanks,

Murugan.S
India.

RE: How to find OVERRIDE Dimensions in a drawing?

In SW07 overdefined are red and and conflicting are yellow. Older version they are all red conflicting and overdefined. Driven Dims are grey visible dims are black by default.

Regards,

Scott Baugh, CSWP
www.scottjbaugh.com
FAQ731-376

RE: How to find OVERRIDE Dimensions in a drawing?

I believe he's talking about value overridden dimensions in a drawing.  These dimensions would not update when the model changes.  I believe it's very risky practice to use these.  I can see why you would want value overridden dimensions to stand out in a drawing.

RE: How to find OVERRIDE Dimensions in a drawing?

The only thing I can think of for that would to manually put them on a layer with color.

Regards,

Scott Baugh, CSWP
www.scottjbaugh.com
FAQ731-376

RE: How to find OVERRIDE Dimensions in a drawing?

Rather than changing the color, you can run this macro, which will enclose any overridden dimensions on the active drawing with "*".  

CODE

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swDwg As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swDispDim As SldWorks.DisplayDimension
Dim swDim As SldWorks.Dimension
Dim sCurPrefix As String
Dim sCurSuffix As String
Dim nOpenParPos As Long
Dim nCloseParPos As Long
Dim vDimVal As Variant
Dim dInchVal As Double
Dim sInchString As String
Dim sNewPrefix As String
Dim sNewSuffix As String
Dim KillFlag As Integer
Dim sMsg As String


Sub AddStarToOverridden()

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

If swDoc.GetType <> swDocDRAWING Then
    MsgBox "This macro only works for drawing files."
    Exit Sub
End If

sMsg = "This macro will add a text prefix and suffix of ""*""" & _
        vbCrLf & "to all overridden dimensions in this drawing." & _
        vbCrLf & vbCrLf & _
        "To add or update stars on overridden dimensions, choose ""Yes""" & vbCrLf & _
        "To remove all stars, choose ""No""" & _
        vbCrLf & "To quit, choose ""Cancel"""
KillFlag = MsgBox(sMsg, vbYesNoCancel, "Add stars?")

If KillFlag = vbCancel Then
    Exit Sub
End If


Set swDwg = swDoc


Set swView = swDwg.GetFirstView
While Not (swView Is Nothing)
    Set swDispDim = swView.GetFirstDisplayDimension5
    While Not swDispDim Is Nothing
        Set swDim = swDispDim.GetDimension
        sCurSuffix = swDispDim.GetText(swDimensionTextSuffix)
        sCurPrefix = swDispDim.GetText(swDimensionTextPrefix)
        
        If (swDispDim.GetOverride) And (KillFlag = vbYes) Then
            If Right(sCurPrefix, 1) <> "*" Then
                sNewPrefix = sCurPrefix & "*"
            Else
                sNewPrefix = sCurPrefix
            End If
            If Left(sCurSuffix, 1) <> "*" Then
                sNewSuffix = "*" & sCurSuffix
            Else
                sNewSuffix = sCurSuffix
            End If
        Else
            If Right(sCurPrefix, 1) = "*" Then
                sNewPrefix = Left(sCurPrefix, Len(sCurPrefix) - 1)
            Else
                sNewPrefix = sCurPrefix
            End If
            If Left(sCurSuffix, 1) = "*" Then
                sNewSuffix = Right(sCurSuffix, Len(sCurSuffix) - 1)
            Else
                sNewSuffix = sCurSuffix
            End If
        End If

        swDispDim.SetText swDimensionTextSuffix, sNewSuffix
        swDispDim.SetText swDimensionTextPrefix, sNewPrefix
        
        Set swDispDim = swDispDim.GetNext5
    Wend
    Set swView = swView.GetNextView
Wend


End Sub

RE: How to find OVERRIDE Dimensions in a drawing?

Just one note on that macro, that only works if the user picked the check-box for "Override Value" on your dimension and entered a value.  If the user deleted the <DIM> as the dimension text and entered a value, then the macro will not work.  
Whenever I have used dimension that were not exact, such as rounding up to inches for nominal dims for a client, I would put it on a different layer.  

Man, I have to learn C+, VB, or whatever that is.  

SW06 SP5.0

Flores

RE: How to find OVERRIDE Dimensions in a drawing?

Here's an interesting tidbit... you can override the layer color for a dimension in the API, but I can't find anywhere in the user interface to do that.  That's why the macro above adds stars rather than changing the color.  However, I found the layer color override.  I also added a check to see if the <DIM> was deleted from the text display.  The downside of this, however, is that hole callouts that are "Define by hole wizard" are also caught, since those don't actually use the <DIM> but the hole wizard data.  I couldn't find a good way to exclude them.  

CODE

Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim swDwg As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim swDispDim As SldWorks.DisplayDimension
Dim swAnnot As SldWorks.Annotation
Const OVERRIDDENDIMCOLOR As Integer = 255
Dim CurAnnotOverrides As Integer
Dim swDim As SldWorks.Dimension
Dim KillFlag As Integer
Dim OverRiddenFlag As Boolean
Dim sMsg As String


Sub ColorOverridden()

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

If swDoc.GetType <> swDocDRAWING Then
    MsgBox "This macro only works for drawing files."
    Exit Sub
End If

sMsg = "This macro will color" & _
        vbCrLf & "all overridden dimensions in this drawing." & _
        vbCrLf & vbCrLf & _
        "To add color to overridden dimensions, choose ""Yes""" & vbCrLf & _
        "To remove color, choose ""No""" & _
        vbCrLf & "To quit, choose ""Cancel"""
KillFlag = MsgBox(sMsg, vbYesNoCancel, "Add stars?")

If KillFlag = vbCancel Then
    Exit Sub
End If


Set swDwg = swDoc


Set swView = swDwg.GetFirstView
While Not (swView Is Nothing)
    Set swDispDim = swView.GetFirstDisplayDimension5
    While Not swDispDim Is Nothing
        Set swAnnot = swDispDim.GetAnnotation
        CurAnnotOverrides = swAnnot.LayerOverride
        OverRiddenFlag = False
        If CBool(swDispDim.GetOverride) Then
            OverRiddenFlag = True
        End If
''''Delete the section from here to "END OF SECTION TO DELETE" to only
''''color dimensions with the "Override" box checked
        If CBool(swDispDim.ShowDimensionValue) Then
            'do nothing
        Else
            OverRiddenFlag = True
        End If
''''END OF SECTION TO DELETE
        If (OverRiddenFlag And (KillFlag = vbYes)) Then
            If CurAnnotOverrides Mod 2 <> 1 Then
                swAnnot.LayerOverride = CurAnnotOverrides + 1
            End If
            swAnnot.Color = OVERRIDDENDIMCOLOR
        Else
            If CurAnnotOverrides Mod 2 = 1 Then
                swAnnot.LayerOverride = CurAnnotOverrides - 1
            End If
        End If
        Set swDispDim = swDispDim.GetNext5
    Wend
    Set swView = swView.GetNextView
Wend


End Sub

RE: How to find OVERRIDE Dimensions in a drawing?

(OP)
Hi all,
thanks for all your replies.
actually one of my customer gave the drawing which has lot of model dimensions and override dimensions.As a QC engineer I have to find the override dimensions.
thanks for API coding.


regards
Murugan.S
CSWP
India.

RE: How to find OVERRIDE Dimensions in a drawing?

2
FYI, if you have SWX Office professional then there is no need for a macro because this functionality is already available in the SWX Design Checker.

RE: How to find OVERRIDE Dimensions in a drawing?

(OP)
Hi Stoker,
Great ...! It is working.
Thanks.

Murugan.S
CSWP
India.

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