Message 1 of 17
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello how are you.
I wanted to check, if there is any lambda function, to draw lines from a list of points.
I normally do a loop with car and dcr, but I want to know if there is something more direct. And the only thing that occurred to me was with the lambda function, but I didn't know how to do it.
This is what I am using.
(setq lst-pts '((-2495.52 -924.94 0.0)
(-2397.64 -924.672 0.0)
(-2297.97 -889.794 0.0)
(-2200.08 -810.342 0.0)
(-2108.74 -776.927 0.0)
(-1997.02 -818.492 0.0)))
(defun draw-line (p1 p2)
(entmake
(list '(0 . "LINE")
'(100 . "AcDbLine")
(cons 10 p1)
(cons 11 p2))))
I was trying something like that.
Modifying the draw-line function to pass the list of points directly to it.
And creating another function to apply it, but it didn't work for me.
(defun d-line (lst)
(foreach pt lst
(ent-linea pt)))
(defun draw-line (lst-pts)
(entmake
(list '(0 . "LINE")
'(100 . "AcDbLine")
(cons 10 (nth 0 lst-pts))
(cons 11 (nth 1 lst-pts)))))
As far as you can help me, I thank you.
Thank you.
AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)
Solved! Go to Solution.