SelectSet.Select method how to use?

SelectSet.Select method how to use?

Cris-Ideas
Advisor Advisor
7,355 Views
25 Replies
Message 1 of 26

SelectSet.Select method how to use?

Cris-Ideas
Advisor
Advisor

Hi

I am trying to use Select.Set  object but I am failing to add objects to it.

 

Can someone advice please:

 

    Dim oComponentList As Inventor.SelectSet
    Dim obj As Object

        For Each obj In _invApp.ActiveDocument.SelectSet


            oComponentList.Select(obj)
            Debug.Print(obj.Name)
        Next
            Debug.Print(obj.Name)

Works fine, but for

oComponentList.Select(obj)

I an getting an error:plugin 1.png

 

 

Can someone explain me how shod I use .Select Method to add objects to Select.Set?

 

Cris.

 

Cris,
https://simply.engineering
0 Likes
7,356 Views
25 Replies
Replies (25)
Message 21 of 26

Frederick_Law
Mentor
Mentor

I think, not 100% sure:

Your selectset will contain parts and sub-assemblies.  Not parts in the sub-assemblies.

When its demoted, you'll lost the object, since now its in another assembly.

When promoted, it will not be in the list since it wasn't there in the beginning.

 

You could go through SelectSet and add all CompOcc to your list.  Should do some test to see what happen with demote and promote.

0 Likes
Message 22 of 26

Cris-Ideas
Advisor
Advisor

@MjDeck

Thanks.

 

Is there any property that would allow me to find references for the same objects between sessions?

 

So having my object list is there any way I can save data to a file and than use it next time to grab references to exactly the same objects?

Does particular instance of object in assembly has some unique property from creation to deleting? (available through API)

 

Cris.

 

Cris,
https://simply.engineering
0 Likes
Message 23 of 26

MjDeck
Autodesk
Autodesk

A reference key is an identifier that will be good in future sessions, as long as the object hasn't been deleted.
Another option might be to add a custom Attribute to an object.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 24 of 26

Cris-Ideas
Advisor
Advisor

@MjDeck wrote:

A reference key is an identifier that will be good in future sessions, as long as the object hasn't been deleted.
Another option might be to add a custom Attribute to an object.


If I am adding custom attribute to an object am I in fact adding this attribute to the instance of the object (so for example instance of the part) or to the part it self?

I suppose object, but would like to be sure.

 

What type can custom attribute be? Any? (can you point me to help reference, tried searching but not found yet).

 

Cris.

Cris,
https://simply.engineering
0 Likes
Message 25 of 26

MjDeck
Autodesk
Autodesk

If you add it to a ComponentOccurrence object (which is what you get when you select a part instance in an assembly), then you're adding it to that particular instance. You can add an Attribute to anything that has an AttributeSets property. (You would generally add an AttributeSet, and then add an Attribute to the set.)
An attribute can hold a string, number, boolean, or array of bytes. An array of bytes can represent pretty much anything.
The Attribute Helper from Brian Ekins is very handy. That page also has a link to an introduction.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 26 of 26

Cris-Ideas
Advisor
Advisor

Grate suggestion with this attribute. This will save me a lot of work.

 

Cris.

Cris,
https://simply.engineering
0 Likes