周长统计
(defun vxs (e / i v lst)(setq i 0)
(while
(setq v (vlax-curve-getpointatparam e (setq i (1+ i))))
(setq lst (cons v lst))
)
(reverse lst))
;;;;;;;;;;;;;;;
(defun zhouchang ( en / dd )
(setvar "cmdecho" 0)
;(setq en (car (entsel "\n选取计算长度的曲线...")))
(command "lengthen" en "")
(setq dd (getvar "perimeter"))
dd
)
(defun c:tt11 ( / lst ent pts pt demj zmj ) ;标记三角网表面积
(setq lst (ssget '( (0 . "lwpolyline") (8 . "0")) ) )
(setq i 0)
(setq zmj 0.000)
(while(< i (sslength lst))
(setq ent (ssname lst i))
(setq pts (vxs ent))
(setq len (length pts))
(setq pt (mapcar
'(lambda(x)
(/ x len)
)
(apply
'mapcar
(cons '+ pts)
)
)
)
(setq AcadObject (vlax-get-acad-object)
AcadDocument (vla-get-ActiveDocument Acadobject)
mSpace (vla-get-ModelSpace Acaddocument)) ;初始化系统
(setq demj (zhouchang ent))
(entmake (list (cons 0"TEXT") (cons 1 (rtos demj 2 3)) (cons 10 pt)
(cons 40 0.5)
(cons 8 "周长")
))
(setq zmj(+ zmj demj))
(setq i (+ i 1))
)
(entmake (list (cons 0"TEXT") (cons 1 (rtos zmj 2 3)) (cons 10 (getpoint "\请输入总周长插入点"))
(cons 40 3)
(cons 8 "周长")
))
(print zmj)
(princ)
) 支持源码! 本帖最后由 tang87 于 2016-10-15 18:56 编辑
支持源码 ,但这个只对rec有用,对别的就没用了。 谢谢分享,支持
页:
[1]