Possibility for multiple iLogic configurations with the same Inventor installation?

Possibility for multiple iLogic configurations with the same Inventor installation?

Anonymous
Not applicable
769 Views
7 Replies
Message 1 of 8

Possibility for multiple iLogic configurations with the same Inventor installation?

Anonymous
Not applicable

Hi

 

I'm trying to set up a test environment for external rules. I need to make and test changes to our suite of external rules without disrupting my coworkers or myself, as I'm switching tasks multiple times per day.

 

In the iLogic Advanced Configuration there's a list of directories where external rules are to be searched for.

 

Is it possible to set up two instances of this configuration: one for testing purposes and another for global use?

 

Thanks

 

0 Likes
Accepted solutions (2)
770 Views
7 Replies
Replies (7)
Message 2 of 8

A.Acheson
Mentor
Mentor

You could just copy the whole folder of ilogic rules and global forms to a new folder and then change the ilogic paths in the ilogic ribbon. I can't remember if the external rule buttons mapped to the form would reconnect after a root path change like this.

 

However I don't think you will be able to have two sets of global forms side by side. The only way around this might be to rename the forms so that you don't get mixed up with old vs new and of course you want to see both side by side anyhow. 

 

Of course this is all theoretical so it could start becoming a major pain trying to juggle them all. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 8

Darkforce_the_ilogic_guy
Advisor
Advisor

I use this code to do that you want  

oNAME = ThisApplication.GeneralOptions.UserName


If
oNAME = "enter your usernavn here" Then
'Enter the code that only need to run on your computer here End If

 

 

Message 4 of 8

WCrihfield
Mentor
Mentor
Accepted solution

Hi @Anonymous.  Have you considered exporting 2 versions of your iLogic Configuration settings to XML files, leaving the one named normally, and the other with "for testing" in its name.  I do not recall if there is an easy way to load a different XML file for the iLogic Configuration by code, but there might be.  If so, that would be a quick way of switching back & forth easily, when you want to work on your testing stuff.  The alternative would be to quickly change the settings within it back & forth by code, instead of switching the XML file out, and I know how to change most of those settings by code.

Dim oListOfDirectories As New List(Of String)
oListOfDirectories.Add("C:\Temp\iLogicTesting\")
iLogicVb.Automation.FileOptions.ExternalRuleDirectories = oListOfDirectories.ToArray
iLogicVb.Automation.FileOptions.AddinDirectory = "C:\Temp\AddInTesting\"
iLogicVb.Automation.LogControl.Level = LogLevel.Trace
iLogicVb.Automation.LogControl.RuleEntryExitMessageLevel = LogLevel.None
iLogicVb.Automation.ExcelEngine = ExcelEngine.COM
iLogicVb.Automation.RulesEnabled = True
iLogicVb.Automation.RulesOnEventsEnabled = True

Then, similarly to some of the suggestions above, you could copy all your rules & forms over under the new directory(s).  That way only one set of rules &/or forms will ever be showing, and it will only be showing the 'other' set to you, when you use the rule to switch the settings out on your machine.  Each of those settings in the rule could be set-up to 'toggle' when ran, instead of just set them the one way, or you could use a conditional statement, such as checking user name, to decide which way to set the settings.  Those settings could even just be momentary, while you do something, then you could run the rule again to change them back.  Just some untested theories/thoughts.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 8

WCrihfield
Mentor
Mentor
Accepted solution

FYI:  I found the commands for exporting & importing the XML file for the iLogic Configuration settings.  Using these together with the PostPrivateEvent method should allow you quickly & easily import whichever settings file you want by code.

Dim oCM As CommandManager = ThisApplication.CommandManager
Dim CDs As ControlDefinitions = oCM.ControlDefinitions
'StandardFile = "C:\Users\(YourUserName)\AppData\Local\Autodesk\Inventor 2022\iLogicPreferences\iLogicOptions.xml"
TestingFile = "C:\Temp\iLogicTesting\iLogic Options (for Testing).xml"
'sends that full file name up into Inventor's memory, to prepare for the command we are about to execute
oCM.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, TestingFile)
'Dim ExportiLogicConfig As ControlDefinition = CDs.Item("iLogic.XmlExport")
Dim ImportiLogicConfig As ControlDefinition = CDs.Item("iLogic.XmlImport")
'execute the command (it will use the file name we sent into memory)
ImportiLogicConfig.Execute

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

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 8

Anonymous
Not applicable

I suspect this is exactly what I'm looking for, or at least as close as I'm going to get.

 

Thanks very much!

Message 7 of 8

Anonymous
Not applicable

So, on trying to implement this, it doesn't seem to update the internal references represented by the RulesOnEvents.xml file.

 

I can see the folder change in the iLogic browser, but putting `MsgBox()` popups to identify which of the parallel-ly maintained scripts is running reveals there's no variation.

 

How can I also push the change to these references?

 

And, in fact, I suspect it may be necessary moreover to somehow update any document-specific references.

 

0 Likes
Message 8 of 8

WCrihfield
Mentor
Mentor

I'm honestly not sure.  This is getting into some grey area that I haven't been able to test into that much, due to how things are set-up where I work.  This kind of sounds like a session memory type issue, like now that the hard copy file has been switched out, the old settings are still being held in memory, but they need to be flushed and the new settings need to be read into memory, but I'm not sure.  I know of a couple 'memory' cleaning commands, but I don't know if they would help any in a situation like this.

For instance, you can supposedly 'free' or 'clear' up iLogic's memory with this command:

ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.FreeILogicMemory").Execute

...and here is another sort of related command:

ThisApplication.CommandManager.ClearPrivateEvents

...which I think does the same thing as this one:

ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.ClearCodeClipboard").Execute

...but that last pair just don't sound that useful.  There may be something similar for the main Inventor application, but I can't remember right now.  I know about the codes for importing the main application options, and the settings for 'use Inventor settings', as apposed to 'use Autocad settings', but I don't know if messing with them would cause any different 'memory dump & reload' type reaction.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes