×
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

2007 inspection dim numbers
2

2007 inspection dim numbers

2007 inspection dim numbers

(OP)
SW2007 sp2.2
 
Is there a way to assign numbers to the dims of a dwg for inspection purposes?
 
For example, you have a detailed dwg, our qc guy writes numbers next to each dim in order to reference to his report. I would like for SW to automatically assign those numbers & place them next to the dims. Is that possible?

RE: 2007 inspection dim numbers

That is not a built-in function of SW.

An API guru may be able to create a macro which recognises the dimensions in a drawing and adds a consecutive number to each.

cheers

RE: 2007 inspection dim numbers

remj-
Why not place a modifying symbol in the Dimension Text box?
ex: 10.00 <C#-1> would give you 10.00 w/ 1 in a circle. It should only take an extra click or two on each dimension.

RE: 2007 inspection dim numbers

(OP)
Great ideas, thanks. I was also thinking of attaching numbers in a different layer so I can turn them on/off

RE: 2007 inspection dim numbers

felix7502,

   What a cool feature!

   I notice that <T#-1> and <S#-1> also work.

   It is a shame that <T#-B> does not work, since this would be a good way to flag revisions.

                         JHG

RE: 2007 inspection dim numbers

drawoh,
Apparently, the symbol capability of SW is fairly unknown.  You can add any symbol into a dimension using the <****> notation as long as you know what the symbol code is.  To find out the symbol code, pick a dimension and then click "More..." in the "Dimension Text" area of the property manager.  Choose "Flag Tri A-Z" from the "Symbol Library" combo box, and choose "Triangle B" beneath.  Then click OK.  The triangle B will appear on the drawing, and the code "<TL-B>" will be shown the "Dimension Text" box of the property manager.  You now know that the code for a letter inside a triangle is "<TL-*>", where * is the letter you want.

remj,
Adding the reference numbers to a different layer would be more difficult to do with a macro.  The reference number would have to be a separate annotation rather than a part of the dimension, and the annotation would have to be grouped with the dimension to make sure that it maintains its position relative to the dimension when the dimension moves.  

If anyone is interested, here is the code to insert felix's symbols to all drawing dimensions:

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 sCurSuffix As String
Dim nOpenParPos As Long
Dim nCloseParPos As Long
Dim vDimVal As Variant
Dim dInchVal As Double
Dim sInchString As String
Dim sNewSuffix As String
Dim KillFlag As Integer
Dim sMsg As String
Dim sRefPfx As String
Dim nRefNum As Long
Const DEFSYM As String = "C#-"


Sub AddDimRefNums()

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 symbol containing a dimension reference number " & _
        vbCrLf & "to all dimensions in this drawing." & vbCrLf & vbCrLf & _
        "To add or update dimension reference symbols, choose ""Yes""" & vbCrLf & _
        "To remove reference symbols, choose ""No""" & _
        vbCrLf & "To quit, choose ""Cancel"""
KillFlag = MsgBox(sMsg, vbYesNoCancel, "Dimension Reference Symbols")

If KillFlag = vbCancel Then
    Exit Sub
End If

If KillFlag = vbYes Then
    sRefPfx = InputBox("Please enter the desired symbol code." & vbCrLf & _
                        "For example, ""C#-"" for circles, ""S#-"" for squares." & vbCrLf & _
                        "Note that symbol codes are case sensitive.", "Symbol Type", DEFSYM)
Else
    sRefPfx = ""
End If

Set swDwg = swDoc

nRefNum = 1

