- 积分
- 6664
- 明经币
- 个
- 注册时间
- 2010-4-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2023-11-30 15:05:04
|
显示全部楼层
本帖最后由 alexmai 于 2023-11-30 15:17 编辑
;;文字角度为0度,
(defun c:te0 ( / ss flt j mode)
(acet-error-init
(list (list "cmdecho" 0
"highlight" (getvar "highlight")
"limcheck" 0
"pickstyle" 0
);list
T
);list
);acet-error-init
(setq flt '((-4 . "<OR")
(0 . "TEXT")
(0 . "ATTDEF")
(0 . "MTEXT")
(-4 . "<AND")
(0 . "INSERT")
(66 . 1)
(-4 . "AND>")
(-4 . "OR>")
)
);setq
(princ "\nSelect TEXT, MTEXT, ATTDEF, or BLOCK inserts w/attributes...")
(if (and (setq ss (ssget flt))
(setq ss (car (acet-ss-filter (list ss
'(("LAYERUNLOCKED") ;Dis-allow locked layers, non-current-space
("CURRENTUCS") ;and dis-allow objects not in current ucs
)
T
);list
);acet-ss-filter
);car
);setq
);and
(progn
(setq ss (bns_annotation_ss ss))
(setq mode 0);setq
(setvar "highlight" 0)
(setq j (bns_trot ss mode))
(if ss
(command "_.select" ss "")
);if
(princ (strcat "\n" (itoa j) " objects modified."))
);progn then
(princ "\nNo valid objects selected.")
);if
(acet-error-restore)
);
(defun bns_trot ( ss mode / na e1 n a b j )
(setq j 0)
(setq n 0)
(repeat (sslength ss)
(setq na (ssname ss n)
e1 (entget na)
);setq
(if (= "MTEXT" (cdr (assoc 0 e1)))
(setq a (cdr (assoc 50 e1)))
(setq a (acet-geom-angle-trans (cdr (assoc 50 e1)) na 1))
);if
(setq a (- a (getvar "angbase")))
(if (not mode)
(progn
(setq a (* (/ 180.0 pi) a))
(if (< a 0)
(setq a (+ a 360));setq
);if
(if (and (> a 100.0) (< a 280.0))
(progn
(bns_rotate_text e1 pi)
(setq j (+ j 1));setq
);progn then
);if
);progn then most-readable
(progn
(setq a (- mode a));setq
(bns_rotate_text e1 a)
(setq j (+ j 1));setq
);progn else
);if
(setq n (+ n 1));setq
);repeat
j ;the number of objects modified.
);defun bns_trot
(defun bns_rotate_text ( e1 ang / p1 p2 a)
(setq p1 (acet-geom-textbox e1 0.2)
p1 (acet-geom-midpoint (car p1) (caddr p1))
a (cdr (assoc 50 e1))
a (+ ang a)
e1 (subst (cons 50 a) (assoc 50 e1) e1)
);setq
(entmod e1)
(entupd (cdr (assoc -1 e1)))
(setq e1 (entget (cdr (assoc -1 e1))))
(setq p2 (acet-geom-textbox e1 0.2)
p2 (acet-geom-midpoint (car p2) (caddr p2))
a (acet-geom-delta-vector p2 p1)
a (trans a 1 na T)
p1 (cdr (assoc 10 e1))
p1 (acet-geom-vector-add p1 a)
p2 (cdr (assoc 11 e1))
p2 (acet-geom-vector-add p2 a)
e1 (subst (cons 10 p1) (assoc 10 e1) e1)
e1 (subst (cons 11 p2) (assoc 11 e1) e1)
);setq
(entmod e1)
(entupd (cdr (assoc -1 e1)))
);defun bns_rotate_text
|
|