PDA

View Full Version : Any way to select an entity knowing it's beginning and end locations?



Hudson
22nd Oct 2009, 09:00 pm
Does anyone know that I can automatically select an entity if I already know the beginning and ending coordinates?

My understanding was that each time the a drawing is loaded it will/can have a different id??

Thanks,

Andrew

alanjt
22nd Oct 2009, 09:14 pm
Does anyone know that I can automatically select an entity if I already know the beginning and ending coordinates?

My understanding was that each time the a drawing is loaded it will/can have a different id??

Thanks,

Andrew
(nentselp POINT)
or
(ssget "WP" POINTLIST)
or
(ssget "F" POINTLIST)

Hudson
22nd Oct 2009, 09:33 pm
(nentselp POINT)
or
(ssget "WP" POINTLIST)
or
(ssget "F" POINTLIST)

Sean thanks... that's getting me really close.

I suppose I can filter out objects selected by accident by that method.. which is probably pretty likely.

alanjt
22nd Oct 2009, 11:28 pm
Sean thanks... that's getting me really close.

I suppose I can filter out objects selected by accident by that method.. which is probably pretty likely.

Just use regular ssget filtering.
Who's Sean?

Hudson
26th Oct 2009, 08:53 pm
Just use regular ssget filtering.
Who's Sean?

I was replying quickly and looked at your sig and got confused ;)

alanjt
26th Oct 2009, 09:08 pm
I was replying quickly and looked at your sig and got confused ;)
:)

Did you get it sorted out?

Hudson
2nd Nov 2009, 11:39 pm
Yes, I finally did.. I just started mucking with it today.. the only way I could get it to select the arc was to take the begin and end coords swap the x values and use a fence (so the fence would cross the arc).

But that worked nicely.. first time I've worked with selection sets... fun ;)

CarlB
3rd Nov 2009, 12:05 am
I just noticed in your original post:

"My understanding was that each time the a drawing is loaded it will/can have a different id??"

The object should always maintain the same "handle", you should be able to use that from session to session to identify/locate an object.

Hudson
3rd Nov 2009, 12:54 am
I just noticed in your original post:

"My understanding was that each time the a drawing is loaded it will/can have a different id??"

The object should always maintain the same "handle", you should be able to use that from session to session to identify/locate an object.

That would simplify life..

Right now I have several files that record information that I need from instance to instance.. having the handle for an object and then calculating points from there would likely be less mess..

CarlB
3rd Nov 2009, 01:01 am
You get the handle name from Group Code 5 of the entity data.

Then knowing the handle, you get the entity name from:
(handent handle)

Hudson
10th Nov 2009, 06:13 pm
Ok.. another quick (hopefully) question..

I got finding arcs down pat! But now I'm trying to select the line between 2 points (and only that line).. and I'm not having any luck... i figured the Fence would work.. I've since tried W WP..

Could I do what I'm doing for the arc (get begin and end point, swap either the x or y value of each pt so it's opposite) and then get the line and filter for lines with the length of the distance between the first non modified points?

Is there any easier way to do that?

Thanks for any and all input..

this is what my statement looks like now:

(setq lineSS (ssget "WP" pt_list (list (cons 0 "LINE"))))

Which doesn't work.. pt_list is the start end end points of the line.

alanjt
10th Nov 2009, 07:21 pm
Ok.. another quick (hopefully) question..

I got finding arcs down pat! But now I'm trying to select the line between 2 points (and only that line).. and I'm not having any luck... i figured the Fence would work.. I've since tried W WP..

Could I do what I'm doing for the arc (get begin and end point, swap either the x or y value of each pt so it's opposite) and then get the line and filter for lines with the length of the distance between the first non modified points?

Is there any easier way to do that?

Thanks for any and all input..

this is what my statement looks like now:

(setq lineSS (ssget "WP" pt_list (list (cons 0 "LINE"))))

Which doesn't work.. pt_list is the start end end points of the line.

Just use fence, or (ssget pnt '((0 . "LINE")))

Hudson
10th Nov 2009, 07:31 pm
If it works with just the one point... why didn't I try that! :)

alanjt
10th Nov 2009, 07:32 pm
If it works with just the one point... why didn't I try that! :)

Sometimes it's the simplest of things that eludes us. :)

Hudson
10th Nov 2009, 07:46 pm
That's not working for me for whatever reason

alanjt
10th Nov 2009, 07:52 pm
That's not working for me for whatever reason

Little more vague. :wink:

Fence or point?

Hudson
10th Nov 2009, 07:54 pm
It's giving me nil when I feed it point selection with either the end or the start point. (I'm 99.9% sure the point is 100% accurate... have it stored with full accuracy)

Fence isn't working either

Hudson
10th Nov 2009, 07:59 pm
Ok, now the fence appears to be working... but now it can't find the arc.. I think I'm dealing with something other than straight logic on this one.. probably something to do with my program ;)

Hudson
10th Nov 2009, 08:03 pm
I changed from:

(setq curveSS (ssget "F" pt_list (list (cons 0 "ARC"))))

To:

(setq curveSS (ssget "F" pt_list '((0 . "ARC"))))

And it's happy with me now. (same change for the line selections).

I see that that is weird usage of the list and cons... but it was working for me that way before..