Inventor Engineer-To-Order (Read-Only)
Welcome to Autodesk’s Inventor ETO Forums. Share your knowledge, ask questions, and explore popular Inventor ETO topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get displayName of a part?

6 REPLIES 6
Reply
Message 1 of 7
tommam
470 Views, 6 Replies

Get displayName of a part?

I have, I think, a rather simple question. I've created an Intent model (attached). I'm trying to find
"AirTunnelVestGroup_1" using the API. I start at the active root and get it's children and I find "HVACUnitGroup". Then I search the children of this, but I don't know what to look for. I tried comparing the child.Design.DisplayName, but that gives me "AirTunnelVestGroup", not "AirTunnelVestGroup_1". I also tried using "RefChain", but that gave the same name. Is there a way to get the instantiated name of a child?

Thanks!
Tom
6 REPLIES 6
Message 2 of 7
AlexKorzun
in reply to: tommam

Hi Tom,

You may wish to evaluate the DisplayName rule on a Part:

C# : part["DisplayName"]
VB.Net: part("DisplayName")

// To traverse an Intent model Tree, you should evaluate AssemblyChildren Rule on the Parts.

Thank you,
Alex Korzun

Intent Development
Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 3 of 7
AlexKorzun
in reply to: tommam

Hi Tom,

You may wish to evaluate the DisplayName rule on a Part:

C# : part["DisplayName"]
VB.Net: part("DisplayName")

// To traverse an Intent model Tree, you should evaluate AssemblyChildren Rule on the Parts.

Thank you,
Alex Korzun

Intent Development
Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 4 of 7
tommam
in reply to: tommam

Alex,

Thanks for the reply. I've been using _API.ActiveRoot.GetChildren(), but you're saying I should be using _API.ActiveRoot.GetRuleValue("AssemblyChildren")? I tried that but I don't get any value back. It doesn't throw an exception, it just doesn't return anything. Am I doing something wrong?

Thanks.
Message 5 of 7
AlexKorzun
in reply to: tommam

So, you are calling the methods that return PartsEnumerator. You may use the result as follows:

Dim children As PartsEnumerator = _API.ActiveRoot.GetAssemblyChildren()
Dim p As Part
For Each p in children
MessageBox.Show( p.ToString())
Next

The equivalent results can be obtained through:
Dim children As Value() = _API.ActiveRoot("AssemblyChildren")
Dim p As Part
For Each p in children
MessageBox.Show( p.ToString())
Next



There is a difference between GetChildren() and GetAssemblyChildren(): The first one enumerates the child Parts in the memory model, while the second one brings only a subset that you see in the Assembly Tree.

Thank you,

Alex Korzun

Intent Development
Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Message 6 of 7
tommam
in reply to: tommam

Alex,

I got your code working and I see the difference between GetChildren and GetAsssemblyChildren, thanks. However, when I do p.ToString(), I get "AirTunnelVestGroup", not "AirTunnelVestGroup_1". Is there a way to get the instance specific name?

-Tom
Message 7 of 7
AlexKorzun
in reply to: tommam

Hi Tom,

Try the following:
part.RefChain.Last

Thank you,
Alex Korzun

Intent Development
Thank you,




Alex Korzun
Inventor-Revit Interop / Inventor-Fusion Interop / Inventor ETO
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report