- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello!
I thought about writing a LISP that should add the lenght of all found polylines in a drawing. This sounds quite easy, and probably a lot of you guys who have done this before, but I have yet to find a routine that includes 3D polylines with a variable Z-value a long the line.
So, I began writing my own routine, but I got stuck quite early...
What I'm thinking is kind of like this:
1) User gets to choose wether he/she wants to select all 3D polylines, all 2D polylines or all polylines.
2) If the user chooses all 3D polylines, these lines will be selected, their lengths added together and a total presented to the user. Same with the other two options.
So I began like this:
(Defun C:LPA (/ tall 3dlines)
(prompt "\ Find the lenght of: 1 = All 3D pl, 2 = All 2D pl, 3 = All pl or ESC)
(setq tall (getstring "\ 1, 2, 3 or ESC"))
(if (= tall "1")
(progn
(setq 3dlines (sssetfirst nil (ssget "_X" '((0 . "POLYLINE")(-4 . "&")(70 . 8)))))
(setq totalnumber3d (sslength 3dlines))
;__ So, so far I can select all 3D pl found in the drawing. Next up I wanted to get their lengths by using (command "_lengthen") for all the selected 3D polylines, extract their lengths and add them to each other in a list. And it is here where I could need some help s'il vous plaît. I suspect that it is done with a loop, maybe a foreach? Or is it better to get the lenghts by using vla-get-length somehow?
Thanks in advance.
/ts
Solved! Go to Solution.