Please enable JavaScript to view this site.

Knowledge Bridge Documentation

Help version: 3.3.8

 

Description

Executes an Inventor macro. The macro can be external or embedded in the document.

 

Mixins

InvObjectMixin

 

RULE NAME

DESCRIPTION

TYPE

DEFAULTS

CATEGORY

FLAGS

invExecuteMacro

Fully qualified name of the macro to be executed.

For example:
"thisDocument.changeParam"

String

""

 

Inventor

Cached
Parameter

Required

invProjectPath

Full file path to an external macro file.

String

""

 

Inventor

Cached
Parameter

 

kBridgeExamplesIcon

Project Example

In your kBridge Examples Projects folder open the project called ‘Table_KB_Inventor_Example’.

 

Expand the CombineParts folder , expand the Models folder, right click ‘CombineParts’ and select ‘Load Model…’.

InvMacroExampleProject

 

Reference Location:

"world.combineparts.partsassembly.partsassembly0.myextrudedpart.myextrudedpart0.invmacro.invmacro0"

Link: https://knowledgebridge.engineer/projects

 

InvMacro was dragged into MyExtrudedPart0 from InventorUtilities. and these values were put into the rules:

invExecuteMacro:

"thisDocument.changeParam"


 

invProjectPath:

""

 

Parent.ChildIcon

InvMacro is a child of MyExtrudedPart0

InvMacroAsChild

 

You don’t put your Macro or VBA code in the InvMacro design. Instead, you reference (invExecuteMacro) in the code that you created in Inventor. This example code was created in Inventor by opening ExtrudedPart.ipt, clicking on the Tool tab and selecting the VBA Editor.

 

Expand Autodesk Inventor Professional Objects and click on ‘ThisDocument’. Then write your code in the window on the right and save.

 

Notice the first part of the string for:

invExecuteMacro:                "thisDocument.changeParam"

 

‘thisDocument’ is required before the name of the subroutine (changeParam) separated by a period.

InvMacroExampleInventorKb

 

Code Example

Sub changeParam()

    Dim pd As PartDocument

    Set pd = ThisDocument

    

    Dim mup As UserParameter

    Set mup = pd.ComponentDefinition.Parameters.UserParameters("height")

    

    mup.Value = mup.Value + 10

End Sub

 

Inventor Integration Drawing output

In the first example below, the ‘invExecuteMacro’ value has been set to an empty set ("").

In the second example the value has been set to "thisDocument.changeParam".

InvMacroInventorExamples

 

Knowledge Bridge from Engingeering Intent is a full-featured engineering and sales automation environment