Lee的lisp需要大量重写,因为对象非常不同,代码支持两个方面:对象的长度和找到中点的能力,这两个方面都没有内置到多线中,因此重新开始更容易。
; this is the guts not a complete code to see how to get the answers.; For me just create a new pline then use parts of Lee's code as the field "length" is not supported.(setq obj (vlax-ename->vla-object (car (entsel "\nPick mline"))))(setq co-ords (vlax-get obj 'coordinates)); eg (8696.29 1287.81 0.0 12479.4 1242.65 0.0 12765.7 3184.44 0.0) xyz 2 lines(setq numb (/ (length co-ords) 3))(setq I 0)(command "_pline")(while (= (getvar "cmdactive") 1 )(repeat numb(setq xy (list (nth I co-ords)(nth (+ I 1) co-ords) ))(setq I (+ I 3))) ; end repeat) ; while(setq ent (vlax-ename->vla-object (entlast)))(setq len (vla-get-length ent))(setq par (vlax-curve-getparamatdist ent (/ (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) 2.0)))(setq ins (vlax-curve-getpointatparam obj2 par))(alert (strcat "length is " (rtos len 2 2) ); add text part now as per Lee's code(vla-delete ent) ; no longer need new pline