OK. I've created the two button version, where both the rules and the form are local (saved within the drawing document). These should work if the rules are external and form is global form too, if set up right.
Rule 1 (I named it "Shop Drawings")
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
Return
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSStyle As DrawingStandardStyle = oDDoc.StylesManager.StandardStyles.Item("A._Shop_Drawing.")
oDDoc.StylesManager.ActiveStandardStyle = oSStyle
InventorVb.DocumentUpdate()
Rule 2 (I named it "Other Drawings")
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
MsgBox("This rule '" & iLogicVb.RuleName & "' only works for Drawing Documents.",vbOK, "WRONG DOCUMENT TYPE")
Return
End If
Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSStyle As DrawingStandardStyle = oDDoc.StylesManager.StandardStyles.Item("B._Others.")
oDDoc.StylesManager.ActiveStandardStyle = oSStyle
InventorVb.DocumentUpdate()
As for the Form:
- After you have created both of the above rules. Create a new Form.
- In the upper-left pane of the Form Editor, select the Rules tab.
- Now drag both of your rules over onto the Form Editor's right side pane.
- Now, in that upper-right pane, select and change "Form 1" (or Form 2, etc.) to whatever you want to call your form.
- This will be the visible name of the form on the Forms tab of your iLogic browser pane.
- With that top row in the upper-right pane selected (but not still editing the name), change the "Predefined Buttons" setting (in the lower-right pane) to None (to simplify, since we already have two buttons for the rules).
- Now select the first rule line item (in the upper right pane), and change its "On Click Action" setting (under "Behavior" properties) to "Close and then Run Rule".
- Do the same for the second rule line item.
- Now, if you want, for clarity, you can drag a "Label" from the lower-left pane, over just above the two rule buttons, and change its text to say something like "CHOOSE DRAWING TYPE".
Now your form editor (and form) should look something like the image below.
Now click OK on the Form Editor.
Now you should be able to click on that form on your iLogic Forms tab, and it will launch a form similar looking to the one above, and when you click one of the buttons, it will run the associated rule, which will change the Active drawing standard style to the one you want.
I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.
Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.
- Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
- Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
- Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
- Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
- Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
- SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
- Create DocumentSubTypeEnum Click Here
- Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here
Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)