cjf160204
发表于 2023-1-13 10:39:09
感谢楼主的分享
Ming131564
发表于 2023-1-18 13:55:15
;对象居中:by zml84 2009-06-15 此基础上修改:by 忘霄
(defun C:EC (/ box en_tmp ent i pt0 pt1 ss tmp)
(setvar "CMDECHO" 0)
(vl-load-com)
(princ "\n选择需要居中的对象:")
(if (setq ss (ssget))
(progn
(defun box (e / ll ur)
(vla-getboundingbox (vlax-ename->vla-object e) 'll 'ur)
(mapcar 'vlax-safearray->list (list ll ur))
)
(setq i -1)
(command "undo" "be")
(while (setq ent (ssname ss (setq i (1+ i))))
(setq tmp (box ent))
(setq tmp (mapcar '+ (car tmp) (cadr tmp)))
(setq pt0 (mapcar '* tmp '(0.5 0.5 0.5)))
(entdel ent)
(setq en_tmp (bpoly pt0))
(entdel ent)
(setq tmp (box en_tmp))
(setq tmp (mapcar '+ (car tmp) (cadr tmp)))
(setq pt1 (mapcar '* tmp '(0.5 0.5 0.5)))
(command "move" ent "" "non" pt0 "non" pt1)
(entdel en_tmp)
)
(command "undo" "e")
)
(princ "\n没有选择对象!")
)
(princ)
)
这个还支持实体和多行文字
zxfddz
发表于 2023-2-6 15:25:57
感谢楼主分享源码
hehaidizhi
发表于 2023-3-7 15:37:50
感谢分享,很需要
magicheno
发表于 2023-3-21 13:59:28
感谢大佬分享,很好用
jkop
发表于 2023-11-8 10:00:33
路过看到,本人常常用到表格,现在终于可以一次性匡选居中,非常好用!
cghdy
发表于 2023-12-11 16:19:33
发现对象一多就容易直接闪退关闭CAD
sjl_fyl
发表于 2024-1-9 10:52:13
{:1_1:}谢谢
yefei812678
发表于 2024-2-28 13:55:23
感谢楼主分享源码
gwar
发表于 2024-3-2 09:30:35
非常感谢楼主的分享