BaseObject.SetModelingAxis(self, m) Not Working
-
Hi, is there any example about BaseObject.SetModelingAxis(self, m)? I just wanna move and rotate the model's axis via script, and here is my script in python tag
-
The Tool settings must set the Axis to Free (under Modeling Axis), so the change of the modeling axis has any visible effect.
If you do that, you will see that the tag affects the modeling axis... go to Polygon Mode, Axis Mode, move the modeling axis, and it snaps back to the origin.The more interesting question would be why you'd want to change the tool setting in a tag? What's the purpose?
(Also, please include the full scene, not just a screenshot, so the Maxon people don't have to re-type everything...)
-
Hello,
as @Cairyn said the function
SetModelingAxis
purpose is to change the modeling axis for some modeling tools only. (Move, Rotate, Scale...?) To see the effect of that function, you must define the axis to free first.But, maybe you were expecting this function to move the axis of the object itself. There is no function to do so. You can only move the object axis itself. That will also move the points of the object. Then, you need to move all the points of the object to the original place.
In this thread, you will find @ferdinand explaining how this works and how to move back the points at their original position.
I would also point to our matrix manual to understand how they are used.
If you just want to move the object, you can use SetMg, SetRelPos, SetAbsPos, SetFrozenPos. There are also functions to define Relative, Absolute or Frozen rotation. SetRelRot..etc
# Define an object's position using matrices. def main() -> None: m = c4d.Matrix() m.off = c4d.Vector(120, 0, 0) op.SetMg(m) c4d.EventAdd()
Cheers,
Manuel -
Thanks for the script but I just want the axes to change to 0,0,0 and the object to keep the original orientation.
-
Hi,
We do not provide "on demande" script. We are here to share the knowledge and help you to find the information you need, but you must learn how to code and learn how some principales works.
I provided you a thread where Ferdinand is explaining how it works to move an object to another position. We have a new example in our github repository that will help you to understand how it is done.
In your case, there is no function that is doing that. You must move the object's axis at the position (0, 0, 0) and move the points at the place they were. It is a two steps operation.
Cheers,
Manuel