 |
A macro is a series of functions, written in a scripting
language, that you group in a single command to perform the requested task
automatically. You can for example use a macro to automate the generation
of an automatic path finding. |
 |
This task shows how to use the automatic path finding
functionality in batch mode, which means you are going to record an
interaction sequence in a macro. This task also lists the macros
that can be edited. |
 |
Open the
mastervac.CATProduct document. |
 |
-
Select Tools > Macro > Start Recording.
The Record macro dialog box appears. |
 |
-
In the Record macro dialog box, specify the
current macro library or document.
This means deciding where the macro is going to be stored:
- in a macro library: the macro will be stored
in a directory (or a VBA project if it exists)
- in a document: the macro will be stored in
the current document.
|
-
Give a name to the macro, e.g., MacroPF.CATScript.
-
Click Start to begin recording the macro.
-
In the specification tree, select Simulation.1.
-
Click Path Finder
from the DMU Check toolbar.
-
Set the options in the Path Finder dialog box
as displayed.
-
Click Apply to launch the operation.
-
When done, click OK to smooth the path result.
-
When this is complete, click Stop in the
Stop Recording dialog box, or select Tools > Macro > Stop
Recording .
Your macro is now ready for replay. |
The macro looks like this: |
MACRO |
EXPLANATIONS |
Language="VBSCRIPT"
Sub CATMain()
Dim FittingWorkbench0 As Workbench
Set FittingWorkbench0 = CATIA.ActiveDocument.GetWorkbench ( "FittingWorkbench"
)
Dim PathFinder1 As PathFinder
Set PathFinder1 = FittingWorkbench0.PathFinders.Add ( "PathFinder"
) |
|
PathFinder1.set_SimulationByName "Simulation.1" |
Name of the simulation selected. |
PathFinder1.set_DoubleParameter
"Accuracy", 14.758000 |
Corresponds to the accuracy value
chosen in the Path Finder dialog box.
 |
PathFinder1.set_DoubleParameter "TranslationStep&qu |
Corresponds to the translation step value chosen
in the Path Finder dialog box.
 |
PathFinder1.set_DoubleParameter "RotationGain",
2.000000 |
Corresponds to the rotation gain
valuechosen in the Path Finder dialog box.
 |
PathFinder1.set_IntegerParameter "Repulse", 5790 |
|
PathFinder1.set_BoxParameter "Box",
-205.110550, -1115.599648, -341.661041, 918.198769,
460.187050, 694.402138
PathFinder1.Compute |
You resized the bounding box : the
new values are displayed.
 |
PathFinder1.FillSimulation |
Insert the above result into the simulation |
FittingWorkbench0.PathFinders.RemovePathFinder PathFinder1 End
Sub |
|
|
-
Open the
MacroPF.CATScript document.
|
|
Parameters You Can Edit
|
|
Parameter Name
|
Default Value |
Method |
Macro
|
Example |
MaxTime |
60 min |
|
can be added to the macro |
|
Accuracy |
_ |
PathFinder1.set_DoubleParameter "Accuracy",value |
can be edited |
PathFinder1.set_DoubleParameter "Accuracy", 14.758000 |
TranslationStep |
_ |
PathFinder1.set_DoubleParameter "TranslationStep",value |
can be edited |
PathFinder1.set_DoubleParameter "TranslationStep",
14.758000 |
RotationGain |
1.0 |
|
can be edited |
PathFinder1.set_DoubleParameter "RotationGain", 2.000000 |
Repulse |
High |
PathFinder1.set_IntegerParameter "Repulse",value |
can be edited |
PathFinder1.set_IntegerParameter "Repulse", 5790
|
Box |
_ |
PathFinder1.set_BoxParameter "Box",values |
can be edited |
PathFinder1.set_BoxParameter "Box", -205.110550, -1115.599648,
-341.661041, 918.198769, 460.187050, 694.402138 |
VisuMode |
do not appear in the macro. |
Steps |
|
|