本帖最后由 qazxswk 于 2024-9-9 21:11 编辑
试试这个。- (defun c:11(/ pta ent minp maxp p1 p2 p3 p4)
- (setq pta (getpoint "\n封闭图形内指定点:"))
- (vl-cmdf "-BOUNDARY" pta "")
- (setq ent (entlast))
- (vla-getboundingbox (vlax-ename->vla-object ent) 'minp 'maxp)
- (setq p1 (vlax-safearray->list minp) p3 (vlax-safearray->list maxp))
- (entdel ent)
- (setq p2 (list (car p1) (cadr p3))) ;;矩形左上点
- (setq p4 (list (car p3) (cadr p1))) ;;矩形右下点
- (entmake (list'(0 . "LWPOLYLINE")'(62 . 1)'(100 . "AcDbEntity")'(100 . "AcDbPolyline")
- (cons 90 4)(cons 10 p1)(cons 10 p2)(cons 10 p3)(cons 10 p4)'(70 . 1)))
- (princ))
|