Whether you want to script short helper functions in Pixyz Studio or advanced data preparation scenarios for Pixyz Scenario Processor, this document should help you get started or improve your knowledge.
In this document, we'll use Pixyz Studio as our main framework and IDE but please note that Pixyz Python API is transversal to all compatible products (Pixyz Studio, Pixyz Scenario Processor, Pixyz Batch (deprecated),...).
<aside> ℹ️ When using your prefered IDE for development you will suffer from lack of autocompletion. Have a look at our custom workaround to generate static autocompletion libraries for Visual Code, Sublime or PyCharm.
All API functions are listed in the API Reference, but also directly in Pixyz Studio Function List. This tool is particularly useful to find methods from keywords, go to their documentation and access parameters and returned types, but also to copy/paste Python code:
Consider that anything doable via a human interaction in Pixyz Studio is doable through the API.
To understand the logic of Pixyz scripting you must understand the structure behind it:
Pixyz entity structure (simplified)
Entities are abstract objects defined by an integer id (meaning that an occurrence, a material or a component will all have an id). Each id is unique and most functions take this id or a list of ids as input. Some functions such as
core.listProperties take all types of entities as input: meaning that you'll use the same function to access an occurrence, a material or a part property:
core.getProperty(3, 'Visible') → 'Inherited'
core.getProperty(15, 'color') → '[0, 1, 1, 1]'
eval(...) to convert the returned string value of getProperty into a list (e.g for the color property) or a list of list (e.g for the Transform property).
Occurrences are the nodes in the product structure, they can have children and prototypes. Most of the optimization functions take an occurrence or a list of occurrences as input functions. For example:
algo.tessellate(, ...)will apply on all children of