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

Hi @Damian_Apex.  The problem with that 'iLogicForm.Show("Form1")' iLogic snippet, is that there appears to be no documentation about which document it is designed to target by default, and apparently no way to tell it to target a specific document.  So, in an assembly scenario, where there are multiple documents open, and/or from an external iLogic rule, this confusion can be even more prevalent.

Here is a bit of exploratory code I created at some point that checks which iLogic Forms are available using those snippets:

Dim oLocalFormNames = iLogicForm.FormNames
If oLocalFormNames.Count = 0 Then
	MsgBox("There were no 'Local' iLogic Forms.", , "")
Else
	a = InputListBox("", oLocalFormNames,"", "Local Form Names")
End If
Dim oGlobalFormNames = iLogicForm.GlobalFormNames
If oGlobalFormNames.Count = 0 Then
	MsgBox("There were no 'Global' iLogic Forms.", , "")
Else
	b = InputListBox("", oGlobalFormNames,"", "Global Form Names")
End If

There is something I saw recently that might be able to help here though if your version of Inventor is new enough.  It makes use of the StandardObjectFactory.Create() method (only available within iLogic).  This allows you to specify a Document object, and can use the resulting IStandardObjectProvider to initiate most other iLogic only tools, one of which is the iLogicForm.  My understanding is that if you access the iLogicForm object from that IStandardObjectProvider object you created, it will target the document you specified when you created it.  Using it would look something like this:

Dim oTargetDocument As Document = ThisApplication.Documents.ItemByName("C:\Temp\MyAssembly.iam")
SOP = StandardObjectFactory.Create(oTargetDocument)
SOP.iLogicForm.Show("Form1")

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)