Hello
I'm trying to extract he coordinates of the points that make a polylign but as a result I have an empty list.
Can somebody help please ? 🙂
(defun c:contour_voile ()
(setq contour_polyligne (car (entsel "Select a polylign please :")))
(setq defpolyligne (entget contour_polyligne))
(if (/= (cdr (assoc 8 defpolyligne)) "Polyligne_Concrete")
(prompt "\nYou havent selected a polylign")
);endif
(princ defpolyligne)
(foreach rec defpolyligne
(princ (cdr (= (car rec)10)))
);foreach
Here's the modified code
(defun c:contour_voile () (setq contour_polyligne (car (entsel "Select a polylign please :"))) (setq defpolyligne (entget contour_polyligne)) (if (/= (cdr (assoc 8 defpolyligne)) "Polyligne_Concrete") (prompt "\nYou havent selected a polylign") );endif ;(princ defpolyligne) (foreach rec defpolyligne (if ( = (car rec) 10) (princ (cdr rec)) ) );foreach );defun
@stelios16 wrote:
....
I'm trying to extract he coordinates of the points that make a polylign but as a result I have an empty list. ...
Welcome to the Forums!
Ajilal.Vijayan's suggestion should work if you want only to see the point coordinate lists on-screen. If you want them actually in a list as AutoLISP uses that term, there are ways to do that, such as:
(mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) defpolyligne))
which looks at each record in the entity data, and if its first number is not 10, omits it, then removes the 10's from the beginnings of what remains.