Author Topic: SelectCrossingWindow giving me more results than I want  (Read 9729 times)

0 Members and 1 Guest are viewing this topic.

Proctor

  • Guest
SelectCrossingWindow giving me more results than I want
« on: July 29, 2009, 03:04:20 PM »
Hello: I am using selectCrossingWindow to locate all lines that are either inside or cross the window parameters being passed in; it's been working fine...so i thought...until I ran my code on the attached polygon. in the attached pic you can see how I draw a box using my paremeters so that i can verify that all lines are either inside or crossing it. in looking at the pic, you can see that only 2 lines should be in the result set; however, it gives me 4 and i can't figure out why???? the blue and the green lines represent the lines it's giving me.

also, the arrows represent the 2 points i'm passing in.

any ideas are truly appreciated. i've been scratching my head for a few days on this now.
thanks,
Proctor

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #1 on: July 29, 2009, 03:28:48 PM »
I just tried making the box smaller, so only 1 line appears in it....and now it's getting a count of 2. the line that's green is the additional line it's picking up. i don't understand why it's doing this?

here's the line of code where i'm sending in the paramerts:
<code>resW = doc.Editor.SelectCrossingWindow(myYPt, myY2Pt, filter)</code>
the filter is for lines only.

thanks,
Proctor

Dave R

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #2 on: July 29, 2009, 03:55:49 PM »
Try using doc.Editor.SelectWindow instead.

I just tried making the box smaller, so only 1 line appears in it....and now it's getting a count of 2. the line that's green is the additional line it's picking up. i don't understand why it's doing this?

here's the line of code where i'm sending in the paramerts:
<code>resW = doc.Editor.SelectCrossingWindow(myYPt, myY2Pt, filter)</code>
the filter is for lines only.

thanks,
Proctor

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #3 on: July 29, 2009, 03:57:57 PM »
hi Dave - thanks for your reply. doesn't selectWindow only give what's entirely in the window? i need it to give me for both what's inside and also what's crossing the window too.

proctor

Dave R

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #4 on: July 29, 2009, 04:01:52 PM »
Sorry. Flying by and didn't fully read your first post. Could it have something to do with the linetype of the green line perhaps? Looks like it may be a dashed linetype and that may be why the selection window is picking it up. Also check to see that the small line is not duplicated on top of itself.

hi Dave - thanks for your reply. doesn't selectWindow only give what's entirely in the window? i need it to give me for both what's inside and also what's crossing the window too.

proctor

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #5 on: July 29, 2009, 04:08:16 PM »
I was just thinking....when i break down my procedure and ask for the user to select the line, the code works fine; however, in my code, i loop through a set of polygons.

for each polygon, i use SelectCrossingPolygon(myPtColl, filter) to give me a list of lines that are inside it.
for each line i then draw boxes for each end in order to find lines close to it. I  pass the crossing window params like this:

<code>
 Dim resW As PromptSelectionResult = Nothing
 resW = doc.Editor.SelectCrossingWindow(myVectorYStartPt, myVectorY2StartPt, filter)   
</code>

do you think that this has something to do w/ why it's not giving me the correct results?
thanks
proctor

T.Willey

  • Needs a day job
  • Posts: 5251
Re: SelectCrossingWindow giving me more results than I want
« Reply #6 on: July 29, 2009, 04:14:01 PM »
Use a normal Acad command, and select the same way, and see if you get more than the two objects.  If so, then maybe you have objects on top of objects.

/idea
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #7 on: July 29, 2009, 05:34:31 PM »
Good idea T. Willey....I tried and i no hidden objects.  :-(

wannabe

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #8 on: July 30, 2009, 06:18:17 AM »
Is your command altering the UCS at all? So that the crossing window is actuallly skewed, relative to the UCS view, subsequently causing those lines to be inside the window??

SEANT

  • Bull Frog
  • Posts: 345
Re: SelectCrossingWindow giving me more results than I want
« Reply #9 on: July 30, 2009, 06:42:39 AM »
Another possible factor is distance from World Origin.  SelectCrossingWindow may also suffer the limitations associated with floating point precision.

Edit:
Though, I suppose that would also show up during that normal Acad command . . . . nevermind.
« Last Edit: July 30, 2009, 06:46:40 AM by SEANT »
Sean Tessier
AutoCAD 2016 Mechanical

Bryco

  • Water Moccasin
  • Posts: 1882
Re: SelectCrossingWindow giving me more results than I want
« Reply #10 on: July 30, 2009, 09:54:15 AM »
Is each iteration of Editor.SelectCrossingWindow in its own transaction?

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #11 on: July 30, 2009, 12:24:42 PM »
Hello: Bryco, to answer your question, i start the transaction before i begin looping and i end it after i finish looping.

wannable....i don't understand about UCS? can you please explain more?


thanks,
Proctor

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #12 on: July 30, 2009, 01:12:23 PM »
Something weird happened when i tried my code first thing this morning. the first time debugging, it gave me a count of 2. The second time through, it gave me a count of 3 and after that each time, i get a count of 4. this is for the exact same drawing (same lines that are at the same exact position).

so, i tried to close autocad and reopen, but it still said 4. i then copied the poly onto a new drawing and it's giving me 2 each time (tried 4 times). i tried to copy the poly to the same drawing, but i still get a count of 4.

what's happening? i don't get it....

Proctor

Spike Wilbury

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #13 on: July 30, 2009, 01:14:19 PM »
does this method it is not affected from the zoom ?

Proctor

  • Guest
Re: SelectCrossingWindow giving me more results than I want
« Reply #14 on: July 30, 2009, 01:22:41 PM »
Esquivel: it seems it actually might be. i zoomed way in on it and ran it and it gave me the correct number (2). after, i did the opposite, zoomed out and it returned 6.

do you know what i need to do to make it consistent? - to make it give me what i visually see inside the box?

thanks so much.
Proctor