SOLVED Object size not updated after points move

Hi there,

I have a technical Python question which I can't seem to solve.

The following script is used to store the points in an object, then reset the rotation of the object and then put the points back into their old position:

def reAlignPoints(Object):
    if (Object.GetType() == c4d.Opolygon) or (Object.GetType() == c4d.Opoint):
        oldm = Object.GetMg()
        points = Object.GetAllPoints()
        pcount = Object.GetPointCount()
        Object.SetAbsRot(c4d.Vector(0))
        Object.SetAbsScale(c4d.Vector(1))
        newm = Object.GetMg()
        

        for p in range(pcount):
            Object.SetPoint(p,~newm*oldm*points[p])

This works very well, however I'm running into a problem if I look under the Coordinate Manager of the object and then it's size. Under size the object still appears to be in it's old orientation at first glance.
However, if I click on any of the size values and then simply hit enter, all the values jump around to the give the object it's correct orientation again.
For instance, the longest axis is initially the "Z" axis (old orientation) but when I click the value and hit enter, the contents of the "Z" axis jump to the "Y" axis where they should be.

My question is two fold:

  • Why is this happening? What is going awry in my code that the object size is not properly updated?
  • What is the best way to fix this in python code and/or can I automate this clicking and hitting enter to switch the values around?

Currently I read the bounding box of the/multiple objects and compile a custom bounding box afterwards, but this currently has the wrong orientation because the size parameters are not in the correct axis.

Kind regards,

Did you update the object? Can't see that in your code as posted.
API docs say:
"Call obj.Message (c4d.MSG_UPDATE) after you set all your points to update the object."
Which normally recalculates the bounding box (and whatever internal data the object holds).

Did you update the object? Can't see that in your code as posted.
API docs say:
"Call obj.Message (c4d.MSG_UPDATE) after you set all your points to update the object."
Which normally recalculates the bounding box (and whatever internal data the object holds).

Well, that indeed fixed the issue, now the size gets properly updated! 🙂

Thank you very much for the help