José Francisco Posted December 17, 2020 Posted December 17, 2020 Hi. I need a lisp routine that deletes all the elements that are inside a circle. I need to select many circles at the same time. Please, can you help me? Quote
ronjonp Posted December 18, 2020 Posted December 18, 2020 Give this a try ... welcome to CadTutor! (defun c:foo (/ _c2p _l a p r s) ;; RJP » 2020-12-18 ;; Deletes items found within a selection of circles (defun _c2p (p r n / a i z) (setq a 0) (setq i (/ (* pi 2) n)) (repeat n (setq z (cons (polar p (setq a (+ a i)) r) z))) ) (defun _l (s) (if s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) ) ) (cond ((setq s (_l (ssget '((0 . "CIRCLE"))))) (setq a (vlax-get-acad-object)) (foreach e s (setq p (cdr (assoc 10 (entget e)))) (setq r (cdr (assoc 40 (entget e)))) (vlax-invoke a 'zoomcenter p (* r 2)) (foreach b (_l (ssget "_WP" (_c2p p r 100))) (entdel b)) ) ) ) (progn) ) (vl-load-com) Quote
BIGAL Posted December 18, 2020 Posted December 18, 2020 An alternative to _c2p I use is polygon "I" so matches circle probably don't need 100 sides the bigger the number the more accurate as you suggest. Then use polygon Briscad is different than Acad (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (entlast))))) (command "erase" "WP" co-ord "" (entlast) "") Quote
ronjonp Posted December 21, 2020 Posted December 21, 2020 On 12/18/2020 at 2:41 PM, BIGAL said: An alternative to _c2p I use is polygon "I" so matches circle probably don't need 100 sides the bigger the number the more accurate as you suggest. Then use polygon Briscad is different than Acad (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (entlast))))) (command "erase" "WP" co-ord "" (entlast) "") @BIGAL Why would you use a temp object when these points can be created with easy math? Quote
BIGAL Posted December 21, 2020 Posted December 21, 2020 You are correct, its the algorithm I use a lot as a library solution for say ssget "F" for a circle filter. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.