After id exeetzer axis alignment
-
Hello, I would like to write a script where you set the axis alignment for all angles to zero, according to the Picture, maybe someone can help me, would like to insert the function into an existing script.
-
Hello @wdp,
Thank you for reaching out to us. As discussed before and lined out in our Forum and Support Guidelines, we the Maxon SDK Group can only answer specific questions to specific problems and in most cases require support requests be accompanied by code. We do not provide full solutions, e.g., you asking here for a function which does what you want. We cannot make any exceptions, as other users would then rightfully ask for the same level of support for their cases. When you run into problems with implementing something, you should provide the code you have, and a sufficiently precise problem description.
The relative orientation of an object is accessible among other places via the BaseObject description parameter
ID_BASEOBJECT_REL_ROTATION
. For more details about encoding object transforms, please refer to the Matrix Manual, the section Objects and Matrices contains information about how global and local object transforms are composed and being made accessible.Cheers,
Ferdinand -
Hi!
I still have a problem with my script, I would like only the axes to align, and not the object like now, would be great if you could help me?
Thanks very much!from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: # Called when the plugin is selected by the user. Similar to CommandData.Execute. # Get the selected objects in the active document. selected = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_CHILDREN) # The fixed global position all objects should be set to. pos = c4d.Vector(0, 0, 0) # Iterate over all selected objects and set the global position of each. for obj in selected: # Get the global matrix of the object, set its offset and write it back. mg = obj.GetMg() mg.off = pos obj.SetMg(mg) obj[c4d.ID_BASEOBJECT_USECOLOR] = c4d.ID_BASEOBJECT_USECOLOR_ALWAYS obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0.5, 0.8, 0.3) obj[c4d.ID_BASEOBJECT_GLOBAL_ROTATION] = c4d.Vector(0, 0, 0) obj[c4d.ID_BASEOBJECT_USECOLOR] = 1 # Push and update event to Cinema 4D. c4d.EventAdd() #Drop it Flor c4d.CallCommand(1041642) if __name__ == '__main__': main()
-
Hello @WDP,
Please excuse the very long delay, but I have to overlooked your answer here. But as stated in my initial posting, we can only provide support on concrete technical questions.
If I remember correctly, there was another thread preceding this one where the same rule had been lined out, which is why I was as strict in my answer here as I was. And while we understand that this line of questions usually does not come from a bad place when asked by less experienced Python users, we ultimately cannot provide full solutions or even write applications.
What might get you (and other information seekers) started on this subject is the operation_transfer_axis_s26.py code example, as it manipulates the "axis" of an object.
I have closed this topic due to the lack of an eligible support request. Please feel free to open a new question when you have tangible coding problem for that subject.
Cheers,
Ferdinand