- 积分
- 11379
- 明经币
- 个
- 注册时间
- 2011-10-13
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
;功能:返回选择集包围盒
;来自明经网友
;返回值:选择集所有实体做为整体的包围盒
(defun GetSSBoundingbox (ss / i ssn ll rr box ptlist ssbox)
(if ss
(progn
(setq i -1)
(repeat (sslength ss)
(setq ssn (ssname ss (setq i (1+ i))))
(vla-GetBoundingBox (vlax-ename->vla-object ssn) 'll 'rr) ;得到对象的包围盒
(setq box (list (vlax-safearray->list ll) (vlax-safearray->list rr)))
(setq ptlist (append box ptlist))
)
(setq ssbox (mapcar '(lambda (x) (apply 'mapcar (cons x ptlist))) (list 'min 'max)))
)
)
)
(defun c:asd(/ pt1 pt2 pt3 pt4)
(VL-LOAD-COM)
(princ "\n 请选择正视图")
(setq ssbox (GetSSBoundingbox (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,LWPOLYLINE,PLWPOLYLINE"))))))
(setq pt1 (car ssbox)
pt3 (cadr ssbox)
pt2 (list (car pt3) (cadr pt1) 0)
pt4 (list (car pt1) (cadr pt3) 0)
)
(setq distl (distance pt1 pt2))
(setq distk (distance pt1 pt4))
(princ "\n 请选择投影视图")
(setq ssboxt (GetSSBoundingbox (setq ss (ssget '((0 . "LINE,ARC,CIRCLE,LWPOLYLINE,PLWPOLYLINE"))))))
(setq ptt1 (car ssboxt)
ptt3 (cadr ssboxt)
ptt2 (list (car ptt3) (cadr ptt1) 0)
ptt4 (list (car ptt1) (cadr ptt3) 0)
)
(setq distl2 (distance ptt1 ptt2))
(setq distk2 (distance ptt1 ptt4))
(if (= distl distl2)
(setq disth distk2)
)
(if (= distl distk2)
(setq disth distl2)
)
(if (= distk distk2)
(setq disth distl2)
)
(if (= distk distl2)
(setq disth distk2)
)
(princ "\nL =")
(PRINC distl)
(princ "\nk =" )
(PRINC distk)
(princ "\nh =" )
(PRINC disth)
)
情况1
情况2
如何得到DISTH
我不知道怎么判断
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|