Co-ordinate LISP

Discussion in 'AutoCAD' started by Xolo, Nov 25, 2004.

  1. Xolo

    Xolo Guest

    Hey everyone,

    Looking for a LISP, if anyone has something like this, or parts of it that I
    can add together to make what I want....

    What I want to be able to do, is to pick a point/entity on the screen; have
    the z co-ordinate extracted from that object; then be able to pick another
    point on the screen where text will be inserted and have that z co-ordinate
    information written out. Not sure what size of text or justification would
    be required, but I could probably figure that out at a later time.....maybe
    have some sort of option to allow for it to be set when running the LISP the
    first time......and then have it continuously loop to allow the user to keep
    picking new points for z co-ordinates and then text insertion points....

    I don't want to try figuring this out from scratch, as I always complicate
    things way too much for what's required.

    Thanks in advance for all of your help, and thanks to all who have helped me
    before.

    Xolo
     
    Xolo, Nov 25, 2004
    #1
  2. Xolo

    Nava Ran Guest

    Nava Ran, Nov 26, 2004
    #2
  3. Xolo

    ECCAD Guest

    This will get you started.
    (defun C:getZ ( / osm sty ent elist pt_lst Z Z_str pt)
    (setq osm (getvar "osmode"))
    (setq sty (getvar "textstyle"))
    (setq ent (car (entsel "\nSelect a Entity:")))
    (setq elist (entget ent))
    (if (/= (cdr (assoc 10 elist)) nil)
    (progn
    (setvar "osmode" 0); NONE
    (command "_style" "STANDARD" "txt.shx" "0" "1" "0" "n" "n" "n")
    (setq pt_lst (cdr (assoc 10 elist)))
    (setq Z (caddr pt_lst))
    (setq Z_str (rtos Z))
    (setq pt (getpoint "\nPick a point for the Text:"))
    (if pt
    (command "_text" pt "0.25" "0" Z_str)
    ); if
    ); progn
    ); if
    (setvar "osmode" osm)
    (setvar "textstyle" sty)
    (princ)
    ); function
     
    ECCAD, Nov 26, 2004
    #3
  4. Xolo

    Xolo Guest

    ECCAD,

    Thank-you so much for your staring help....this definitely will let me build
    to it to tweak it for more precise settings, and it's a great starting
    point.

    Thanks so much,

    Xolo

    This will get you started.
    (defun C:getZ ( / osm sty ent elist pt_lst Z Z_str pt)
    (setq osm (getvar "osmode"))
    (setq sty (getvar "textstyle"))
    (setq ent (car (entsel "\nSelect a Entity:")))
    (setq elist (entget ent))
    (if (/= (cdr (assoc 10 elist)) nil)
    (progn
    (setvar "osmode" 0); NONE
    (command "_style" "STANDARD" "txt.shx" "0" "1" "0" "n" "n" "n")
    (setq pt_lst (cdr (assoc 10 elist)))
    (setq Z (caddr pt_lst))
    (setq Z_str (rtos Z))
    (setq pt (getpoint "\nPick a point for the Text:"))
    (if pt
    (command "_text" pt "0.25" "0" Z_str)
    ); if
    ); progn
    ); if
    (setvar "osmode" osm)
    (setvar "textstyle" sty)
    (princ)
    ); function
     
    Xolo, Nov 27, 2004
    #4
  5. Xolo

    ECCAD Guest

    ECCAD, Nov 27, 2004
    #5
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.