Configuring the Automation Script Adapter With a Python Script

You can select a Python script to run with the Automation Script adapter.

See Also
About the Automation Script Adapter
Shareable Licenses
In Other Guides
Automating Tasks Using Macros
  1. From the 3DEXPERIENCE Operations section of the action bar, click Automation Script , and drop it on the process diagram.
  2. Double-click Automation Script on the process diagram to open the Automation Script Editor.
  3. From the Script Type options, select Python.
  4. From the Select Object options, select one of the following to specify the object on which the automation script operates.
    OptionDescription
    Content

    Lets you select an object (such as a physics simulation or physical product) that is already a part of the simulation process.

    Click to search and select an object to add to the simulation process as referenced content.

    Tip: Do not select an object if the script creates an object, such as a part, and saves it on the 3DEXPERIENCE platform.
    Parameter Lets you select an object parameter that refers to the object.

    Click to search and select an object to refer to in an object parameter.

  5. From the App to open options, select the app in which you want to run the script.

    Note: The list of apps is controlled by the licenses that are active in your authoring session. If you do not see the required app, go to the Shareable Products page in Me > Preferences to select the required licenses.

  6. From the Select Python Script options, select the Python script.
    OptionDescription
    Content

    Lets you select a document that refers to the script.

    Parameter Lets you select an object parameter that refers to the document.

    Click to search and select a document for the app to refer to in an object parameter.

  7. If you selected Content, specify the document using the following options:
    OptionDescription
    Searches and selects a document to add to the simulation process as referenced content.
    Adds a non-versioned simulation document from your local directory.

    Adds a versioned simulation document from your local directory.

    Adds a referenced document from your local directory.
  8. Enter the name of the Python file in the simulation document for the File name.

    Tip: You can enter wildcard characters, such as *.py.

  9. Optional: Select Capture object in, and select an object parameter from the list or create a new 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.
  10. Optional: In the Consider Execution Failed If section, configure the conditions that indicates whether the script failed.

    If you do not select any of the options, the adapter considers the script successful regardless of its exit status. However, the adapter fails if it cannot find the script.

    1. Select Return code is other than 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).)

    2. Select There is output to the Standard Output stream to automatically have the adapter fail execution and stop the process flow if the script writes any data to the standard output stream (stdout).
    3. Select There is output to the Standard Error stream to automatically fail the adapter execution if the script writes any data to standard error stream (stderr).
  11. Optional: In the Log Output section, configure the following options to determine any additional output written to the job log:
    1. Select Log Standard Error to capture and redirect any messages that the program writes to the standard error stream (stderr) into the job log.
    2. Select Log Standard Output to capture and redirect any messages that the program writes to the standard output stream (stdout) into the job log.
    3. Enter a value for the Log at most, which is the maximum number of lines of stdout and stderror to be recorded in the job log before the Automation Script adapter finishes running.
  12. From the Licensing options, select one of the following:
    OptionDescription
    Use Named User Licenses Enables access to a license tied to a specific user for at least 30 days, ensuring dedicated availability but limiting concurrent use across multiple machines.
    Use Shareable Licenses Allows dynamic allocation of a license to any user sequentially, optimizing resource usage for parallel automation workflows in on-premises environments.
  13. Click OK.