Ish 5 Posted July 4, 2019 (defun c:POV (/ foo ss) ;; Points On Vertices (create points on vertices of selected Arcs, Lines, *Polylines, Splines) ;; Alan J. Thompson, 09.09.10 / 09.22.10 ;; Modified by Tharwat - Date: 18.May.16 (defun foo (p) (if (vl-consp p) (or (vl-member-if (function (lambda (a) (equal (list (car a) (cadr a)) (list (car p) (cadr p))))) plst ) (setq plst (cons (cdr (assoc 10 (entmake (list '(0 . "POINT") (cons 10 p))) ) ) pLst ) ) ) ) ) (if (setq ss (ssget '((0 . "ARC,LINE,*POLYLINE,SPLINE")))) ((lambda (i / e eLst p pLst) (while (setq e (ssname ss (setq i (1+ i)))) (cond ((vl-position (cdr (assoc 0 (setq eLst (entget e)))) '("ARC" "LINE" "SPLINE")) (mapcar (function foo) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))) ) ((vl-position (cdr (assoc 0 eLst)) '("LWPOLYLINE" "POLYLINE")) (repeat (setq p (1+ (fix (vlax-curve-getEndParam e)))) (foo (vlax-curve-getPointAtParam e (setq p (1- p)))) ) ) ) ) ) -1 ) ) (princ) ) in that can u add circle object also, good program, i need as well as point at circle center. thanks Quote Share this post Link to post Share on other sites
Ish 5 Posted July 4, 2019 plz add circle object also in pov.lsp program, need point at circle center also. Quote Share this post Link to post Share on other sites
Tharwat 162 Posted July 4, 2019 1 hour ago, Ish said: plz add circle object also in pov.lsp program, need point at circle center also. Like this? (defun c:POV (/ foo ss) ;; Points On Vertices (create points on vertices of selected Arcs, Lines, *Polylines, Splines) ;; Alan J. Thompson, 09.09.10 / 09.22.10 ;; Modified by Tharwat - Date: 04.Jul.19 (defun foo (p) (if (vl-consp p) (or (vl-member-if (function (lambda (a) (equal (list (car a) (cadr a)) (list (car p) (cadr p))))) plst) (setq plst (cons (cdr (assoc 10 (entmake (list '(0 . "POINT") (cons 10 p))))) pLst)))) ) (if (setq ss (ssget '((0 . "ARC,LINE,*POLYLINE,SPLINE,CIRCLE")))) ((lambda (i / e eLst p pLst) (while (setq e (ssname ss (setq i (1+ i)))) (cond ((vl-position (cdr (assoc 0 (setq eLst (entget e)))) '("ARC" "LINE" "SPLINE")) (mapcar (function foo) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))) ) ((vl-position (cdr (assoc 0 eLst)) '("LWPOLYLINE" "POLYLINE")) (repeat (setq p (1+ (fix (vlax-curve-getEndParam e)))) (foo (vlax-curve-getPointAtParam e (setq p (1- p)))) ) ) (t (mapcar (function foo) (list (cdr (assoc 10 (entget e))))) ) ) ) ) -1 ) ) (princ) ) 1 Quote Share this post Link to post Share on other sites
Ish 5 Posted July 4, 2019 Yes sir Perfectly working , just add a small code for to create layer, all points must be come in layer. Thanks Quote Share this post Link to post Share on other sites
Tharwat 162 Posted July 4, 2019 53 minutes ago, Tharwat said: (setq plst (cons (cdr (assoc 10 (entmake (list '(0 . "POINT") (cons 8 "YourLayerNameHere") (cons 10 p))))) pLst)))) 3 minutes ago, Ish said: Yes sir Perfectly working , just add a small code for to create layer, all points must be come in layer. Thanks Add Your layer name as indicated above. 1 Quote Share this post Link to post Share on other sites
Ish 5 Posted July 4, 2019 where i must copy paste that code ? from above which line? Quote Share this post Link to post Share on other sites
Tharwat 162 Posted July 4, 2019 What's your desired layer name ? Quote Share this post Link to post Share on other sites
Ish 5 Posted July 4, 2019 for points must be points. My Desire Layer Name is Points. Quote Share this post Link to post Share on other sites
Tharwat 162 Posted July 4, 2019 3 minutes ago, Ish said: for points must be points. My Desire Layer Name is Points. (defun c:POV (/ foo ss) ;; Points On Vertices (create points on vertices of selected Arcs, Lines, *Polylines, Splines) ;; Alan J. Thompson, 09.09.10 / 09.22.10 ;; Modified by Tharwat - Date: 04.Jul.19 (defun foo (p) (if (vl-consp p) (or (vl-member-if (function (lambda (a) (equal (list (car a) (cadr a)) (list (car p) (cadr p))))) plst) (setq plst (cons (cdr (assoc 10 (entmake (list '(0 . "POINT") '(8 . "Points") (cons 10 p))))) pLst)))) ) (if (setq ss (ssget '((0 . "ARC,LINE,*POLYLINE,SPLINE,CIRCLE")))) ((lambda (i / e eLst p pLst) (while (setq e (ssname ss (setq i (1+ i)))) (cond ((vl-position (cdr (assoc 0 (setq eLst (entget e)))) '("ARC" "LINE" "SPLINE")) (mapcar (function foo) (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))) ) ((vl-position (cdr (assoc 0 eLst)) '("LWPOLYLINE" "POLYLINE")) (repeat (setq p (1+ (fix (vlax-curve-getEndParam e)))) (foo (vlax-curve-getPointAtParam e (setq p (1- p)))) ) ) (t (mapcar (function foo) (list (cdr (assoc 10 eLst)))) ) ) ) ) -1 ) ) (princ) ) 1 Quote Share this post Link to post Share on other sites
Tharwat 162 Posted July 4, 2019 You're welcome anytime. 1 Quote Share this post Link to post Share on other sites
Ish 5 Posted July 9, 2019 On 7/4/2019 at 6:02 PM, Tharwat said: You're welcome anytime. Quote Share this post Link to post Share on other sites
LeandroCS 0 Posted December 18, 2019 Please. Could someone add the vertex number (1,2,3 ... n) and the prefix V- to the circle? V-1, V-2, V-3, V-N ... Quote Share this post Link to post Share on other sites
carolopez 0 Posted January 31, 2020 On 20/09/2010 at 08:38, fixo said: See if that helps (defun C:PCIRC (/ coords ent rad) (setq rad (getreal"\nEnter radius: ")) (while (setq ent (entsel "\nSelect polyline (or press Enter to Exit) >> ")) (setq ent (car ent)) (setq coords (vl-remove-if 'not (mapcar (function (lambda(p) (if (= 10 (car p))(cdr p)))) (entget ent)))) (foreach pt coords (command "_circle" "_non" pt rad) ) ) (princ) ) Can anyone tell me how to see the circles on every vertix? I have uploaded the LISP successfully but I cant see any changes on the polylines that I have drawn.. Quote Share this post Link to post Share on other sites
k88 1 Posted January 6 (edited) On 9/20/2010 at 9:38 AM, fixo said: See if that helps (defun C:PCIRC (/ coords ent rad) (setq rad (getreal"\nEnter radius: ")) (while (setq ent (entsel "\nSelect polyline (or press Enter to Exit) >> ")) (setq ent (car ent)) (setq coords (vl-remove-if 'not (mapcar (function (lambda(p) (if (= 10 (car p))(cdr p)))) (entget ent)))) (foreach pt coords (command "_circle" "_non" pt rad) ) ) (princ) ) I'm learning autolisp and I don't understand some fragments. Can someone explain why there is used loop while (after entering radius) and the fragment with "vl-remove-if 'not" and "lambda"? Why in loop if there is "=10"? I will be very grateful for help. Edited January 6 by k88 Quote Share this post Link to post Share on other sites
pkenewell 33 Posted January 6 (edited) The (while) loop just allows you to continue selecting polylines until you hit enter and entsel returns NIL. (while (setq en (entsel "\nSelect an Entity: ")) ;; Do soemthing for each selected entity... ) ;; End while when en variable is NIL (user pressed enter instead of selecting another entity). The (vl-remove-if 'not) function is used to filter out the NIL values after (mapcar) is used to get the DXF code 10 (the vertices) from all the other entity codes returned by the (entget) function. The (mapcar) statement returns nils for anything that is not DXF code 10 and stacks them into the list. Here is an example to show you how this works: Command: (setq el (entget (car (entsel)))) Select object: ((-1 . <Entity name: 2015a32b6d0>) (0 . "LWPOLYLINE") (330 . <Entity name: 2014eac42d0>) (5 . "1D15") (100 . "AcDbEntity") (67 . 1) (410 . "Sheet1") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . 0.0) (10 3.91426 4.38087) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 5.66079 6.03297) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 8.18059 4.83386) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 10.5804 6.29943) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0)) Command: (setq elx (mapcar '(lambda (x) (if (= 10 (car x))(cdr x))) el)) (nil nil nil nil nil nil nil nil nil nil nil nil nil nil (3.91426 4.38087) nil nil nil nil (5.66079 6.03297) nil nil nil nil (8.18059 4.83386) nil nil nil nil (10.5804 6.29943) nil nil nil nil nil) Command: (vl-remove-if 'not elx) ((3.91426 4.38087) (5.66079 6.03297) (8.18059 4.83386) (10.5804 6.29943)) EDITED: To better explain Edited January 6 by pkenewell 1 Quote Share this post Link to post Share on other sites
pkenewell 33 Posted January 6 @k88 Updated my above post to explain a little better. 1 Quote Share this post Link to post Share on other sites
BIGAL 503 Posted January 6 Here is another example of using DXF code 10 for a pline. I use this a lot. (setq plent (entsel "\nPick pline")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) The vertice points are in the list co-ord. You can use the VL function also (setq co-ord (vlax-safearray->list (vlax-variant-value (vla-get-coordinates (car plent))))) 1 1 Quote Share this post Link to post Share on other sites
k88 1 Posted January 12 @pkenewell, @BIGAL , thank you, it helped me a lot! 1 Quote Share this post Link to post Share on other sites
ronjonp 224 Posted January 13 On 1/6/2021 at 4:46 PM, BIGAL said: Here is another example of using DXF code 10 for a pline. I use this a lot. (setq plent (entsel "\nPick pline")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) The vertice points are in the list co-ord. You can use the VL function also (setq co-ord (vlax-safearray->list (vlax-variant-value (vla-get-coordinates (car plent))))) @BIGAL It's worthwhile to note that these two options don't return the same results. Also you need to convert '(car plent) to a vla-object when using vla-get-coordinates. Quote Share this post Link to post Share on other sites