- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been seeing a few rather large posts about having logic set your event trigger but all of the posts are very clearly over my head
I have this to insert a rule into my assembly
Dim oRuleName As String = "Master_Parts_List_Assembly" Dim oTxtFileName As String = "C:\_VAULT_WORKSPACE\JOBS\FAB\Ilogic Rules\External Rules\Referenced Rules\Run a Specific Rule in all parts (REF).txt" Dim oRuleText As String = IO.File.ReadAllText(oTxtFileName) Dim oDoc As Document = ThisApplication.ActiveEditDocument Dim oRuleExists As Boolean = False Dim iLogicAuto = iLogicVb.Automation iLogicAuto.RulesEnabled = True iLogicAuto.RulesOnEventsEnabled = True Dim oRule As iLogicRule Try oRule = iLogicAuto.GetRule(oDoc, oRuleName) oAns = MsgBox("A Rule named '" & oRuleName & "' already exists." & vbCrLf & "Its Text = " & vbCrLf & oRule.Text & vbCrLf & "Do you want to replace its text?", vbYesNo + vbQuestion,"") If oAns = vbNo Then Return '(or Exit Sub) Catch oRule = iLogicAuto.AddRule(oDoc, oRuleName, "") End Try oRule.Text = oRuleText iLogicVb.DocumentUpdate oDoc.Save
The that code will insert this into my assembly
Dim oDoc As AssemblyDocument = ThisDoc.Document 'define the ilogicAutomation Dim iLogicAuto As Object iLogicAuto = iLogicVb.Automation Dim oRuleName As String = "Master_Parts_List" Dim oRule As Object For Each doc As Document In oDoc.AllReferencedDocuments On Error Resume Next oRule = iLogicAuto.GetRule(doc, oRuleName) 'run the rule iLogicAuto.RunRuleDirect(oRule) Next
I am trying to have the other designers simply run a external rule in a assembly then another in a part to link our parts to a excel Bill of Material
I seen some lengthy chunks of code that revolve around something like this
("Master_Parts_List_Assembly", "BeforeDocSave0", 700)
I just cant figure out how to have a very simple code that just adds the Master_Parts_List_Assembly rule to a before document save. I dont need multiple runs just a simple run this before a save
any help would be appreciated
Solved! Go to Solution.