+ Reply to Thread
Results 1 to 10 of 10

Thread: Auto-numbering

  1. #1
    Forum Newbie
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    5

    Default Auto-numbering

    Registered forum members do not see this ad.

    I would like to learn how to write a LISP routine? or whatever it would take so I can automatically number my blocks as I insert them. Or copy a text entity so that every time I paste it, it is the next numeral in the order. I would like to start with the number "001" and every time I paste it, it is "002" then "003" to infinity. If you could help me or direct me to how I can help myself, I would greatly appreciate it.

  2. #2
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 7 Pro x64
    Motherboard:
    Intel DZ77RE-75K
    CPU:
    i7-3770K 3.50GHz
    RAM:
    32GB
    Graphics:
    Nvidia Quadro 2000
    Primary Storage:
    125GB SSD
    Secondary Storage:
    500GB SATA
    Monitor:
    ASUS 27" / ASUS 24"
    Discipline
    Civil
    Using
    Civil 3D 2013
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    3,633

    Default

    Here is a basic version of what you want. It does not add the leading zeros however. Study this and read up on lisp in the developers help (\help\acad_dev.chm) and you should be able to modify this to suit your needs.

    Code:
    (defun c:autonum (/ *ms* pt)
      (vl-load-com)
      (setq *ms* (vla-get-modelspace
                   (vla-get-activedocument (vlax-get-acad-object))
                 )
      )
      (if (not (eq (type autonumi) 'INT))
        (setq autonumi 1)
      )
      (while (setq pt (getpoint "\n Select point: "))
        (vla-addtext
          *ms*
          (rtos autonumi 2 0)
          (vlax-3d-point pt)
          (getvar "textsize")
        )
        (setq autonumi (1+ autonumi))
      )
    )

  3. #3
    Forum Newbie
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    5

    Default

    Thanks alot, but I guess I am far less advanced than you think I am? I know my way around AutoCAD but I don't know anything about LISP. I don't know what to do with this. I know I load application but after that I don't know what to do to even see if it is what I want or how I should modify it. Also, where do I find the help link you gave?

  4. #4
    Banned Alan Cullen's Avatar
    Using
    Map 3D 2009
    Join Date
    Jun 2006
    Location
    Cairns, Queensland, Australia
    Posts
    4,181

    Default

    I think I understand what you are trying to achieve, but I don't understand why !!!!!!

    You can do what you want through a lisp routine....insert a block (any block name) and place sequential text number beside that block. Unfortunately the lisp code will be somewhat complex and take some time to write, and I don't have such a lisp routine to give you (because I've never needed to do this).

    rkmcswain wrote you some basic code, it will place sequential text numbering at any point you pick. Before you use it you must select the layer you want to be current, select the colour you want to be current, and more importantly, select the text font and size you want to be current.

    Copy/paste the code to a text editor (notepad) and save it to a file name (e.g. "autonum.lsp") at a location where Autocad can find it (TOOLS -> OPTIONS -> Files -> Support File Search Path). Then to load it type at the command line (load"autonum"). Then to fire it up type AUTONUM at the command line.

    I realise this doesn't really give you a definitive answer, But I hope it helps a little bit....

  5. #5
    Forum Newbie
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    5

    Default

    Why? I need to do this because my job requires that I insert approxametly 2000 individually numbered blocks into my drawings. I want to be able to just copy and paste my block with a number next to it and every time I place the block, it be numbered accordingly. If you know of a better way to do this, please let me know. I don't want to edit this text 2000 times.

    Anyway, I saved the file and followed your instructions and it just says "unknown command". I'm sure this can't be as difficult as I seem to be making it?

  6. #6
    Senior Member kpblc's Avatar
    Using
    AutoCAD 2005
    Join Date
    May 2006
    Location
    Russia, St-Petersburg
    Posts
    317

    Default

    What is the law of renumbering blocks? Renumber bock atts by order of creating? By x and y position? Or manually defining? What is the attribute tag?
    Until you not answer this questions, I think noone can helps you
    All I say is only my opinion.

  7. #7
    Forum Deity
    Using
    not specified
    Join Date
    Jul 2004
    Location
    Anchorage, Alaska
    Posts
    2,074

    Default

    I'm guessing you had a problem at the point;

    (load "autonum") - did you use parentheses, did you get a response regarding a successful load? Another way to load the file is Tools>>Load Application>>browse to file>>Load.

    If this doesn't do what you want, do a web search, i've seen many a request/response for auto numbering blocks, blocks that increment with each copy, etc.

  8. #8
    Super Moderator rkmcswain's Avatar
    Computer Details
    rkmcswain's Computer Details
    Operating System:
    Windows 7 Pro x64
    Motherboard:
    Intel DZ77RE-75K
    CPU:
    i7-3770K 3.50GHz
    RAM:
    32GB
    Graphics:
    Nvidia Quadro 2000
    Primary Storage:
    125GB SSD
    Secondary Storage:
    500GB SATA
    Monitor:
    ASUS 27" / ASUS 24"
    Discipline
    Civil
    Using
    Civil 3D 2013
    Join Date
    Sep 2005
    Location
    Houston
    Posts
    3,633

  9. #9
    Forum Newbie
    Using
    not specified
    Join Date
    Aug 2005
    Posts
    5

    Default

    Wierd. I was trying to load it on my laptop which didn't work. I just loaded it on my pc and it works fine. Thanks for everyones help.

  10. #10
    Super Member CAB's Avatar
    Using
    AutoCAD 2000
    Join Date
    May 2004
    Location
    Tampa, Florida
    Posts
    801

    Default

    Registered forum members do not see this ad.

    There are many routines available to insert incremented text. Just search the net.

    Did you want to insert text or change an attribute as you inserted a block?
    The best way to get help with the latter is to post a drawing with your block in it.

    Otherwise the programmer must know the block name and the attribute tag to accomplish the task.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts