- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello. Fairly new to Inventor iLogic, but long time draftsperson and decent exposure to code. My work's drawing template has an iLogic Rule written by someone else who is no longer here and I would like to edit it.
The Rule is triggered by Saving the Document and after it runs, it puts you on the Last Sheet of the Document. I am trying to make it return you to the Current Sheet you are on when the Rule fires. It is very annoying to be actively working on 1 Sheet, Save, and then be on a different Sheet.
I imagine the solution is to add something into the existing Rule code, but am open to other solutions.
If it helps, the code itself is to write the Scale of the Base View (we draw with only 1 Part or Assembly per Sheet) to a Text field within a Sketch Symbol label on that Sheet. It does this on every Sheet to catch anything you have added or changed, hence finishing on the last one.
The code:
For Each oSheet In ThisApplication.ActiveDocument.Sheets ActiveSheet=ThisDrawing.Sheet(oSheet.Name) If oSheet.DrawingViews.count>0 And oSheet.SketchedSymbols.Count>0 Then oSymbols=oSheet.SketchedSymbols For Each oSymbol In oSymbols If oSymbol.Name="Drawing Label" Or oSymbol.Name="Drawing Label OPEN" Then oTextBoxes=oSymbol.Definition.Sketch.TextBoxes For Each oTextbox In oTextBoxes If oTextBox.Text="<View Scale>" Then DrawingViewName=ThisApplication.ActiveDocument.ActiveSheet.DrawingViews.Item(1).Name oSymbol.SetPromptResultText(oTextBox, ActiveSheet.View(DrawingViewName).ScaleString) End If Next End If Next End If Next InventorVb.DocumentUpdate()
Thanks in advance for any pointers.
Solved! Go to Solution.