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.

Tools

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.

</aside>

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:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/14371383-b0f6-4998-be9c-8315f09b8ff4/Untitled.png

Structure

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)

Pixyz entity structure (simplified)

Entities

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.getProperty , core.setProperty, or 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(3, 'Visible') → 'Inherited'

core.getProperty(15, 'color') → '[0, 1, 1, 1]'

core.getProperty(15, 'color') → '[0, 1, 1, 1]'

<aside> ℹ️ Use 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).

</aside>

Occurrences

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: