Forums Technical subjects Patchwork 3D – R&D and Roadmap Patchwork 3D 2022 – Scripting API improvements

Author Posts



Patchwork 3D 2022 will bring new functions to improve P3D Data API covering.

The first improvement I am talking about today is the possibility to create or read mesh data.
You can create a new surface from mesh data (vertices, normals, uvs,  and vertices indices)
or read mesh data from existing surfaces.

This example shows how to create a plane primitive in a new geometry layer

with this fonction to create the mesh data for the plane :


=> This offers new possibilities to develop geometry translators, and automate imports using scripting, or develop interop plugins in modelisation or CAD software.

An example of the possibilities of this API is the AliasToP3D plugin we are developing. More information in this post




The second improvement I am talking about today is the configuration API

You can now browse or edit configuration rules and targets
=> the configuration could be automatically generated from well organized layers for example

You can also browse configuration parameters and values
=> This could help to automatically generate camera hierarchy to prepare configuration thumbnails for Lumis or Accel VR (example below)


Finally, The selection API have been added, leading to new possibilities for your scripts :

You can choose to execute a script only on selected surfaces
Or on the other hand, you can select surfaces at the end of the script, to highlight updated surfaces, or to select filtered surfaces in case of filtering script.

For example, this script selects in Shaper every surface with a “GLASS*” material assigned on the active aspect layer.

Look at the result on this car :

Then with Shift+R to hide unselected surfaces :





The scripting API has been extended to include User Interface (UI) creation.
With this new API you can easily ask input values in your scripts!

Here is a small example:

Which gives this result:

As you can see, with just a few lines of code, you can make your scripts more user friendly and interactive. For more advanced users it is also possible to receive events (for example text changes, button click) to do custom actions.

  • You must be logged in to reply to this topic.