Rosenthal
Rosenthal

Reputation: 149

Convert class to Python list

I can't convert a simple [0, 20, 0, 20, 0, 20] to a list.

Code:

geo = hou.pwd().geometry()

print geo.boundingBox()
print type(geo.boundingBox())

Output:

[0, 20, 0, 20, 0, 20]
<class 'hou.BoundingBox'>

Test:

list(geo.boundingBox())
len(geo.boundingBox())

I get the following error:

object BoundingBox is not iterable.
Object of type 'BoundingBox' has no len()

I read all the related questions but they don't seem to solve my problem.

Upvotes: 3

Views: 16835

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798814

Vector3s can be converted to list since they implement item access methods.

list(geo.boundingBox().minvec()) + list(geo.boundingBox().maxvec())

Upvotes: 3

Related Questions