wjl1014
发表于 2013-1-22 13:36:22
这是一个经典的写法,佩服楼主。
峰峰兒
发表于 2013-11-3 07:43:15
dforme
发表于 2014-1-17 10:39:12
这程序不错哦,先收藏了
linshiyin2
发表于 2014-2-21 09:41:12
收藏,很好用,干脆出个通用函数,选择集的max和min。
395969
发表于 2019-6-19 18:00:33
谢谢版主,很好用
心中的梦想
发表于 2019-6-20 10:30:18
谢谢分享!!!!!!!!!!
tangjunasd58
发表于 2019-6-25 00:01:38
;【PF工具箱--自动边界盒】
(defun c:bjh (/ ss i l1 l2 ll ur os d)
(setq os (getvar 'osmode))
(PRINC "\n【PF工具箱--QQ交流群:214654218】--自动边界盒 ")(PRINC)
(setq d (getreal "\n偏距<5>"))
(if (null d)
(setq d 5)
)
(setq ss (ssget))
(repeat (setq i (sslength ss))
(vla-getboundingbox
(vlax-ename->vla-object (ssname ss (setq i (1- i))))
'll
'ur
)
(setq l1 (cons (vlax-safearray->list ll) l1)
l2 (cons (vlax-safearray->list ur) l2)
)
)
(mapcar 'set
(list 'll 'ur)
(mapcar '(lambda (a b) (apply 'mapcar (cons a b)))
'(min max)
(list l1 l2)
)
)
(command
"rectang"
(trans (polar ll (* pi 1.25) (setq d (sqrt (+ (* d d) (* d d)))))
0
1
)
(trans (polar ur (* pi 0.25) d) 0 1)
)
(setvar 'osmode os)
(princ)
)
296715530
发表于 2019-12-15 13:24:05
本帖最后由 296715530 于 2019-12-15 15:29 编辑
Gu_xl 发表于 2012-5-25 17:49
感谢版主
东拼西凑加了记忆功能,和外框指定图层,以及中途退出捕捉恢复
(defun c:wk (/ ss i l1 l2 ll ur os d)
(defun *MYERR* (MSG)
(setvar "CMDECHO" CMD_OLD)
(setvar "OSMODE" OS_OLD)
(setq *ERROR* *OLDERR*)
(if (= MSG "完美退出。谢谢使用。")
(princ (strcat "\\n>>>" MSG))
(princ "\n>>>虽然中途退出了,对象捕捉已经被恢复。")
)
(princ)
)
(setq *OLDERR* *ERROR*
*ERROR**MYERR*
OS_OLD (getvar "OSMODE")
CMD_OLD(getvar "CMDECHO")
)
(setvar "CMDECHO" 0);_关闭命令提示
(Setq osmode_bak (getvar "osmode"));_记录捕捉
(Setvar "osmode" 0);_关闭捕捉
(if *Scale* (setq d (getreal (strcat"\n偏距<" (rtos *Scale* 2 2) ">:") ) )(setq d (getreal"\n偏
距:")))
(if (null d) (setq d *Scale*) (setq *Scale*d ))
(setq ss (ssget))
(repeat (setq i (sslength ss))
(vla-getboundingbox
(vlax-ename->vla-object (ssname ss (setq i (1- i))))
'll
'ur
)
(setq l1 (cons (vlax-safearray->list ll) l1)
l2 (cons (vlax-safearray->list ur) l2)
)
)
(mapcar 'set
(list 'll 'ur)
(mapcar '(lambda (a b) (apply 'mapcar (cons a b)))
'(min max)
(list l1 l2)
)
)
(command
"rectang"
(trans (polar ll (* pi 1.25) (setq d (sqrt (+ (* d d) (* d d)))))
0
1
)
(trans (polar ur (* pi 0.25) d) 0 1)
)
(command "CHPROP" "L" "" "LA" "_3" "");指定图层
(Setvar "osmode" osmode_bak);_还原捕捉
(setvar "CMDECHO" 1);_打开命令提示
(princ)
)
lm523242423
发表于 2019-12-15 20:02:34
要这抓外框再取整就完美了
999999
发表于 2020-8-6 01:19:35
支持支持,,,,