Hi,
you lost me a bit in your workflow description, sorry. I am not really a Cinema user (anymore). But if I understand you correctly, you basically only want to to swizzle the modelling axis, which is pretty easy (the hard part of your request was all the interaction stuff). Below is an example on how you could do that.
For your exact use case you would have to select an edge and then execute the script, the modelling axis of the selected object will then be swizzled. By executing the script multiple times you can cycle through the three possible configurations. The script is neither bound to a specific document mode nor number of selected elements.
Cheers,
zipit
"""Script Manager script.
Swizzles the modeling axis of the selected polygon object when run. As a
side effect the active tool is changed to the LiveSelection tool and set
into "Free" mode. You will have to pretty up the script yourself if you
want a more streamlined experience.
"""
import c4d
def swizzle_modelling_axis(doc, op):
"""Swizzles the modeling axis of the passed object.
Args:
doc (c4d.documents.BaseDocument): The active document.
op (c4d.PolygonObject): A node in the active document.
Raises:
TypeError: When op is not a PolygonObject.
"""
def swizzle_matrix(m):
"""Swizzles a matrix, pushing in numerical and looping order of
its components (e.g. v1, v2, v3 becomes v3, v1, v2).
"""
return c4d.Matrix(off=m.off, v1=m.v3, v2=m.v1, v3=m.v2)
# Sort out non-polygon-objects.
if not isinstance(op, c4d.PolygonObject):
msg = ("swizzle_modelling_axis() requires a polygon object. "
"Received: {type}.")
raise TypeError(msg.format(type=type(op)))
# We need the axis to be free in order to be able to modify the axis.
# For that we select the live selection tool and set it to free mode.
doc.SetAction(c4d.ID_MODELING_LIVESELECTION)
plugin = c4d.plugins.FindPlugin(c4d.ID_MODELING_LIVESELECTION,
c4d.PLUGINTYPE_TOOL)
if plugin is None:
return
else:
plugin[c4d.MDATA_AXIS_MODE] = c4d.MDATA_AXIS_MODE_FREE
# Get the modeling axis, swizzle it and write it back.
axis = swizzle_matrix(op.GetModelingAxis(doc))
op.SetModelingAxis(axis)
op.Message(c4d.MSG_UPDATE)
def main():
"""Entry point.
"""
swizzle_modelling_axis(doc, op)
c4d.EventAdd()
if __name__=='__main__':
main()