本帖最后由 cq4920 于 2020-5-19 00:57 编辑
这就是个简单是思路!
- (setq ss (ssget))
- (mc:wk ss);获得选择集外框
- (setq ent (entlast))
- (vl-load-com)
- (vla-getboundingbox (vlax-ename->vla-object ent) 'minpoint 'maxpoint)
- (setq pmax (vlax-safearray->list maxpoint)
- pmin (vlax-safearray->list minpoint))
- (setq p2 (list (car pmax) (cadr pmin)))
- (setq p4 (list (car pmin) (cadr pmax)))
- (setq h1 (distance pmin p4))
- (setq w1 (distance pmin p2))
- (setq ent2(entsel))
- (vla-getboundingbox (vlax-ename->vla-object ent2) 'minpoint 'maxpoint)
- (setq pmax2 (vlax-safearray->list maxpoint)
- pmin2 (vlax-safearray->list minpoint))
- (setq p2b (list (car pmax) (cadr pmin)))
- (setq p4b (list (car pmin) (cadr pmax)))
- (setq h2 (distance pmin2 p4b))
- (setq w2 (distance pmin2 p2b))
- (setq bl1 (/ h2 h1))
- (setq bl2 (/ w2 w1))
- (if (< bl1 bl2)
- (progn
-
-
-
- )
-
- (progn
-
-
-
- )
-
-
-
-
-
- )
|