Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Selection set
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Selection set (Read 1156 times)
0 Members and 1 Guest are viewing this topic.
Biscuits
Swamp Rat
Posts: 502
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.
Logged
ronjonp
Needs a day job
Posts: 7531
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".
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
PKENEWELL
Bull Frog
Posts: 320
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)
Logged
"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
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Selection set