Select the Object
You can select the 3DSpace object on
which the 3DX Script will operate and the app in which the 3DX Script will run.
-
From the Utilities section of the action bar,
click 3DX Script
, and drop it on the
process diagram.
-
Double-click 3DX Script
.
The 3DX Script Editor appears.
-
Select the 3DSpace
object on which the 3DX Script will operate, such as a part.
You can search for an object or choose an object parameter that refers to the
object.
You can leave this field blank if the script creates an object, such as a part, and
saves it in the 3DEXPERIENCE platform. If required, you can use an object parameter to refer to the object in another
script adapter.
-
From the list of apps, you must select the app in which the script will run, such as
the Part Design app.
Note:
The list of apps is controlled by the licenses that are active in your authoring
session. Before launching Optimization
Process Composer, use the Shareable Products page in to select the required licenses.
Configure a VBScript Macro
You can select a VBScript macro to run with the 3DX Script adapter, and you can
configure the arguments that are passed to the macro.
-
From the Utilities section of the action bar,
click 3DX Script
, and drop it on the
process diagram.
-
Double-click 3DX Script
.
The 3DX Script Editor appears.
-
From the Script Type menu, select VB
Script.
-
Select the object on which the script will operate and the app in which the script
will run.
Note:
The list of apps is controlled by the licenses that are active in your authoring
session. Before launching Optimization
Process Composer, use the Shareable Products page in to select the required licenses.
-
From the top of the VBScript Macro Options, click
Select.
-
From the list of VBScript macro libraries that appears, select the library containing
the macro that will operate on the selected object.
-
Enter the name of the module containing the macro.
-
Enter the name of the function or macro.
-
Map the parameters that are passed as arguments into the function.
-
Select a parameter, or create a new parameter.
Parameters of type Integer, Real, String, and Boolean are supported.
-
Click Add argument to add the parameter to the list of
arguments to be passed to the function.
The parameter appears in the table of arguments.
-
Use the Function arguments table to reorder the parameters or
to delete a parameter.
Parameters appear in the table in the same order in which they are passed into the
function.
-
Select Capture object in and select or create an object
parameter.
The object parameter captures the last object opened by the script, regardless
of whether the script created the object or modified the object. The object parameter is
automatically saved when the script completes. You can also include save commands in
your script to save objects.
-
Select Capture object in and select or create an object
parameter.
The object parameter captures the last object opened by the script, regardless
of whether the script created the object or modified the object. The object parameter is
saved when you save the simulation process; objects created or modified by the script
are not saved.
-
Select the shareable licenses required.
-
Click Ok to save your changes and to close the 3DX
Script Editor.
Configure a Python Script
You can select a Python script to run with the 3DX Script adapter.
-
From the Utilities section of the action bar,
click 3DX Script
, and drop it on the
process diagram.
-
Double-click 3DX Script
.
The 3DX Script Editor appears.
-
From the Script Type menu, select
Python.
-
Select the object on which the script will operate and the app in which the script
will run.
Note:
The list of apps is controlled by the licenses that are active in your authoring
session. Before launching Optimization
Process Composer, use the Shareable Products page in to select the required licenses.
-
Select the Python script.
You can search for a referenced simulation document containing the script, or you
can add a simulation document containing the script.
-
Enter the name of the file in the simulation document. You can enter wildcard
characters, such as *.py.
-
Select Capture object in and select or create an object
parameter.
The object parameter captures the last object opened by the script, regardless
of whether the script created the object or modified the object. The object parameter is
automatically saved when the script completes. You can also include save commands in
your script to save objects.
-
In the Consider Execution Failed If area, determine the
conditions that will indicate that the script failed.
If you do not select either of the options, the script will be considered to succeed
no matter how it exits. However, if the script cannot be found, the adapter will
always fail.
Option | Description |
---|
Return code is other than |
If you want to define the return codes for successful completion of the
execution, you can enter multiple return codes separated by commas (for example,
“1,2,5” means consider return codes of 1, 2, or 5 as success) or a range of numbers
separated by a colon (for example, “0:9” means any return code from 0 to 9 inclusive
indicates success.) You can combine the codes to specify multiple ranges (for
example, “0:9, 21:30”). You can also use negative return codes (though few programs
return them.) |
There is output to the Standard Output
stream |
Specify that if the script produces any output to standard output, the run is
considered a failure, and the simulation process flow is ended. |
There is output to the Standard Error
stream |
Specify that if the script produces any output to the standard error stream,
the run will be considered a failure, and the rest of the simulation process flow
will be ended. |
-
In the Log Output area, set the following options to configure
any additional output to the job log:
Option | Description |
---|
Log Standard Error |
If selected, any messages the program writes to standard error stream
(stderror) are also logged to the job log. By default, this option is selected. This
option is useful in determining why the program did not run as expected. |
Log Standard Output |
If selected, any messages to standard output stream (stdout) are also sent to
the job log. Selecting this option is not recommended because many programs can
produce a lot of output, and log messages are relatively expensive. |
Log at most |
The maximum number of lines of stdout and stderror to be recorded in the job
log before execution of the 3DX Script adapter ends. The stdout and stderror
messages are written to the job log after the Python script has finished running but before the execution of the 3DX Script adapter
ends. Note:
All stdout and stderror messages are always redirected to their
respective files (pythonScriptExecuteLog.txt and
pythonScriptExecuteErrorLog.txt) in the execution
directory.
|
-
Select the shareable licenses required.
-
Click Ok to save your changes and to close the 3DX
Script Editor.
|