@Kent1Cooper wrote:
@manasi4532 wrote:
Is there a way to delete specific objects that have circles attached to them? ....
... I would do it by selecting the Lines [and ... other kinds of things -- Arcs, open-ended Polylines, etc.], not the Circles. An (ssget) function using a little crossing window built around each end ... would get around the ones that don't quite touch [you would need to decide on a fuzz distance]. ....
For example, this worked in your sample drawing, including when I replaced a few of the connecting Lines with Arcs or open-ended Polylines/Splines/Ellipses. I used a diagonal fuzz distance [for looking for Circles at open ends] of 0.1 units, which seemed appropriate for your drawing, but you can edit that.
(vl-load-com)
(defun C:DOEC ; = Delte Objects Ending at Circles [and the Circles]
(/ getcirc ss delss n ent)
(defun getcirc (pt)
(ssget "_c" (polar pt (* pi 1.25) 0.1) (polar pt (/ pi 4) 0.1) '((0 . "CIRCLE")))
;; EDIT the 0.1 for crossing-window diagonal fuzz distance
); defun
(if
(setq ss
(ssget "_:L" ; on unlocked Layer(s) only
(list
'(-4 . "<OR")
'(0 . "LINE,ARC"); any [always open-ended]
'(-4 . "<AND"); Pline or Spline not closed
'(0 . "LWPOLYLINE,SPLINE") '(-4 . "<NOT") '(-4 . "&") '(70 . 1) '(-4 . "NOT>")
'(-4 . "AND>")
'(-4 . "<AND"); Ellipse not closed
'(0 . "ELLIPSE")
'(-4 . "<NOT") '(-4 . "<AND") '(41 . 0.0) (cons 42 (* pi 2)) '(-4 . "AND>") '(-4 . "NOT>")
'(-4 . "AND>")
'(-4 . "OR>")
); list
); ssget
); setq
(progn ; then
(setq delss (ssadd)); initially empty
(repeat (setq n (sslength ss)) ; then
(setq ent (ssname ss (setq n (1- n))))
(foreach end (list (vlax-curve-getStartPoint ent) (vlax-curve-getEndPoint ent))
(if (setq ss2 (getcirc end))
(progn (ssadd ent delss) (ssadd (ssname ss2 0) delss))
); if
); foreach
); repeat
(if (> (sslength delss) 0)
(command "_.erase" delss ""); then
(prompt "\nNo Circle(s) found at ends of selected object(s)."); else
); if
); progn
(prompt "\nNo open-ended object(s) selected."); else
); if
(prin1)
)
Kent Cooper, AIA