On 05/06/2015 at 08:15, xxxxxxxx wrote:
Hi,
This is isn't a so simple and common question
.
Originally posted by xxxxxxxx
Question 1:
How do I calculate the rotation? I need a definiton which includes Point, RotationAxisMatrix, Rotation as parameter. I have tried to figure that out without luck till now.
First you should first have a good understanding of how matrices work in Cinema. See Matrix Fundamentals in the Python documentation.
Originally posted by xxxxxxxx
Question 2:
Is there a python function to get the Matrix of the Modelling-Axis in componentsmode?
There's no direct function for this. Here's some code:
def GetModelingAxis(op) :
tool = plugins.FindPlugin(c4d.ID_MODELING_AXIS, c4d.PLUGINTYPE_TOOL)
# Get modeling axis bounds
posx = tool[c4d.MDATA_AXIS_BOUNDS_X]
posy = tool[c4d.MDATA_AXIS_BOUNDS_Y]
posz = tool[c4d.MDATA_AXIS_BOUNDS_Z]
# Get center and bounding box of object
mp = op.GetMp()
rad = op.GetRad()
# Initialize modeling axis with center of object
maxis = c4d.Matrix()
maxis.off = mp
# Change offset of modeling axis according to bounds
maxis.off.x += rad.x*posx;
maxis.off.y += rad.y*posy;
maxis.off.z += rad.z*posz;
return maxis