Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a iLogic rule that exports ilogic rules from the current file.
I'm trying to make this an AddIn so we can source control our rules with Git.
I can't seem to get the rules to export. I've got the file dialogue to select the output directory, but nothing happens when I click ok.
Dim oDoc As Document
oDoc = g_inventorApplication.ActiveDocument
Dim oFolderDlg As FolderBrowserDialog = New FolderBrowserDialog()
If oFolderDlg.ShowDialog() = DialogResult.OK Then
Dim sFolderPath As String = oFolderDlg.SelectedPath
Dim oiLogicAddin As ApplicationAddIn
oiLogicAddin = g_inventorApplication.ApplicationAddIns.ItemById("{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}")
Dim oiLogicDoc = oiLogicAddin
oiLogicDoc.Activate()
Dim iLogicAuto = oiLogicDoc.Automation
Dim rules As ObjectCollection
rules = iLogicAuto.GetRules(oDoc)
For Each oRule In rules
Dim iLogicVBCode As String = oRule.Text
Dim iLogicFilePath As String = System.IO.Path.Combine(sFolderPath, oRule.Name & ".vb")
System.IO.File.WriteAllText(iLogicFilePath, iLogicVBCode)
MsgBox("iLogic rule " & oRule.Name & " exported to " & iLogicFilePath)
Next
End If
Solved! Go to Solution.