iLogic: Change Triggerset with Project file

iLogic: Change Triggerset with Project file

cmcconnell
Collaborator Collaborator
1,059 Views
5 Replies
Message 1 of 6

iLogic: Change Triggerset with Project file

cmcconnell
Collaborator
Collaborator

I am pretty sure I know the answer to this one.

 

Is it possible to have Inventor change to a different set of iLogic triggers based on which project file I am using?

 

If I have multiple clients, I set up a completely separate environment (templates, project file, styles, content center etc) for each as they all want/require something different.

 

If I set up several Global Triggers for a client A, the work I do for client B may not need the same triggers.

 

Is there a way to manage this without turning off all client A triggers manually and then turning on all client B triggers manually?

 

This seems like the perfect thing to control with the project file - along with the iLogic folder location...

Mechanix Design Solutions inc.
1,060 Views
5 Replies
Replies (5)
Message 2 of 6

JamieVJohnson2
Collaborator
Collaborator
 invApp.SilentOperation = True
        Dim iLogAuto As Object 'Autodesk.iLogic.Interfaces.IiLogicAutomation
        iLogAuto = addin.Automation
        iLogAuto.CallingFromOutside = True
        iLogAuto.EnterDelayedRuleRunningMode()
        Dim newRule As Object = iLogAuto.AddRule(ClearanceModel, "ClearanceCalcs", "")
        newRule.text = strRuleClearanceCalcs
        iLogAuto.ExitDelayedRuleRunningMode()
        iLogAuto.RulesOnEventsEnabled = True
            AssignRuleToILogicEvent(ClearanceModel, "ClearanceCalcs", "BeforeDocSave0", 700)
        invApp.SilentOperation = False

Using VB.Net to write an Add-In or standalone program, you can write a routine that adds iLogic, and iLogic Events.

Here I am adding my ClearanceCalcs iLogic to a ClearanceModel (assembly file) and then to its BeforeDocSave event.

 

So, I'm curious, is this the answer you expected?

Jamie Johnson : Owner / Sisu Lissom, LLC https://sisulissom.com/
0 Likes
Message 3 of 6

cmcconnell
Collaborator
Collaborator

@JamieVJohnson2 wrote: 

So, I'm curious, is this the answer you expected?


Ha! Not quite - I thought there must be a way to do it programatically, but I had no idea how to get it done. I know just enough iLogic to make a mess. 😉

 

Thanks for the start - I will see if I can expand on it to create all of our triggers. I assume it is also possible to remove triggers too? Being VB.net, is it possible to create a trigger from within an ilogic rule?

 

I could build it so that I can select from a drop down which triggerset I want to use.

 

Mechanix Design Solutions inc.
0 Likes
Message 4 of 6

cmcconnell
Collaborator
Collaborator

I just discovered another thing that might be an ok way to manage it.

 

IV uses the first RulesOnEvents.xml it finds.

 

So, this can be used in 1 of 3 ways (maybe more)

  1. I can manually swap out the file as I move from client to client
  2. I can just change the ilogic folder options so that the client I need is at the top of the list
  3. I could write a rule that changes the file out based on a selection or is it possible to read a project file from iLogic?

So, if Autodesk adds a setting to the project file that specifies the ilogic folder (rather than tools>ilogic options) it will solve this problem.

 

Off to the ideas forum....

Mechanix Design Solutions inc.
Message 5 of 6

cmcconnell
Collaborator
Collaborator
0 Likes
Message 6 of 6

chandra.shekar.g
Autodesk Support
Autodesk Support

@cmcconnell,

 

Hoping that code injector (refer below link) would help to manipulate iLogic events. Code injector is VB.net windows application which shows creation of iLogic rule and adding same rule to iLogic events to trigger.

 

https://inventorlogicblog.wordpress.com/2016/04/20/autodesk-inventor-ilogic-create-a-new-ilogic-rule...

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes