;=================== TEXT MOVE TO MID POINT, ROTATE 0, JUSTIFY MIDDLE =======================
;
(defun KM:MP ( / p1 p2 ) ; Get MP that is MID POINT
(setq p1 (getpoint "\nPick a LowerLeft Point:\n") p2 (getpoint "Pick a UpperRight Point:\n"))
(setq mp (list (/ (+ (car p1) (car p2)) 2.0) (/ (+ (cadr p1) (cadr p2)) 2.0) 0.0))
)
(defun c:to (/ cl txt ent_name m old new) ;; Text move to the Origin of the mid point
(setq cl (getvar "CLAYER"))
;(setq ent_name (ssname (ssget ":S" '((0 . "TEXT"))) 0))
(setq ent (car (entsel "\nSelect a TEXT.")))
(while
(/= "TEXT" (cdr (assoc 0 (entget ent))))
(setq ent (car (entsel "\nSelect again.")))
)
(setq ent_name (entget ent))
(setq m (KM:MP))
(setq old (assoc 10 ent_name)
new (cons 10 m) ;First alignment point
ent_name (subst new old ent_name)
)
(setq old (assoc 11 ent_name)
new (cons 11 m) ;Second alignment point
ent_name (subst new old ent_name)
)
(setq old (assoc 50 ent_name)
new (cons 50 0) ;Text rotation
ent_name (subst new old ent_name)
)
(setq old (assoc 72 ent_name)
new (cons 72 4) ;Horizontal text justification,0=Left,1=Center,2=Right,4=Middle,5=Fit
ent_name (subst new old ent_name)
)
(entmod ent_name)
(setvar "CLAYER" cl)
(princ)
)
'autocad' 카테고리의 다른 글
STAIR CALCULATOR (1) | 2022.09.30 |
---|---|
Date and Time Stamping (0) | 2022.07.14 |
VPORTS SCRIPT (0) | 2022.07.05 |
PLOT PDF by ATTRIB(update20220616) (0) | 2022.06.16 |
DRAW STEEL SHAPE LSP (0) | 2022.05.27 |