Set swView = swDwg.GetFirstView
While Not (swView Is Nothing)
    Set swDispDim = swView.GetFirstDisplayDimension5
    While Not swDispDim Is Nothing
        Set swDim = swDispDim.GetDimension
        sInchString = sRefPfx & nRefNum
        nRefNum = nRefNum + 1
        sCurSuffix = swDispDim.GetText(swDimensionTextSuffix)
        nOpenParPos = InStr(1, sCurSuffix, "<", vbTextCompare)
        nCloseParPos = InStr(1, sCurSuffix, ">", vbTextCompare)
        If (KillFlag = vbNo) And (nOpenParPos > 0) And (nCloseParPos > 0) Then
            sNewSuffix = Left(sCurSuffix, nOpenParPos - 1)
            sNewSuffix = sNewSuffix & Right(sCurSuffix, Len(sCurSuffix) - nCloseParPos)
        ElseIf (nOpenParPos > 0) And (nCloseParPos > 0) Then
            sNewSuffix = Left(sCurSuffix, nOpenParPos)
            sNewSuffix = sNewSuffix & sInchString
            sNewSuffix = sNewSuffix & Right(sCurSuffix, Len(sCurSuffix) - (nCloseParPos - 1))
        Else
            If KillFlag <> vbNo Then
                sNewSuffix = Trim(sCurSuffix) & " <" & sInchString & ">"
            Else
                sNewSuffix = sCurSuffix
            End If
        End If
        swDispDim.SetText swDimensionTextSuffix, sNewSuffix
        Set swDispDim = swDispDim.GetNext5
    Wend
    Set swView = swView.GetNextView
Wend


End Sub

RE: 2007 inspection dim numbers

[sigh] A buck short and a day late (well 5 minutes anyway) as usual. smile

Good one Handleman

cheers

RE: 2007 inspection dim numbers

Handleman,

It looks like christmas came a little late for me this year, but thanks so much for the macro. santa3

I've had the same "problem" and have just been doing this manually forever.

I'm wondering one thing though, is it somehow possible to beat/work around the limitation of 99 dimensions? We do the same thing (which we refer to as "ballooning") and sometimes we make balloon prints with a few hundred dimensions. After the 99th we have to make a note with a circular border.

Thoughts, feelings, suggestions????


RE: 2007 inspection dim numbers

4zengineering,

Check out CBL's great FAQ on custom symbols at FAQ559-1229: How Do I Create Custom Symbols?.  All you have to do is modify your gtol.sym file to add as many numbers as you want.  However, you should note that once you get above 99 the numbers may start overlapping the box/circle/whatever.  

RE: 2007 inspection dim numbers

My gtol.sym has the following as the circle size:

*99,Circle 99
A,CIRCLE .8,.5,.8
A,TEXT .8,.5,99

By revising the size of the X and the Radius the 150 fits in nicely. The size of the enclosing circle isn't that much different from the 2 digit circle.

*150,Circle 150
A,CIRCLE .9,.5,.9
A,TEXT .9,.5,150

You can tweak as needed.

Note that this would have to be included on all your work stations, otherwise I don't think it will show up except on the ones that have this revision.

Sylvia

RE: 2007 inspection dim numbers

InspectionXpert generates quality inspection sheets automatically from SolidWorks drawings and also identifies them on the drawing.  The website is still under construction but you can go to the www.extensiblecad.com for more information.  TriMech Solutions currently sells the application.

RE: 2007 inspection dim numbers

handleman,

I ran your macro, great time saver, but it only works on the active page.  Is there a way to get this to work on all pages?  Or add in a start number?  I tried c#-16 and it caused problems <c#-161> so does c#1.

I have not tried writing my own macros but it appears this would be a pretty useful skill to learn.

thank you for your time and efforts

RE: 2007 inspection dim numbers

Adding in a start number would be pretty easy.  Just find the line:

nRefNum = 1

and change it to

nRefNum = InputBox("Enter the starting number","",1)

It's been a while since I looked at this code, but I think that should work.  Of course, it error out or behave strangely if you don't enter a number.

RE: 2007 inspection dim numbers

handleman

YOU ARE AWESOME!!!!!

Thank you,  You probably just saved me a couple hours a week.

RE: 2007 inspection dim numbers

Macro writing is most definitely a useful skill to learn, and can really save you a lot of time down the road if you can take the time to learn it.  

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