command needed

Discussion in 'AutoCAD' started by Victor H. Becerra, Jun 29, 2004.

  1. Is there a way to attach dtext to a leader such as qlattach attaches
    mtext to a leader? Any help is greatly appreciated.
     
    Victor H. Becerra, Jun 29, 2004
    #1
  2. Victor H. Becerra

    Walt Engle Guest

    How about this routine?

    ; LDR.LSP
    ; DRAWS LEADER WITH STANDARD ARROW HEAD AND TEXT WITH NO ;OPTIONS
    (defun c:ldr ( / np g:ts ts n tdata p1 p2 p3 p4)
    (graphscr)
    (setvar "osmode" 0)
    (prompt "\nDraws leader with a standard arrowhead and text [NO
    OPTIONS]")
    (terpri)
    (setq g:ts (* 0.125 (getvar "dimscale")))
    (setq asz (getvar "dimasz"))
    (setq asz (* asz (getvar "dimscale")))
    (setq woah (/ asz 3.0))
    (setq ts g:ts)
    (setvar "textsize" ts)
    (setq n 0)
    (c:ldr1)
    (setq tdata nil)
    (while (/= "" (setq tl (getstring t "\nEnter text: ")))
    (setq tdata (cons tl tdata))
    )

    (setq htet (getdist (strcat "\n<Current text Height>/or Enter
    new text Height <"
    (rtos (/ (getvar "textsize")(getvar
    "dimscale"))) ">: ")))

    (if (null htet)(setq htet (/ (getvar "textsize")(getvar
    "dimscale"))))
    ;(setq ts (* htet (getvar "dimscale")))
    ;(if (<= htet 0.125)(command "-layer" "s" "0" ""))
    ;(if (> htet 0.125)
    ;(progn
    (if (> htet 0.375)(command "-layer" "s" "2" ""))
    ;)
    ;)

    (setq tdata (reverse tdata))
    (if (<= (car p1)(car p2))
    (progn
    (setq p3 (list (+ (car p2) g:ts)(cadr p2))
    p4 (list (+ (car p3) g:ts)(- (cadr p3)(* 0.5
    ts)))
    )
    (command "line" p2 p3 "")
    (repeat (length tdata)
    (command "text" p4 ts 0 (nth n tdata))
    (setq p4 (polar p4 (* 1.5 pi)(* 1.75 ts)))
    (setq n (1+ n))
    )
    )
    )
    (if (> (car p1)(car p2))
    (progn
    (setq p3 (list (- (car p2) g:ts)(cadr p2))
    p4 (list (- (car p3) g:ts)(- (cadr p2)(* 0.5
    ts)))
    )
    (command "line" p2 p3 "")
    (repeat (length tdata)
    (command "text" "r" p4 ts 0 (nth n tdata))
    (setq p4 (polar p4 (* 1.5 pi)(* 1.75 ts)))
    (setq n (1+ n))
    )
    )
    )
    (princ)
    (SETVAR "OSMODE" 32)
    )
    ;
    (defun c:ldr1 ()
    (initget 1)
    (setq p1 (getpoint "\nStart leader (Tip of arrowhead): "))
    (initget 1)
    (setq p2 (getpoint p1 "\nNext point on leader or end: "))
    (setq p3 (polar p1 (angle p1 p2) (* 1.5 g:ts)))
    (command "Pline" p1 "w" "0" (* 0.5 g:ts) p3 "w" "0" "" p2)
    (while
    (setq np (getpoint (getvar "lastpoint") "\nNext point on
    leader or <ENTER> to end: "))
    (if (/= np "")
    (progn
    (setq p1 (getvar "lastpoint"))
    (setq p2 np)
    (command p2)
    )
    )
    (if (= np "")
    (command "")
    )
    )
    )
     
    Walt Engle, Jun 29, 2004
    #2
  3. Thanks Walt, however what I am looking for is to be able to attach dtext
    to a leader the same way as qlattach works with a leader and mtext. My
    objective is to be able to stretch both entities without affecting the
    tip of the leader or spacing of the text (above leader).
     
    Victor H. Becerra, Jun 30, 2004
    #3
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.