If Save() command is used in iLogic, Event Triggers do not work properly (bug?)

If Save() command is used in iLogic, Event Triggers do not work properly (bug?)

ReneRepina
Collaborator Collaborator
1,443 Views
6 Replies
Message 1 of 7

If Save() command is used in iLogic, Event Triggers do not work properly (bug?)

ReneRepina
Collaborator
Collaborator

Hello!

 

I came across a problem (bug?), if I use "Save()" command in iLogic, Event Triggers do not work properly (are not executed fully - exited?).

 

We are using Inventor 2020.3.4.

 

How to simulate this problem:

  1. Create IPT and its IDW.
  2. Create an iRule:
    If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject
    	ThisDoc.ModelDocument.Save()
    End If
    
    MsgBox(ThisDoc.FileName(True)
  3. Put this iRule inside "Before Save" Event Trigger (All Documents).
  4. Dirty both of the files (for example change dimension on IPT and go to IDW).
  5. Save from IDW.

Outcome:

It will only show IDW messagebox.

ReneRepina_0-1615106207490.png

 

Other try:

  1. Do the same as above, but comment the save command:
    If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject
    	'ThisDoc.ModelDocument.Save()
    End If
    
    MsgBox(ThisDoc.FileName(True))

 

Outcome:

It will show IDW messagebox first, then Save dialog (both yes and click OK) and it will also show IPT messagebox.

ReneRepina_1-1615106335961.png

ReneRepina_2-1615106345802.png

ReneRepina_3-1615106350994.png

 

Why does Save() command skip execution of further code? Error or exited or as designed?

 

Best regards,

Rene Repina

 

0 Likes
1,444 Views
6 Replies
Replies (6)
Message 2 of 7

bradeneuropeArthur
Mentor
Mentor

Because of the TRUE value in the save option. This will skip the messages.

Furthermore the msgbox is outside the if function.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 7

ReneRepina
Collaborator
Collaborator

@bradeneuropeArthur 

I do not understand what you mean by "TRUE value".

It is strange that if you use Save() command, further code is not executed. Or is it the logic like, that it executes "Before Save", but if file is saved in between the code, it exits it?

I know msgbox is outside, it is on purpose, to see the outcomes. As you can see when model is saved, it does not executes to msgbox, because it exits it before.

 

I have an example why I need this:

  1. I modify IPT and IDW.
  2. I save from IDW.
  3. Because I changed IPT (IDW data is depended on it), I want IPT to run "Before Save" iRules and be saved.
  4. After IPT saving and updating, IDW would have good data.
  5. Because IPT "Before Save" iRule exists before it does the updates, IDW has bad data.
0 Likes
Message 4 of 7

bradeneuropeArthur
Mentor
Mentor

With the true after the save I mean this:

Public Sub main
	
If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject
	ThisDoc.ModelDocument.Save2(true)
End If

MsgBox(ThisDoc.FileName(True))

End Sub

 

This works as you need it!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 7

ReneRepina
Collaborator
Collaborator

@bradeneuropeArthur 

I also tried Save2(True), but it also does not work. Event Trigger on IPT is not executed in this case. If you comment it, it executes it.

Message 6 of 7

bradeneuropeArthur
Mentor
Mentor

You are right!

@johnsonshiue could you investigate this with your development team?

 

Thanks.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

Message 7 of 7

ReneRepina
Collaborator
Collaborator

Greetings everybody.

 

Just to fill everybody with updated informations about this case.

@Olena.Rubin from Autodesk support and her team found out that above case is a defect. It is probably not iLogic related, but a general Inventor issue when saving model and its drawing from the drawing directly.

Tracking ID is INVGEN-66198 (see below link) and escalation ID is INVGEN-66301.

 

Link to article:

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Mass-and-other-pro...

 

 

Best regards,

Rene Repina

0 Likes