View Full Version : LISP to get total length including ARC, Pline & lines?
windowsxp5
2005-01-03, 03:17 PM
Hi frnds..
i have a lisp file that can LIST the the total length of lines.(only lines; it dosent support pline,arc etc.)
anyone using (or can create) a lisp to get total lenght including ARC, Pline & lines?
i can attach the lisp file i have(linesum.lsp)
Mike.Perry
2005-01-03, 03:33 PM
Hi
Have you tried the Forum search facility -
Search Forums (http://forums.augi.com/search.php?)
A quick search returned the following (hopefully will get you going in the right direction) -
Total polyline length (http://forums.augi.com/showthread.php?t=8351)
Multiple Pline Calculation (http://forums.augi.com/showthread.php?t=10419)
Does a sum or total length feature exist? (http://forums.augi.com/showthread.php?t=11113)
Have a good one, Mike
stig.madsen
2005-01-03, 03:57 PM
Otherwise, here's a simple start if you want to write your own:
(defun C:SUMIT (/ ent dist endPar obj otype sum)
(setvar "ERRNO" 0)
(setq sum 0.0)
(while (and (not (vl-catch-all-error-p
(setq ent (vl-catch-all-apply 'entsel))))
(/= (getvar "ERRNO") 52))
(setq obj (vlax-ename->vla-object (car ent)))
(cond ((not (vl-catch-all-error-p
(setq endPar (vl-catch-all-apply 'vlax-curve-getEndParam (list obj)))))
(setq dist (vlax-curve-getDistAtParam obj endPar)
sum (+ sum dist)
otype (vla-get-objectName obj)
)
(mapcar 'princ (list "\nAdding " otype ": " dist)))
(T (princ "\nObject has no length definition"))
)
)
(princ "\nTotal length: ")(princ sum)
(princ)
)
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.