I am struggling in obtaining what I want in a configurator I made using Blender and python scripting.
This is what I would like to achieve: I have 7 custom properties (quotes in mm) which I adjust by using IntProperties in a custom panel in the UI 3D View. As I need to export the results of the configuration, and didn’t want this to be made by a simple print screen, I thought about a button which renders the camera view (top ortho) and composites it with another layer where I have the names and (tentatively) the values of the quotes. Unfortunately I can’t seem to update the content of the text. I managed to see it in a console, and it correctly updates if I update the text by entering edit mode and pressing some key. This is how I achieved it:
def draw(self, context): layout = self.layout scene = context.scene mytool = scene.my_tool mypanel = scene.ignit_panel Misura_1_text = scene.objects['Misura 1'] print(Misura_1_text.data.body)
However, if in the following line I try to assign whichever value (e.g. “Mis_1” to the “Misura_1_text.data.body” by
Misura_1_text.data.body = "Mis_1"
I get the following error: “Writing to ID classes in this context is not allowed: Text, Curve datablock, error setting TextCurve.body”
Apparently, this should be the right way to go (e.g. https://blender.stackexchange.com/questions/165454/updating-text-object-in-blender-2-81-using-python) but I can’t seem to succeed. And this is just the beginning, as I still didn’t manage to read the custom property value…
Thanks to anyone who can point me towards the right direction.