本帖最后由 wowan1314 于 2013-8-1 19:19 编辑
500w008 发表于 2013-8-1 19:06
多边形 最多 6多边吧 其实可以忽略掉短边 老大
我简单的写个。 你参考的自己调整下。- (defun c:t11 (/ ss lst p1 p2 p3)
- (setq en (vlax-ename->vla-object(car(entsel "\n选择多边形:")))
- pt(getpoint "\n指定曲线内一点:")
- )
- (if (and en pt)
- (progn
- (setq p1 (vlax-curve-getclosestpointto en pt))
- (command "LINE" p1 pt "")
- (setq x1 (vlax-ename->vla-object(setq xx (entlast))))
- (setq p2 (vlax-invoke en 'intersectwith x1 acextendotherentity))
- (setq p1 (list (car p2) (cadr p2)(caddr p2)) p2 (cdddr p2))
- (command "rotate" xx "" pt "90")
- (setq p3 (vlax-invoke en 'intersectwith x1 acextendotherentity))
- (setq p4 (list (car p3) (cadr p3)(caddr p3)) p3 (cdddr p3))
- (command "LINE" p1 p2 "")
- (command "LINE" p3 p4 "")
- (command "ERASE" xx "")
- (list(distance p1 p2)(distance p3 p4));返回两距离
- )
- )
- )
|