-
From the Compass, click 3D Modeling
Apps
and select Engineering Rules Capture.
-
Click
Visual Basic Action
.
-
Enter arguments in the box located between the parentheses and
click
OK to add the macro to the document.
The arguments must always be separated by a comma.
A VB Scripts subnode is added to the
tree
below the
Relations node. A VB Script object is added below
this subnode.
-
In the
Visual Basic Action Editor, enter your script.
-
Right-click VB Script.1 and select
VB Script.1 object > Run.
The
Select Inputs for Script Arguments window
appears.
-
Select the arguments in the geometry or in the
tree
and click
OK to run the script.
Notes:
- You may also create a Visual Basic Action by clicking the relation defined in the tree and
clicking Visual Basic Action
.
- Macros with arguments are features that can be stored in 3D Shapes and in knowledge
engineering specifications and that can be called from a rule (VBScriptRun) or
a reaction. In this
case, arguments are passed from the rule.
- The VB script features with arguments are provided with a
context menu
enabling you to launch the script.
Example
In this example, you are going to create two String type parameters to
a 3D Shape.
- From the Compass, click 3D Modeling
Apps
and select Engineering Rules Capture.
- Click
Visual Basic Action
.
- In the
Visual Basic Action Editor, copy/paste the
script below:
Dim knowlObjs as KnowledgeObjects
Set knowlObjs = selectedObject.GetItem("KnowledgeObjects")
Dim oParams As ParmsSet
Set oParams = knowlObjs.GetKnowledgeRootSet(TRUE, 0)
Dim strParam1 As StrParam
Set strParam1 = oParams.Factory.CreateString("FirstName", "")
Dim strParam2 As StrParam
Set strParam2 = oParams.Factory.CreateString("LastName", "")
End Sub
- Enter the selectedObject argument in the box located between the
parentheses and click OK to add the macro to the
document.
A VB Scripts subnode is added to the tree below the Relations node.
- Expand the VB Script subnode.
- Right-click VB Script.1 and select
VB Script.1 object > Run.
- Select the 3D Shape and click
OK to run the script.
The two String type
parameters are added to the
document.