Distinguished Contributor
Posts: 143
Registered: ‎07-07-2006
Message 1 of 2 (497 Views)

window selection set with vb.net

497 Views, 1 Replies
11-19-2008 11:43 AM
Does anyone have a code sample that shows how to select drawing entities with a window? I found the .SelectWindow method of the Editor class but I'm stuck after that. If I could add filtering to the selection set that would be great too.


Civil 3D 2009 SP1
Win XP Pro SP2
VS 2005 SP1 - vb.net
*Expert Elite*
Posts: 753
Registered: ‎02-13-2008
Message 2 of 2 (497 Views)

Re: window selection set with vb.net

11-19-2008 01:04 PM in reply to: joshlund
The attached file has a little more than you asked for, but I didn't see any put in cutting it up any further. It will do a selection by rectangular window, polygon window, rectangle crossing or polygon crossing, with or without a filter.

To use the filter you create an array of the typed values you want to filter on, and pass the array to this function. For the window/crossing rectangle/polygon, you create a point3dcollection containing the points which define your polygon/rectangle. Note that with a rectangle you only pass the two points for the opposite corners, just like when you pick it on screen, but for a polygon you pass a point for each vertex.

The code chooses wether to do a Rectangle or Polygon based on the number of coordinates passed in the point collection, and there is a boolean argument for wether to do a window or a crossing. Also a couple of booleans to give you access to the RejectLockedLayer, RejectNonCurrentSpace, and Force/AllowSubSelections properties.
Dave O.                                                                  Sig-Logos32.png
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.