Author Topic: SelectCrossingWindow return Error?  (Read 3322 times)

0 Members and 1 Guest are viewing this topic.

MarioR

  • Newt
  • Posts: 66
SelectCrossingWindow return Error?
« 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

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2162
  • class keyThumper<T>:ILazy<T>
Re: SelectCrossingWindow return Error?
« Reply #1 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,
« Last Edit: March 09, 2023, 04:29:30 AM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

MarioR

  • Newt
  • Posts: 66
Re: SelectCrossingWindow return Error?
« Reply #2 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

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2162
  • class keyThumper<T>:ILazy<T>
Re: SelectCrossingWindow return Error?
« Reply #3 on: March 09, 2023, 04:42:30 AM »

The errors that only occur on Wednesdays are a real bitch !!
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

n.yuan

  • Bull Frog
  • Posts: 350
Re: SelectCrossingWindow return Error?
« Reply #4 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.

MarioR

  • Newt
  • Posts: 66
Re: SelectCrossingWindow return Error?
« Reply #5 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

xiabin68

  • Mosquito
  • Posts: 1
Re: SelectCrossingWindow return Error?
« Reply #6 on: April 09, 2023, 11:41:49 PM »
Have your coordinates been transformed from WCS to UCS?

MarioR

  • Newt
  • Posts: 66
Re: SelectCrossingWindow return Error?
« Reply #7 on: June 24, 2024, 07:51:22 AM »
Hello,

sorry for the late reply.

It must definitely be the dwg. My current solution is to display everything, mark everything and write it out with WBLOCK. It works again in the new DWG.

It does not help to check and clean up the affected DWG.

I am not allowed to publish the affected DWG.

Best regards
Mario