Before you begin
Click Application Options File, and in Default VBA Project, note the name and location of the IVB file.
Default.ivb is an empty macro file (IVB) that is created the first time that you access the Visual Basic Editor. Any macro placed into this file loads on startup.
Create custom macro
- To begin, in Microsoft Windows Explorer, navigate to the location specified in the Application Options, File tab, default VBA project, and copy and extract Rotate.ivb.
Note: If needed, create the folder as specified in the Application Options, File tab, for the default VBA project.
- In Autodesk Inventor, click
Tools tab
Options panel
VBA Editor
.
- In the Visual Basic Editor (VBE), select File Load Project, and browse to the previously mentioned location. Select Rotate.ivb, and click Open.
Next, copy the Rotate.ivb code into the default.ivb.
- In the VBE, expand the plus sign (+) next to Rotate.
- Drag the icon next to Module1 (in the Rotate folder), and drop it on top of the default.ivb project.
Note: You can also copy the Rotate code and paste it into the default.ivb window.
The Rotate code copies into the default.ivb file.
- Remove the redundant code by selecting the Rotate.ivb that loaded in Step 3, and then click File Unload Project.
- Click Save to save the changes to default.ivb and close the VBE.
You can also create icons to run macros that exist in your default.ivb.
Run Macro command
- Open a part (.ipt) or an assembly (.iam) file containing graphical data.
- On the ribbon, click
Tools tab
Options panel
Macros
.
- In the Macros dialog box, click Rotate Camera, and click Run.
Create a macro command
- You can make icons for your macros to display on the User Defined panel on the ribbon. First, create a BMP image of the icon using a graphic program such as Microsoft Paint. Create small icons 16 high x 16 wide pixels and large icons (if applicable) 32 x 32 pixels.
- Save the icons to the same location as the ivb. file (as specified in Application Options).
- Name the icons using the following naming scheme: ModuleName.SubName.Size.bmp.
ModuleName is the name of the module in the macro, SubName is the subroutine name, and size is either Small or Large. For example, the .bmp file that is used for the Rotate macro is: Module1.RotateCamera.Small.bmp.
Next, assign the .bmp file to a user-defined panel in Autodesk Inventor.
- Right-click the ribbon, and choose Customize User Commands.
- In the Customize User Commands dialog box, click the drop-down arrow, and click Choose commands, Macro. The Macros that are in your default.ivbfile display in the left pane.
- Select the macro to add to the User Defined panel, and click Add.
-
The macro displays in the User Defined panel on the ribbon.
Note: If the macro displays as an infinity symbol, then the BMP is either in the wrong location, named incorrectly, or is not sized correctly.
- Click OK.
- To run the macro, in the graphics window, select an object, and click RotateCamera.