yl2000 Posted April 9, 2009 Posted April 9, 2009 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? Quote
yl2000 Posted April 9, 2009 Author Posted April 9, 2009 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? Quote
CarlB Posted April 9, 2009 Posted April 9, 2009 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...? Quote
yl2000 Posted April 9, 2009 Author Posted April 9, 2009 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)? Quote
yl2000 Posted April 9, 2009 Author Posted April 9, 2009 Solved! ZoomAll to get everything into the screen and then do the selection! Thanks! CarlB! Quote
Recommended Posts
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.