Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
1125 Views, 2 Replies

Update required after running iLogic rule

I have a rule that suppresses/activates various constraints within an assembly based on the value of one parameter, one of my sub parts also contains a rule within it that modifies its geometry based on the same parameter change. What I'm finding is that when a change is made to the parameter (driven by excel), I must perform a local update to update the parameter value within the model, which triggers my rule to run, however this only partially completes the model update. The sub part completely updates its geometry and some of the constraints within my assembly update but I need to perform another local update for all of the constraints to update.

I've tried adding InventorVb.DocumentUpdate() to the end of my rule which had no effect. I've tried adding iLogicVb.UpdateWhenDone = True which didn't help either. Finally I tried adding RuleParametersOutput() with InventorVb.DocumentUpdate() after it, which also didn't solve it.

Any ideas as to what could be causing this need for an additional update after a rule has run, and how I can automate it?

MechMachineMan
in reply to: Anonymous

ThisApplication.ActiveDocument.Update
Or ThisApplication.ActiveDocument.Update2
or ThisApplication.ActiveDocument.Rebuild
or ThisApplication.ActiveDocument.Rebuild2

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Anonymous
in reply to: MechMachineMan

Sorry 3 of them don't make any difference and ThisApplication.ActiveDocument.Rebuild gives me the following error:

 

Error in rule: Hinge Side, in document: A01906.iam

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

I don't mind having to click Rebuild All manually but this will cause confusion amongst other users as it throws up some constraint errors after the rule runs, then once Rebuild All is clicked it all falls into place nicely. It seems odd as this piece of code should do the same manual process that I'm doing but automatically. Why would it give an error doing it through code and not manually?

 

Some additional info - My rule is within the same assembly my constraints are in & I'm not in any part editing mode when running it, so the Rebuild All function is available at the time the rule runs.