Yes, that’s what I was afraid of. How can I get the actual dimensions of the object?
All I really want to do is center the text3d object at the origin, but its pivot point, by default, is at the lower left corner instead of at the object’s center, and I don’t know how to move it in python. Changing the object’s location with tob.setLocation(0,0,0) sets the pivot point at the origin, not the object’s center.
So I figured if I could calculate the object’s size, I could position it correctly.
That does center the text horizontally, but not vertically. The origin sits right below the text, not in the middle. If I use multi-line text “Hello
There
Everyone” then only the first line goes at the origin. Strange…
I know that in the GUI you can put the pivot point at the object’s center (Object menu -> Transform -> Center New), but the functionality is not there yet in python, that I am aware.
Gotta go to work, possible solution:
Use getBoundBox (returns 8 xyz coordinated) after linking ob to scene.
the y coordinates should show only 2 different values: maxY minY.
Try this for positioning center.
Aha!! That did it! I had to call ob.getBoundBox AFTER linking the object to the scene. Calling getBoundBox on the “tob” object (an NMesh) didn’t work, but it did when called on the original Text3D object (“ob”) that the NMesh was constructed from.