label pline

Discussion in 'AutoCAD' started by spencer1971, May 7, 2004.

  1. spencer1971

    spencer1971 Guest

    I have written this basic bit of code which I am trying to amend to label vertex points of a selected pile.

    I feel this should be quite simple but cannot work out how to move the text insert point while amending n.

    Any suggestions


    (defun C:NUM ()
    (setq pfx (getstring "\n Prefix: ")
    sfx (getstring "\n Suffix: ")
    sn (getint "\nStart Number: ")
    )
    (while sn
    (command "text" PAUSE "" 0 (strcat pfx (rtos sn 2 0) sfx))
    (setq sn (1+ sn))
    )
    )
     
    spencer1971, May 7, 2004
    #1
  2. spencer1971

    bob.at Guest

    Spencer,

    i dont see your problem. I think the code works well and places the text to the pointed location. The only thing i would change is to test for userinput, so you can leave the program with a null input without getting an error message

    bob.at

    (defun C:NUM ()
    (setq pfx (getstring "\n Prefix: ")
    sfx (getstring "\n Suffix: ")
    sn (getint "\nStart Number: ")
    )
    (while (setq pt (getpoint "\nText insert point: "))
    (command "text" pt "" 0 (strcat pfx (rtos sn 2 0) sfx))
    (setq sn (1+ sn))
    )
    )
     
    bob.at, May 7, 2004
    #2
  3. spencer1971

    spencer1971 Guest

    Sorry bob.at I mislead you,

    I get the code working ok for picked points but i want to automate it to use pline vertex points from a selected pline instead of picking individual points.

    Im trying to combine it with the code you helped me with earlier
     
    spencer1971, May 7, 2004
    #3
  4. spencer1971

    spencer1971 Guest

    Sorry bob I mislead you.

    I realise my first bit of code is OK but i am trying to amend it to use pline vertex points instead of picked points. so user just selects 1 pline.

    I know how to create the selection set from the pline and the code you supplied ealier works great for sorting the points and inserting the pline (thanks again)

    I want to run this code to label points.
     
    spencer1971, May 7, 2004
    #4
  5. spencer1971

    bob.at Guest

    Try this out and if it doesnt work you come back here.
    Aou must be aware, that a LWPOLYLINE has more then one "10"-goruops in it (while the circle has only one).

    And if you would catch all cases, you must also check for POLYLINE elements (splined plines for example) which have subelements for each vertex.

    bob.at
     
    bob.at, May 7, 2004
    #5
  6. spencer1971

    Tim Badger Guest

    Wow, just read all the replies to this post... hummmm. Anyway, to spin
    through a pline or lwpline, or any complex object for that matter, is rather
    easy. Email me and I'll help you out.

    Tim Badger




    vertex points of a selected pile.
    text insert point while amending n.
     
    Tim Badger, May 9, 2004
    #6
  7. spencer1971

    spencer1971 Guest

    I have got my lisp working thanks to you all.

    If anyones interestead ill post it for a critique...

    Im sure its very overdone.

    Tanks for your help

    Spencer
     
    spencer1971, May 10, 2004
    #7
  8. spencer1971

    bob.at Guest

    If you like you can post it and it will be no problem that i (and maybe some others) throw a glance at the code, giving some hints

    bob.at
     
    bob.at, May 10, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.