A little LISP tweeking please

Discussion in 'AutoCAD' started by Rick Spangenberger, Feb 12, 2005.

  1. An NG member was kind enough to supply this code to me. It draws a line
    underneath text with inputted text location, linetype and linetype scale.
    ------------------------------------------------------------------------------------------------------------------------------------------------------

    I would like it to use the current text style and height, instead of the
    standard style and prompting me for a height.

    I would like it to use hidden as the linetype, instead of being prompted.

    I would like it to retain the initially prompted input value for the
    linetype scale, until I change it.

    Finally, stay in the command until I force an exit.
    ________________________________________________________________________________________________________________

    This is the code:

    (defun c:ntu (/ tx hei loc ss ssn sse sp th gap tb tb1
    tlen ep elast ename opt ss2 ent sf opt1)
    (vl-load-com)
    (setq tx (getstring T "\nENTER NEW TEXT TO ADD UNDERLINE: "))
    (setq st (getstring S "\nENTER TEXT STYLE: '))
    (setq loc (getpoint "\nENTER LOCATION FOR OBJECT: "))
    (command "_text" loc ST "" tx "")
    (setq ss (entlast))
    (setq sse (entget ss))
    (setq sp (cdr (assoc 10 sse)))
    (setq th (cdr (assoc 40 sse)))
    (setq gap (* th 0.2))
    (setq tb (textbox sse))
    (setq tb1 (nth 1 tb))
    (setq tlen (car tb1))
    (setq sp (list (car sp)(- (cadr sp) gap)(caddr sp)))
    (setq ep (list (+ (car sp) tlen)(cadr sp)(caddr sp)))
    (command "_line" sp ep "")
    (setq elast (entget (entlast))
    ename (cdr (car elast))
    opt (getstring "\nENTER NEW LINETYPE NAME: "))
    (command "_change" ename "" "p" "lt" opt "")
    (setq ss2 (entlast))
    (setq ent (vlax-ename->vla-object ss2))
    (setq sf (rtos (vlax-get-property ent "LinetypeScale")))
    (setq opt1 (getreal (strcat "\nENTER NEW LINE TYPE SCALE" "<" sf ">" ":
    ")))
    (vla-put-LinetypeScale ent opt1)
    (princ)
    )

    A great thanks to Ade Suharna for supplying the code.
    Thanks for any help forthcoming!
     
    Rick Spangenberger, Feb 12, 2005
    #1
  2. Rick Spangenberger

    ECCAD Guest

    Rick,
    See the other thread.

    Bob
     
    ECCAD, Feb 12, 2005
    #2
  3. Rick Spangenberger

    TCEBob Guest

    Bob, give us a hint.

    rs
     
    TCEBob, Feb 13, 2005
    #3
  4. Rick Spangenberger

    ECCAD Guest

    ECCAD, Feb 13, 2005
    #4
  5. Rick Spangenberger

    tcebob Guest

    tcebob, Feb 13, 2005
    #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.