TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Dave20165 on May 18, 2006, 02:22:24 PM
-
Has anyone heard of/written a lisp that will put a block at each grip on a polyline? I have to put a 3' circle at each grip along a polyline(probably 2,000 grips)for a wetlands plat I am working on. Thanks for any help.
-
Here is a quickie.
(defun c:circlepline (/ ent vlst pt)
(and
(setq ent (entsel "\nSelect pline to add circles."))
(setq vlst (mapcar 'cdr (vl-remove-if-not
'(lambda (x) (= 10 (car x))) (entget (car ent)))))
(foreach pt vlst
(entmake (list '(0 . "CIRCLE")
(cons 8 "0")
(cons 10 pt) ; center pt
'(40 . 18.0) ; 18 units radius
))
)
)
(princ)
)
-
OK, here is one that you can select more than one pline at a time.
(defun c:circlepline (/ ss ename i vlst pt)
(prompt "\nSelect plines to add circles.")
(and
(setq ss (ssget '((0 . "*POLY*"))))
(setq i -1)
(while (setq ename (ssname ss (setq i (1+ i))))
(setq vlst (mapcar 'cdr
(vl-remove-if-not '(lambda (x) (= 10 (car x))) (entget ename))))
(mapcar '(lambda (pt)
(entmake (list '(0 . "CIRCLE")
(cons 8 "0")
(cons 10 pt) ; center pt
'(40 . 18.0) ; 18 units radius
)))
vlst
)
)
)
(princ)
)
-
I think you lost the OP Alan. Jeff provided an answer that seems to be working for the OP on the augi site. I like your codes though. :lol:
-
Thanks, I see I'm an hour or so late. :-)
-
'course had I known he posted it in here as well as augi my response would've been here instead of there......funny thing is, I always look here for new posts before there, so why didn't I see this thread?
Alan, never too late to post good code :-) It lets everyone know that 99 times out of 100 there's more than one (or even 2 or 3) way to accomplish the same thing.
-
Well thank you sir.
How about one in MP style. :-)
(defun c:circlepline3 (/ ss)
(prompt "\nSelect plines to add circles.")
(and
(setq ss (ssget '((0 . "*POLY*"))))
(mapcar
'(lambda (ename)
(mapcar '(lambda (pt)
(entmake
(list
'(0 . "CIRCLE")
(cons 8 "0")
(cons 10 pt)
'(40 . 18.0)
)
)
)
(mapcar
'cdr
(vl-remove-if-not
'(lambda (x)
(= 10 (car x))
)
(entget ename)
)
)
)
)
(vl-remove-if 'listp
(mapcar
(function cadr)
(ssnamex ss)
)
)
)
)
(princ)
)