Originally Posted by
jlogan02
Has anyone had any experience with creating justifications based on distance from an object? In other words...
I want to allow the user to select a specific justification from a dialog or prompt and place the start point of the text "x" distance from the from an object.
Is this possible?
J. Logan
Hi jlogan02,
What you want maybe like this.
Code:
(defun c:test (/ loc str th rot el sse tb len opt tex tex1 just p2)
(setq loc (getpoint "\nClick any location in drawing area<0,0,0>: "))
(if (= loc nil)(setq loc '(0 0 0)))
(setq str "Adesu")
(setq th 1)
(setq rot 0)
(command "_text" loc th "" str rot)
(setq el (entlast))
(setq sse (entget el))
(setq tb (textbox sse))
(setq len (caadr tb))
(initget "R r C c L l")
(setq opt (getkword "\nSelect option [(r)ight,(c)enter,(l)eft]<c>: "))
(if (= opt nil)(setq opt "C"))
(setq tex "\nEnter justification distance from point object: ")
(setq tex1 (strcat "[current length of text = " (rtos len 2 5) " ]"))
(command "_erase" el "")
(cond ((= opt "R")
(progn
(setq just (getdist (strcat tex tex1 "<0>: ")))
(if (= just nil)(setq just '(0)))
(setq p2 (polar loc 0 just))
(command "_text" p2 th "" str rot)
) ; progn
)
((= opt "C")
(progn
(setq just (/ len 2.0))
(setq p2 (polar loc pi just))
(command "_text" p2 th "" str rot)
) ; progn
)
((= opt "L")
(progn
(setq just (getdist (strcat tex tex1 "<0>: ")))
(if (= just nil)(setq just '(0)))
(setq p2 (polar loc pi just))
(command "_text" p2 th "" str rot)
) ; progn
)
) ; cond
(princ)
) ; defun