你几乎做到了。。。
- (defun c:LPL ( / e ss l i OBJ P1 P2 )
- (if (setq ss (ssget '((0 . "LINE,SPLINE,LWPOLYLINE,POLYLINE,ARC,CIRCLE,ELLIPSE"))))
- (repeat (setq i (sslength ss))
- (setq e (ssname ss (setq i (1- i)))
- l (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))
- )
- (setq OBJ (vlax-ename->vla-object e))
- (vla-getboundingbox OBJ 'P1 'P2)
- (setq P1 (vlax-safearray->list P1))
- (entmake
- (list
- '(0 . "TEXT")
- '(100 . "AcDbText")
- (cons 10 [b][color=red](mapcar '+ P1 (list 0.0 (- (/ 10.0 (getvar 'cannoscalevalue))) 0.0))[/color][/b])
- (cons 40 (/ 5.0 (getvar 'cannoscalevalue)))
- (cons 1 [b][color=red](strcat "L=" (rtos l))[/color][/b])
- )
- )
- (princ (strcat "\nTotal length = " (rtos l)))
- )
- )
- (princ)
- )
HTH。,M、 R。 |