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

Hi @DeepshipEngineering.

  • Are both the iLogic Form, and the iLogic rule that are being called to show / run located within your drawing template file?
  • Are you using the event in the Event Triggers dialog named "New Document" only ; or are you also using additional events in the Event Triggers ; or are you using custom event handler codes, such as within an Inventor add-in?  Please be as specific and informational as possible.
  • Do you ever create a visible new drawing from that template by code?
    • If so, then does that trigger this event, showing the Form and running the rule?
  • Does the SheetFormat being used to create a new Sheet contain any model views?
  • Does the SheetFormat being used to create a new Sheet contain any 'linked' properties which point to 'the model'?

My first recommendation to you would be the same as earlier in this topic...edit the code you just posted, to replace "ThisApplication.ActiveDocument" code phrases with the "ThisDoc.Document" code phrase.  When the 'ThisDoc.Document' phrase is used within an 'internal' iLogic rule (saved within an Inventor document, not external), it will point to the Document that the rule is saved within, by default.  However, it is a dynamic term, supported by the iLogic add-in, so it will point to the most appropriate Document in different situations.  Such as in this case, if an iLogic rule is triggered to run because an event in the Event Triggers dialog, this phrase will represent the document that the event was triggered in/by.  If an iLogic rule is called to run with a line of code like 'iLogicVb.Automation.RunExternalRule(oDoc, "MyRule1")', then this term will represent that 'oDoc' Document that was intended for the rule to target (focus on).  I could go on about its additional functionality, but you get the point.

 

I noticed that you are showing the Form as Modal, which I believe will actually cause the iLogic rule that called it to show, to be 'paused' while it is showing, then resume once it has been closed.  That is good.  Then you seem to be running an internal iLogic rule from within the same document as the current rule.  I do not know what code is in that other rule, but it sounds like it is adding a new Sheet to the current drawing, using a SheetFormat as its source.  I believe that when we call another rule to run from within an iLogic rule, the current rule will relinquish control to that other rule until it gets done, then control comes back to the current rule, where it continues with the rest of its code.  Since a Sheet was just added a split second ago, then you are attempting to delete a sheet immediately after that, I wander if a document update between those two actions may be needed.  Something to add a slight delay for processing between the new Sheet being added, and a Sheet being deleted.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)