Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Automatic increase annotation value

Status
Not open for further replies.

taffcad

Mechanical
Joined
May 27, 2004
Messages
49
Location
GB
Hello to you all

I have to identify over 200 objects with a code which includes a number eg FR01 to FR200. Is there an easier way of inserting the annotation which would automatically increase the number by 1. Could a lisp do it?

Any advice would be appreciated
 
But of course ;-)

You have to be a little more specific what you are trying to accomplish.

"Whether you think that you can, or that you can't, you are usually right "
.. Henry Ford
 
Here is a VERY quick and dirty program snippet in VBA that will do what you ask. There is no error checking or user input other than the point for the text to be created. This could be made pretty, but I'm not sure it's worth the effort if your only going to do this once.

VBA Code Follows....
Code:
Public Sub test()
    Dim objText As AcadText
    txt = "FR"
    For i = 1 To 200
        ptStart = ThisDrawing.Utility.GetPoint(, "Pick the center point for the text: ")
        Select Case i
            Case Is > 99
                txt = txt & Trim(Str(i))
            Case 10 To 99
                txt = txt & "0" & Trim(Str(i))
            Case 1 To 9
                txt = txt & "00" & Trim(Str(i))
        End Select
        Set objText = ThisDrawing.ModelSpace.AddText(txt, ptStart, 0.2)
        objText.Update
        txt = "FR"
    Next i
    
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top