Scripting with Python in DELTAGEN

Starting with 3DEXCITE DELTAGEN 2020x a Python-based scripting interface has been introduced. It aims to automate several of the steps, which an operator has to manually execute during his day-to-day business. At a higher scale, it allows batching the entire pipeline required to generate a master model. This includes the CAD data conversion, Tesselation, Jacketing, Unwrapping, Metadata enrichment, Variant Creation etc...  This post kicks off a series explaining best practices on how to use Python efficiently with DELTAGEN.

First, let us examine the different contexts, in which you can execute scripts:

  1. Directly via the script editor in DELTAGEN
  2. As post-conversion step in the DELTABATCH Configurator
  3. Directly by passing it to DELTABATCH

The direct execution in DELTAGEN is best suited for developing and testing. Via the built-in script editor, you can easily write and run your scripts. The provided code snippets help to understand how the basic functions will be used. In your custom library, you can organize your scripts in virtual folders.

Expert users probably prefer to use a more advanced editor. Therefore, an option in the context menu has been introduced to open a script in an external editor. The editor of choice can be defined via the preferences.

Script editor preferences

Open in external editor​​​​​


A second alternative for executing python scripts is available in the DELTABATCH configurator: You can specify a script, which is applied for every file that is processed. As usual, the conversion is done using the provided parameters. Before the converted file is written to disk, the passed script is executed. Like this, you can add custom behavior, which goes beyond the fixed pipeline defined by DELTABATCH.

Python script as Postprocessing step in DELTABATCH Configurator

Full flexibility is given if the entire pipeline is described via a python file. It is executed by passing the path to the python script as command line parameter to rttDELTABATCH.exe. Since DELTABATCH is a console application requiring no user input, it can run overnight in the background or on dedicated server machines.

A python script passed to DELTABATCH via the command line

After explaining the basics of how to run a script, we will focus future posts on the DELTAGEN modules and functions.

 ​​​​​​​PYTHON ​​​​​​​SCRIPTING