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: 

Best way to get the Part

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
rikard.nilsson
555 Views, 2 Replies

Best way to get the Part

Hi,

I often writing code in my addins where I pick a component in the window by using Inventor API and then using GetChildren() and Find() to get the corresponding Intent Part.
Is there any smarter and faster way to get the Part in Intent API?

Regards
Rikard
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: rikard.nilsson

Hi Rikard,

Try this : Intent.IntentAPI.Utilities.GetPart(Intent.RefChainFromHostObject(A_ComponentOccurrence))

 

Hopes this helps,

Mark

Message 3 of 3
rikard.nilsson
in reply to: Anonymous

Thanks Mark!

 

I had to do some modifications to make it work. 

Below is my solution if anyone else need to know this..

 

/Rikard

 

IHostAPI hapi = (IHostAPI)IntentAPI.Instance.HostAPI;
string refChain = hapi.RefChainFromHostObject(PickedPartOcc);
Part TestPart = IntentAPI.Instance.Utilities.GetPart(refChain);

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

Post to forums  

Autodesk Design & Make Report