Isotropix Forums

parse the output of get_rotation_order()

Clarisse Scripting related topics

parse the output of get_rotation_order()

Unread postby bvz2000 » Tue Jun 12, 2018 2:17 am

I can get the rotation order of an item by looking at its module and using: module.get_rotation_order()

But this returns an integer. How can I map these values back to a string like "zxy"?
bvz2000
 
Posts: 374
Joined: Thu Nov 13, 2014 7:05 pm

Re: parse the output of get_rotation_order()

Unread postby bvaldes » Tue Jun 12, 2018 10:21 am

Hi,

I don't know if there is a proper function, I'm waiting a feedback from the engineers. By the way, all the geometries have an attribute rotation order. This attribute is a list of integers internally and the ENUM are available in python, so I did a little dictionary for you:

python code

rot_ord = {
ix.api.GMATH_ROTATION_ORDER_XYZ: "XYZ",
ix.api.GMATH_ROTATION_ORDER_XZY: "XZY",
ix.api.GMATH_ROTATION_ORDER_YZX: "YZX",
ix.api.GMATH_ROTATION_ORDER_YXZ: "YXZ",
ix.api.GMATH_ROTATION_ORDER_ZXY: "ZXY",
ix.api.GMATH_ROTATION_ORDER_ZYX: "ZYX"
}

box = ix.cmds.CreateObject("box", "GeometryBox")
print rot_ord[box.get_module().get_rotation_order()]

With this tricks you can get the result you want but maybe the engineers will get a better solution.

EDIT: I am still waiting a feedback from the engineers but Sam said to me that the enums were available so I replace the int values by the enums.

EDIT2: The function exists: gmath_get_rotation_order_name(int). Example:

python code

box = ix.cmds.CreateObject("box", "GeometryBox")
ix.api.gmath_get_rotation_order_name(box.get_module().get_rotation_order())
# Return => GMATH_ROTATION_ORDER_ZXY

Best regards,
Benoit
Benoit VALDES
Isotropix
Clarisse QA
User avatar
bvaldes
 
Posts: 238
Joined: Mon Sep 26, 2016 11:44 am

Re: parse the output of get_rotation_order()

Unread postby bvz2000 » Tue Jun 12, 2018 7:12 pm

I should have seen that. Thanks!
bvz2000
 
Posts: 374
Joined: Thu Nov 13, 2014 7:05 pm


Return to Scripting
cron