@digo5150 wrote:
.... I need to find the biggest and smalest poyline of a specific layer and write its length!
....
Would be a way, using LISP, to help me out with this?
....
Welcome to these Forums!
Here's one [minimally tested] way to find the shortest and longest Polylines on a specific Layer. It selects/highlights/grips both of them, and reports on their length at the Command line. Whatever you mean by "write" its length [write out to a file of some kind, draw as Text in the drawing, etc.] can use the same (rtos (getlen....)) function [which reports in current Units settings -- add mode and precision arguments if you want a different format]. The whole thing could be defined into a command, or incorporated as a sub-routine in something larger, or whatever else you want to do with it [or parts of it].
(defun getlen (ent) (vla-get-length (vlax-ename->vla-object ent)))
(foreach pl (mapcar 'cadr (ssnamex (ssget "_X" '((0 . "LWPOLYLINE") (8 . "YourSpecificLayer")))))
(cond
((not shortest) (setq shortest pl longest pl))
((< (getlen pl) (getlen shortest)) (setq shortest pl))
((> (getlen pl) (getlen longest)) (setq longest pl))
); cond
); foreach
(setq extremes (ssadd shortest) extremes (ssadd longest extremes))
(sssetfirst nil extremes)
(prompt
(strcat
"\nShortest Polyline is " (rtos (getlen shortest)) " long;"
"\nLongest Polyline is " (rtos (getlen longest)) " long."
); strcat
); prompt
Kent Cooper, AIA