What changed

In continuation of the 2019 breaking API changes, Pixyz Studio and Pixyz Batch 2020 Python API becomes more typed and structured.

In 2019, Pixyz types variables were represented as lists. They are objects in 2020.

Example: get a bounding box center

2019

# aabb variable is a list containing 2 lists of 3 ints
# representing max and min points x, y, z coordinates
aabb = scene.getAABB(occurrences)

max_point = aabb[1]
min_point = aabb[0]

aabb_center = [(max_point[0] + min_point[0])/2,\\
	(max_point[1] + min_point[1])/2,\\
	(max_point[2] + min_point[2])/2]

2020

# aabb variable is an AABB object
# <https://www.pixyz-software.com/documentations/html/2020.1/studio/api/GeomTypes.html#AABB>
aabb = scene.getAABB(occurrences)

# Get max and min points by getting .high and .low attributes
max_point = aabb.high
min_point = aabb.low

# Use Point3 as a constructor
# <https://www.pixyz-software.com/documentations/html/2020.1/studio/api/GeomTypes.html#Point3>
aabb_center = Point3((max_point.x + min_point.x)/2,\\ # 
	(max_point.y + min_point.y)/2,\\
	(max_point.z + min_point.z)/2)

Migration guide (from 2019.2)

Typed variables will raise non subscriptable TypeError issues:

**File "<string>", line 6, in <module>
TypeError: 'AABB' object is not subscriptable**
  1. Find the object Type documentation page (e.g AABB)

  2. Check the definition:

    https://s3-us-west-2.amazonaws.com/secure.notion-static.com/31b81c0a-2b2a-4d18-934a-6446c4810952/Untitled.png

  3. Replace [0] by the first attribute, [1] by the second one etc:

    aabb[0] => aabb.low
    aabb[1] => aabb.high