TheSwamp

Code Red => .NET => Topic started by: MarioR on March 09, 2023, 02:38:20 AM

Title: SelectCrossingWindow return Error?
Post by: MarioR on March 09, 2023, 02:38:20 AM
Hello,

I've been using Application.DocumentManager.CurrentDocument.Editor.SelectCrossingWindow(pointLL,pointUR) to select elements in the viewing area for what seems like forever.

Lately I always get 'Error' as PromptSelectionResult [Status='Error', Value=null] and have no idea why.

Is there any way to find out more about the cause of the error?

regards Mario
Title: Re: SelectCrossingWindow return Error?
Post by: kdub_nz on March 09, 2023, 04:25:55 AM
Hi Mario,

Are either of the points off screen ??

Is there an explicit error message ?

I know you've been coding a while so I doubt I'd offer anything you haven't thought of.
Might be handy to see the code so someone can throw it into a Project to test.

Regards,
Title: Re: SelectCrossingWindow return Error?
Post by: MarioR on March 09, 2023, 04:34:16 AM
Hello,

I have tried with other DWG files, with a few it works.
Especially with a new drawing it always works.

So it must be the DWG file in question.

However, no errors were detected in the DWG files concerned, but after I had copied all the contents into a new DWG, it worked there too.

There must have been an error hidden somewhere in the database.

AutoCAD surprises you again and again ;-)

best regards
Mario
Title: Re: SelectCrossingWindow return Error?
Post by: kdub_nz on March 09, 2023, 04:42:30 AM

The errors that only occur on Wednesdays are a real bitch !!
Title: Re: SelectCrossingWindow return Error?
Post by: n.yuan on March 09, 2023, 10:56:05 AM
Hello,

I have tried with other DWG files, with a few it works.
Especially with a new drawing it always works.

So it must be the DWG file in question.

However, no errors were detected in the DWG files concerned, but after I had copied all the contents into a new DWG, it worked there too.

There must have been an error hidden somewhere in the database.

AutoCAD surprises you again and again ;-)

best regards
Mario

Well, you did not say anything about the current view when the Editor.SelectXXXX() method is called, as Kerry assumed that you do know the catch. But still, you want to confirm the view is not zoomed too far out, or too zoomed in so that the window's corner points (both or single one) are/is not off the current view. Do you ALWAYS zoom the view properly before calling Editor.SelectXXXX()? If you do not, then that is the probably the typical cause the code sometimes work, sometimes not.
Title: Re: SelectCrossingWindow return Error?
Post by: MarioR on March 10, 2023, 02:48:52 AM
Hello,

a) I do not zoom in the selection, because I read the selectionframe from the current view. Therefore the frame is always correct.

b) "Editor.SelectCrossingWindows" does not throw an exception, only the "PromptSelectionResult.Status" is "Error".

c) My mistake was that I didn't try / debug in other drawings right away. Otherwise this thread would not have arisen.

d) yup, some errors only occur on Wednesdays and only if you haven't drunk any coffee from the blue cup.  :whistling: :mrgreen:

best regards
Mario
Title: Re: SelectCrossingWindow return Error?
Post by: xiabin68 on April 09, 2023, 11:41:49 PM
Have your coordinates been transformed from WCS to UCS?