
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi There,
I am having trouble finding an AutoLISP routine that would get all the lines, plines, arcs within a specific layer, named "TOTAL_LENGTH". Some of the lines that belong to this layer are within a block. I have seen a routine that works perfectly from Jeff Mishler on this post
(defun c:len_by_lay (/ ent idx lay len lname ss tot)
(vl-load-com)
(while (setq lay (tblnext "layer" (not lay)))
(setq lname (cdr (assoc 2 lay)))
(if (and (/= lname "0"); skip ;ayer "0"
(not (vl-string-position (ascii "|") lname)); skip Xref layers
(setq ss (ssget "x" (list (cons 8 lname)(cons 0 "LINE,LWPOLYLINE"))))
)
(progn
(setq tot 0.0
idx -1)
(while (< (setq idx (1+ idx))(sslength ss))
(setq ent (ssname ss idx)
len (vlax-curve-getdistAtParam ent
(vlax-curve-getEndParam ent))
tot (+ tot len)
)
)
(princ (strcat "\nTotal length of lines/plines on layer " lname " is: "
(rtos tot)))
)
)
)
(princ)
)
However, I would like it to do a calculation of a single layer called "TOTAL_LENGTH" and include lines, plines, or arcs within all the blocks included in the drawing.
Please let me know, this would be a great help!
Solved! Go to Solution.