快属性批量编辑
快属性批量编辑我想在这个基础上加上文字旋转一项,请路过的高手帮忙
原帖地址http://bbs.mjtd.com/forum.php?mod=viewthread&tid=107585&extra=&highlight=%CA%F4%D0%D4%C5%FA%C1%BF&page=1
http://bbs.mjtd.com/forum.php?mod=attachment&aid=NzkxNjl8YmIzMGEyOTF8MTY3OTIwNzI4OHw3MzI2NjY2fDEwNzU4NQ%3D%3D&noupdate=yes
KO你 发表于 2024-4-10 06:54
朋友,能私下发源码我吗
本帖最后由 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
uualice2020 发表于 2024-4-10 20:00
把代码里的颜色选项这里的随层色 colorlist (cons "ByLayer" colorlist))
改成随块色效果更佳 colorlist (cons "ByBlock" colorlist)) 估计要整点币吸引大佬来帮忙了,哈哈。 lxl217114 发表于 2023-3-20 12:35
估计要整点币吸引大佬来帮忙了,哈哈。
之前有问题发币都没人回应,等有人帮我解决问题,自有悬赏 这个是不是自带battman就可以? guokexx 发表于 2023-3-23 18:15
这个是不是自带battman就可以?
battman 块属性管理器改的话所有的块都改了
我就是想编辑指定的图块修改 顶一下,顶出高手 KO你 发表于 2023-10-8 03:26
顶一下,顶出高手
uualice2020 发表于 2023-10-9 10:49
能用我发上来的源码弄出来吗,加上面板选项 本帖最后由 uualice2020 于 2023-10-9 20:59 编辑
KO你 发表于 2023-10-9 20:47
能用我发上来的源码弄出来吗,加上面板选项
不知道符不符合你的要求?