- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys!
I recently started dipping my toes in to the iLogic coding in Inventor and I can't figure out how to get the active assembly to "Rebuild All" (including all components within the assembly) any time I save the assembly. These aren't huge assemblies as I have multiple layers to my models, but these are template assemblies that will be copied and resized for different conditions and I need certain aspects (like the bolted connections and links) to update automatically when someone who isn't me is trying to use these. The last thing we need is for someone to miss clicking rebuild and our fastener counts/assembly lengths to be off.
Other rebuild triggers are an option (such as opening or placing the assembly within another assembly) but having it happen when it is saved is my preference. Also I am running Inventor 2019 in case that is relevant.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The Ilogic code to rebuild an assembly is simply
ThisDoc.Document.Rebuild()
I would recommend saving this as an external rule and setting up your assembly templates so that they have the rule set to trigger before saves. You can also set this trigger on existing documents.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
What is the reason you recommend saving it as an external rule rather than a rule in the document? Where would the external rule be saved? If it is on my desktop, wouldn't someone else who doesn't have the rule saved to their computer get an error when they try to use the assembly?
@AdamAG99T wrote:I would recommend saving this as an external rule and setting up your assembly templates so that they have the rule set to trigger before saves. You can also set this trigger on existing documents.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
If you're using this for multiple users then yes you could save it as a regular rule on the assembly template. The main benefit of using an external rule would be to make it easier to add to previously made documents, since you would just need to add the trigger instead of creating a new rule in each document as well as the trigger.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
OK, so I ended up running into some issues in my overall model where the sub assemblies are placed-
Similar assemblies share some parts (small purchased parts such as clips that are the same regardless of where they are used) and they get into a cyclical Rebuild/Update/Save loop where it won't allow me to check in my overall because one sub-assembly will rebuild, making it so the other needs to be updated because of the shared parts, and so on.
So I am taking a different approach that should work but I can't figure out why it wont.
If Assembly_Length <> Assembly_Length ThisDoc.Document.Rebuild() End If
This code SHOULD rebuild if the parameter "Assembly_Length" changes, correct? I have a skeleton .ipt linked to the assembly, and this Assembly_Length is pulling the Length from the .ipt, so when I update the length of the skeleton and return to the Assembly, the Assembly_Length will change and the rebuild code should trigger.
I can't figure out why this isn't working!! It seems so simple.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Wanting to re-open this, attempting to do the same thing more or less.
What solutions did you land upon/was behaviour as expected? I'm currently running:
ThisDoc.Document.Rebuild()
To no success, unsure why that is the case.