Hi all,
I am new to programming in C4D, but not programming in general. Trying to wrap my head around an issue.
I have a Python Generator (which may at some point be turned into a full plugin, if it turns out to have any value) with a scripts that generates some text objects (fully extruded text objects, not just splines), depending on user data settings that the user can play with.
The objects are generated as expected, and become visible in the scene after my script returns the root object. However, the several text objects are all right on top of each other. I can set their relative position easily, using user data values, or calculated values, but I want to go one step further; I want to lay them out in relation to each other.
Which means that once they are generated, I need to get the bounding box of each of the text elements.
I have understood that I can get the size in three dimensions using something like
text.GetRad() * 2
However, this always returns an empty vector to me ([0,0,0]).
If I make a text object in the Object Manager (without making it editable), and access it in the console using something like Text.GetRad()
I get a vector accurately reporting the extents of the object, which I could use with The Math to do the calculations I need to.
This tells me that I don't need to worry about making them editable.. So didn't they really get a bounding box yet, even if I added them to the scene? Do I need to let Cinema 4D perform a run loop or something in order to process my objects?
I did see a web page mentioning doing something like this:
doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_INTERNALRENDERER)
But the only result of running that command is that Cinema 4D freezes for several minutes, so that feels like the wrong thing to do. :)
I've also seen some bits about getting a cached version - GetCache() returns "None" for me it seems. The text object has no children.
Is there a surefire way to get the bounding box of a text object inside the generator function, before it returns?
Thanks for any insights!