Hi @Eduardo-Oliveira first of all welcome on the PluginCafe community.
I think @zipit already provided you some correct answers or at least point you that this workflow is kind of strange for a Cinema 4D user since normally the object by itself doesn't really set its own position, but it's up to a tag (constraint Tag) to define the object position to another one.
But in case you really want to do it, doing it in the Execute method of your ObjectData is fine.
def AddToExecution(self, op, list):
list.Add(op, c4d.EXECUTIONPRIORITY_GENERATOR, c4d.EXECUTIONFLAGS_CACHEBUILDING)
return True
def Execute(self, op, doc, bt, priority, flags):
op.SetMg(doc.GetFirstObject().GetMg())
return c4d.EXECUTIONRESULT_OK
You also need to ensure you registered your object with the flag c4d.OBJECT_CALL_ADDEXECUTION so AddToExecution and Execute are called.
Cheers,
Maxime.