本帖最后由 jun353835273 于 2022-11-23 10:16 编辑
- ;llsheng_73哥的代码贴上来,方便搜索
- (defun isrectang(e / p1 p2 p3 p4)
- (and(=(vlax-curve-getendparam e)4)
- (vl-every(function(lambda(x y)(set x(vlax-curve-getpointatparam e y))))'(p1 p2 p3 p4)'(0 1 2 3))
- (equal(distance p1 p2)(distance p3 p4)1e-5)
- (equal(distance p1 p4)(distance p2 p3)1e-5)
- (equal(distance p1 p3)(distance p2 p4)1e-5))
- )
还有哦
;;判断矩形
(defun isrectang(e / p1 p2 p3 p4);;;(二维、三维、一般)多段线图元或图元对象或点表是否为矩形
(and(or(and(listp e)(listp(car p))(=(length e)4)(vl-every(function set)'(p1 p2 p3 p4)e))
(and(=(vlax-curve-getendparam e)4)
(vl-every(function(lambda(x y)(set x(vlax-curve-getpointatparam e y))))'(p1 p2 p3 p4)'(0 1 2 3))))
(equal(distance p1 p2)(distance p3 p4)1e-5)
(equal(distance p1 p4)(distance p2 p3)1e-5)
(equal(distance p1 p3)(distance p2 p4)1e-5))
)
|