Modificar el código LSP del área y longitud de medición CAD
(defun C:amset()
(setq height (getdist "\n Por favor ingrese el texto altura :"))
(PRINC))
(defun C:am (/ ss l i totalarea ename obj entarea)
(if (setq ss ( ssget ))
(progn
(vl-load-com)
(setq modelspace (vla-get-Modelspace (vla- get-activeDocument (vlax - get-acad-object))))
(setq l (sslength ss) i 0 área total 0 totlength 0)
(repetir l
(setq ename (ssname ss i))
(setq obj (vlax-ename-> vla-object ename))
;;(vlax-dump-object obj T) p >
(if (vlax-property-available-p obj "área"))
(setq totalarea (+ (vlax-get-property obj 'area) totalarea))
)
(if (= (cdr (assoc 0 (entget ename)))"MLINE")
(setq totlength (+ totlength (ml-length ename)) )
(setq totlength (+ totlength (vlax-curve-getdistatparam ename (vlax-curve-getendparam ename) )))
)
(setq i ( 1+ i))
)
(setq text1 (strcat "área es:" ( rtos (/ totalarea 1000000) 2 4) "metros cuadrados")
text2 (strcat "La longitud es:" ( rtos (/ totlength 1000) 2 4) "metro")
)
(if(setq insertpt (getpoint "Por favor ingrese texto Punto de inserción: "))
(if altura
(setq insertp1 (vlax-3d- point insertpt)
insertp2 (vlax-3d-point (polar insertpt (* 1.5 Pi) (* 1.5 altura)))
textobj1 (vla-addtext modelspace text1 insertp1 altura)
textobj2 (vla-addtext modelspace text2 insertp2 altura)
)
)
)
)
)
)
)
(defun ml-length (ename / j d ptlist)
(foreach n (entge
t ename)
(if (= (car n) 11)
(setq ptlist (cons (cdr n) ptlist))
)
)
)
.p>(lista de pts inversa)
(setq j 0 d 0)
(repetir (1- (longitud ptlist))
(setq d (+ d (distancia (nth j ptlist) (nth (1+ j) ptlist))))
( setq j (1+ j))
)
)
.