Inventor Customization

Inventor Customization

Reply
Mentor
TONELLAL
Posts: 162
Registered: ‎01-17-2010
Message 1 of 3 (166 Views)

Filter a selectset

166 Views, 2 Replies
01-23-2013 08:27 AM

Hello,

I need to filter a selectset, in order to have only the objects I need (here balloons) in a collection.

I tried to test using "Typeof", the problem is some objects in the selectset are "empty".

What are thes "empty" objects ? And, more important, how can I found them ?

My current code is :

 

*******************************

Dim oSelection As SelectSet

Dim oSelectedBalloons As New Collection

Dim selectedObj As Object

 

Set oDoc = ThisApplication.ActiveDocument

Set oSelection = oDoc.SelectSet

 

For Each selectedObj In oSelection

If TypeOf selectedObj Is Balloon Then oSelectedBalloons.Add selectedObj

Next

********************************

This function if objects in the selectset are not empty.

How can I adapt it for empty objects ? Something like "if selectedObj = Nothing..."

 

Any idea welcome !

 

Mentor
krieg
Posts: 176
Registered: ‎11-22-2009
Message 2 of 3 (159 Views)

Re: Filter a selectset

01-23-2013 12:47 PM in reply to: TONELLAL

Hello

 

Try to enable a selectionfilter. Take a look at inventor programmers help and search for "AddSelectionFilter". There is a window selection example, which you can adept by changing the selectionfiltetypeenum.

So you don't have to "clean" your selection.

ADN Support Specialist
xiaodong.liang
Posts: 1,335
Registered: ‎06-12-2011
Message 3 of 3 (138 Views)

Re: Filter a selectset

01-28-2013 12:39 AM in reply to: krieg

Hi,

 

Krieg is correct. In this case the filter enum is: 

kDrawingBalloonFilter = 16906


Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.