Trying to enable adaptivity for a specific part in an assembly through Ilogic rule

Trying to enable adaptivity for a specific part in an assembly through Ilogic rule

AlexJohnson84
Explorer Explorer
310 Views
5 Replies
Message 1 of 6

Trying to enable adaptivity for a specific part in an assembly through Ilogic rule

AlexJohnson84
Explorer
Explorer

Hello,

 

I am newer to Inventor, but I am working on creating a baseline assembly for my company by placing and constraining parts through ilogic. I am doing pretty well, but one of the components I am placing needs to be adaptive and I cannot figure out, after days of scouring the internet and working with ChatGPT, how to get it to work.  I know the occurrence name that I need to change, but cannot figure out how to write the code to toggle it.  Is anyone able to help me??

 

Thanks!

0 Likes
Accepted solutions (1)
311 Views
5 Replies
Replies (5)
Message 2 of 6

AlexJohnson84
Explorer
Explorer

I thought I had it figured out at one point using the following code:

Component.InventorComponent("HOPPER").Adaptive = True

But after closing and re-opening the document it was no longer working, giving me the following error:

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

Hi @AlexJohnson84.  When using that specific line of code, there are some things to keep in mind.

ICadComponent.InventorComponent Property 

  • Where you have "HOPPER", that needs look exactly like what you see in the model browser tree.
    • For example, if you placed 3 instances of Part1.ipt into an assembly, the 'occurrences' would likely be named {"Part1:1" & "Part1:2" & "Part1:3"}.  Notice the ":1" portion after the file's name...that needs to be included in that line of code, to specify which 'instance/occurrence' you are referring to (For example, it might need to be "HOPPER:1:", instead of just "HOPPER".
  • If that component is not a 'top level' component, then you will need to specify its 'path', not just its 'name'.
    • Its 'path' is an array of Strings, separated by commas, starting with the name of the top level sub assembly occurrence (as seen in the browser tree), then the name of the next level down sub assembly, or the occurrence you are after, if it is not in a lower level sub assembly.

Edit:  Also, if you change the name of that occurrence, or if you replace that occurrence with another component which references a different source model file, then that might also change its name, and if that happens, the code will no longer be able to find it by its name, and you may need to change the name being specified within your iLogic rule.  If you did replace the component, which caused this issue, there is a way to 'stabilize' that component's name, so that it its name will not change when replaced.  To do this, just change the name of the component directly in the model browser tree (just the component, not the part file's name) to something slightly different, yet still meaningful.  Once changed, it will no longer change automatically on you.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 4 of 6

AlexJohnson84
Explorer
Explorer

Hello Wesley,

 

I appreciate the information. The part is being interchanged with different model hoppers within an ilogic rule based off a dropdown menu in a form. There can only be one hopper in my assembly at a time and when the needed hopper is selected it is always placed in the model browser tree as "HOPPER", so that the code will always have the same reference point. It is a part inside of my main assembly and not a sub-assembly, so I do not know if it is considered 'top level' or not.

However, I did discover this morning, that I was unable to make the hopper part adaptive even by right clicking the part.  Adaptive was greyed out and I had to open the part file, go to Tools>Document Settings>Modeling and uncheck "Adaptively Used in Assembly" before it would allow me to use it adaptively in the assembly.  I am not sure what would cause that to happen, but once I had done that to all of my different hopper options they were able to be made adaptive again.  I figured I would just save the template I'm building with an adaptive hopper on it and see if it holds when switching between the different models and removing the hopper completely. However, after changing the setting I mentioned in all of the hopper part files, the code now works again. Any idea why the hopper part files would need the "Adaptively Used in Assembly" unchecked?

 

Thanks,

 

Alex

0 Likes
Message 5 of 6

WCrihfield
Mentor
Mentor
Accepted solution

Hi @AlexJohnson84.  I will post a link to the 2024 online help documentation about that setting in the Document Settings dialog below.

Modeling Tab Reference (Document Settings) 

It says:

"Available only when the active part is adaptive. Removes the indicator that a part is used adaptively in an assembly. Clear the check box to remove the adaptive indicator.

Note: Change the adaptivity status only if the assembly no longer uses the part. If you remove the indicator from a part that is still used adaptively in an assembly, the part becomes a rigid body."
 
I pretty much never manually set any of my parts or assemblies to 'adaptive' where I work, so I am honestly not super familiar with how that may work out for you.  Normally the only scenarios where I have things being adaptive is when I have created sketches &/or features at a parent assembly level, while in-place editing a component within an assembly, using either projected sketch geometry from other components in the assembly, or by basing some geometry associations on stuff only found at assembly level.  Then the part will automatically contain associative sketches/features where they are driven by something in a specific assembly.  I generally do not leave them associative though, opting to break the link, then fully constrain them based on local geometry within my part, after the fact.  Mainly to prevent unwanted changes, once their design has been 'documented / detailed' in a drawing, either for production or for supplier fabrication.  And for performance reasons, to avoid the additional references/links getting checked when those files are loaded.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 6

AlexJohnson84
Explorer
Explorer
I am not a big fan of the adaptive parts. But I am new here and the process and parts are not, so having to learn to work within the rules.

Thank you again for you help and the time it took! Very appreciative not to be out here all on my own.
0 Likes