Advanced iLogic Configuration

Advanced iLogic Configuration

Anonymous
Not applicable
2,122 Views
4 Replies
Message 1 of 5

Advanced iLogic Configuration

Anonymous
Not applicable

Is there any way to access the API (or otherwise use iLogic) to import one of these xml configuration files? I have multiple assemblies that require different external rules and I want the selection of external rules to change based on which assembly is open.

 

Capture.JPG

 

0 Likes
Accepted solutions (1)
2,123 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution

After ignoring the problem for months I finally came up with a solution:

 

 

When inventor launches, the location of the external rules directory is loaded. Where is that information stored? It’s not located in C:\Users\*username*\AppData\Local\Autodesk\Inventor 2016\iLogicPreferences. I know this because inventor doesn’t read that file every time it starts up. It’s also not stored in the application options configuration. That must mean that it is a configuration file located somewhere else since it is very unlikely that the location is stored in the windows registry.

 

Running off of that assumption I found a file named “iLogicOptions.xml” in C:\Users\*user*\AppData\Roaming\Autodesk\Inventor 2016\iLogicPreferences. In this file is the setting that locates the external rules directory that Inventor reads when it opens. That file is appended each time you close inventor or update the options. And it is re-read each time you open the iLogic Configuration box.

 

 

I now have a solution:

  1. Have inventor create/edit the .xml file
  2. Launch the ilogic Configuration menu
  3. Tell windows to press Enter


    SyntaxEditor Code Snippet
    myname = ThisApplication.GeneralOptions.UserName
    'MsgBox(myname)
    iLogicPath = "C:\Users\" & myname & "\AppData\Roaming\Autodesk\Inventor 2016\iLogicPreferences\"
    
    '____Create and write to a text file_________________
    oWrite = System.IO.File.CreateText(iLogicPath & "iLogicOptions.xml")
    oWrite.WriteLine("<?xml version=""1.0"" encoding=""utf-8""?>")
    oWrite.WriteLine("<ShareableOptions xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">")
    oWrite.WriteLine("  <ExternalRuleDirectories>")
    oWrite.WriteLine("    <string>Path1</string>")
    oWrite.WriteLine("    <string>Path2</string>")
    oWrite.WriteLine("  </ExternalRuleDirectories>")
    oWrite.WriteLine("  <ExternalRuleFilenames />")
    oWrite.WriteLine("  <ExternalRuleDefaultExtension>.iLogicVb</ExternalRuleDefaultExtension>")
    oWrite.WriteLine("</ShareableOptions>")
    oWrite.Close()
    
    
    'System.Threading.Thread.CurrentThread.Sleep(3000) 'Just in case the server is running slow and trying to catch up
    
    Dim oControlDef As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.Configuration")
    oControlDef.Execute2(False)
    
    
    InventorVb.RunMacro("DocumentProject", "Module1", "PressEnter")

 

Here's the VBA Macro. I use the AppActivate command just in case the user changes the focus from Inventor to another program because the SendKeys command executes in whatever application is activated. And the default focus button in the iLogic Configuration menu is "OK".

 

Sub PressEnter()

     AppActivate "Autodesk Inventor 2016"
     SendKeys "{Enter}"

End Sub

 

 

 

 

0 Likes
Message 3 of 5

Jon.Balgley
Alumni
Alumni

Also check out the API described in this thread:

 

https://forums.autodesk.com/t5/inventor-customization/external-rules-directory-thru-api-in-inventor-...

 

 


Jon Balgley
Message 4 of 5

Maxim-CADman77
Advisor
Advisor
Our company's corporate policy requires shared network folders be referenced in two settings of Advanced iLogic Configuration:
1. Location of External Rules
2. Location of iLogic Add-In DLLs
But I see no possibility to set network folder for setting 1 manually in Inventor 2019.2 (while there is no such problem for setting 2).
There is no such problem in Inventor 2014, either.
This doesn't seem like have been done deliberately, right?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 5 of 5

Maxim-CADman77
Advisor
Advisor
Have just succesfully added network location by editing corresponding line of C:\Users\<LOGIN>\AppData\ROAMING\Autodesk\Inventor 2019\iLogicPreferences\iLogicOptions.xml outside the Inventor 2019.2 (with Notepad.exe)

Please vote for Inventor-Idea Text Search within Option Names

0 Likes