Author Topic: Selection set  (Read 300 times)

0 Members and 1 Guest are viewing this topic.

Biscuits

• Bull Frog
• Posts: 425
Selection set
« on: July 12, 2017, 09:01:06 am »
How would I go about creating a selection set that would include a circle (if it exists) and anything inside it and return the diameter as a variable to be used later in a routine? This has me stumped.
Thanks for any ideas.

ronjonp

• Needs a day job
• Posts: 6403
Re: Selection set
« Reply #1 on: July 12, 2017, 09:10:52 am »
First thing that comes to mind is pick the circle, trace it with points then use ssget "WP".

Windows 10 x64 - AutoCAD /C3D 2018

Custom Build PC

PKENEWELL

• Newt
• Posts: 159
Re: Selection set
« Reply #2 on: July 26, 2017, 03:19:08 pm »
Here's and oldie from my CAD library. Change the line with (setq ss (ssget "CP" ptlst)) to "WP" to select all inside only. You can also increase or decrease the accuracy by changing the value of the "inc" variable.
Code - Auto/Visual Lisp: [Select]
`;; ----- (pjk-ssget-cir [Entity Name]) ----------------;; This function selects all the objects within or crossing a;; circle with the [Entity Name] given. Returns the resulting;; selection set.(defun pjk-ssget-cir (enam / cnt cen elst ful inc pt ptlst rad ss)	(if enam		(progn			(setq elst (entget enam) ptlst nil				cen (trans (cdr (assoc 10 elst)) enam 0)				rad (cdr (assoc 40 elst))                                inc 1.0                                ful (/ 360.0 inc)				cnt 0.0			)			;; Created a Point list for 360 points on curcumference of			;; the circle to use with "Crossing Polygon" selection.			(while (< cnt ful)				(setq pt (polar cen (pjk-dtr cnt) rad)					ptlst (cons pt ptlst)					cnt (+ inc cnt)				)			)			(reverse ptlst)			;; Delete the circle.			(entdel enam)			;; Select by Crossing polygon.			(setq ss (ssget "CP" ptlst))			;; Undelete the Circle.			(entdel enam)			ss		)		nil	)) ;; End Function (pjk-ssget-cir) `
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt