| 试试这个。你没有给我计算结果,所以你必须改变那部分。 
 
 (defun c:Test (/ #Ent #Value) (vl-load-com) (and (setq #Ent (entsel "\nSelect *line: ")) [color=Red]; select object[/color]      (vl-position (cdr (assoc 0 (entget (car #Ent)))) '("LWPOLYLINE" "LINE")) [color=Red]; verify object[/color] type      (setq #Value (* 0.5 (vla-get-length (vlax-ename->vla-object (car #Ent))))) [color=Red]; convert to vla-object, extract length and make calculations[/color]      (vl-cmdf "_.lengthen" "_total" #Value #Ent) [color=Red]; execute lengthen command on selected object[/color]      (princ (strcat "\nNew Length: " (vl-princ-to-string #Value))) [color=Red]; print results to command line[/color] ) ;_ and (princ)) ;_ defun
 |