Jump to content

Recommended Posts

Posted

Hi, I am writing some C# code on an AutoCAD project. basically, I am trying to select all objects in a rectangular area defined by two points as its corners.

 

I did the following:

 

(....

private AutoCAD.AcadDocument m_ACADDoc

double [] pt1 = new double [3];

double [] pt2 = new double [3];

....)

 

AcadSelectionSet oAcadSSet = m_ACADDoc.SelectionSets.Add("SSET");

 

oAcadSSet.Select(AcSelect.acSelectionSetCrossing, pt1, pt2, Type.Missing, Type.Missing);

 

 

It seems when I use AcSelect.acSelectionSetCrossing, nothing gets selected.

 

Notes:

when I use AcSelect.acSelectionSetLast and AcSelect.acSelectionSetAll, it works fine.

when I use AcSelect.acSelectionSetWindow, some objects get selected. but not those in the rectangle defined by pt1, pt2.

 

 

Anyone can help?

Posted

ha, I figured out something. it was the corner points that I set: (-50, -50, 0) to (50, 50, 0). I changed them to: (-500, -500, 0) to (500, 500, 0), which defines a way bigger rectangle, now objects are getting selected.

 

but my question is: all the objects that I drew (lines, arcs) are within -50 to 50 range. why they didn't get selected the first time? Is there something regarding the coordinate system that I need to be careful about?

Posted

If it's like 'ssget' in lisp, objects need to be visible in the display to be selected by window, crossing, coordinate, etc.

If so maybe, you dispaly/zoom was different when selection rather than the code change...?

Posted

you are right! actually I was trying to select some objects that were out of the screen! As I used a .dwg file that had already some drawings in it (when the file is opened, the left bottom corner is (100, -100, 0) rather than (0,0,0) ), I was drawing my objects out of the screen so they wouldn't mix up with the existing stuff. My idea was to move them back to the screen later on....

 

how can I move the screen to have it's left bottom set at (0,0,0)?

Posted

Solved!

ZoomAll to get everything into the screen and then do the selection!

Thanks! CarlB!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...