You can use Python as an internal scripting language.
Before you begin: If you want to use external Python libraries, specify the
preference pages as follows:
From the AppPreferences in the 3D Modeling > Multidiscipline Automated Engineering > Basics > Python Scripts section of the Preference Pages, select
Enable the use of external Python packages.
Select the file directory where the installed external Python packages are stored.
Note:
If the directory is changed or deactivated, you need to restart the
session.
If you want to increase the security level, specify the preference pages
as follows:
From App > Preferences > Parameters, Measures, and Units > Parameters > Script Security Management, select one of the following options based on your required security level:
Context: The Python programming language complements EKL scripting. EKL
binding offers significant interoperability with EKL types and APIs. It is possible to import
external Python libraries in the Preferences.
From the Compass, click and enter Engineering Rules Capture to start the app.
From the action bar,
click Python Script.
The Python Script Editor opens and is composed of five main
areas:
Argument list.
Python editor.
Actions.
Output.
OK and Cancel.
Note:
The data defined in the Python Editor is stored in a
specific feature in the tree and is named Python Script. It is aggregated to the
Relations node and is deletable.
Optional:
Specify an argument as input for PLM objects and features by specifying a name, EKL
type, and nature such as In, Out, or InOut.
Note:
The editor is equipped with syntax coloration for the Python
language.
Click Run to execute the script.
Note:
If one or more arguments was specified, a new selection panel appears for input
cases. There are two input selection modes: manual and automatic. You can use a filter
to select only the input with the right type.
Manual selection requires you to individually select each input followed by the
associated target.
Automatic selection requires you to select one target after another.
Once you rerun the script, the input selection panel is emptied.
The Output section of the Python Script Editor displays the
outcome.
Click OK to save the editor data in a specific feature and to
close the editor.