Hi all.
Blender has ten predefined mesh primitives (Suzanne and friends).
Thanks to the autocomplete feature of VS Code (with the various extensions for Blender), I recently discovered that there is an eleventh guest:
bpy.ops.mesh.primitive_cube_add_gizmo()
Anyway the documentation is quite generic (it seems like a cube with other options), and when I try to insert it a scene with a simple script, I get an error message saying:
Traceback (most recent call last):
File “\Prova 5 Add Primitve.py”, line 3, in
File “E:\Programmi\Blender Foundation\Blender 3.1\3.1\scripts\modules\bpy\ops.py”, line 132, in call
ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.mesh.primitive_cube_add_gizmo.poll() failed, context is incorrect
Do you have any information about this alien?
Thanks
I’m not sure what this error is either - my guess would be it’s there to act as a toolbar icon.
bpy.ops.mesh.primitive_cube_add()
This is the correct way to create a new cube primitive fyi, not the function with “gizmo” at the end of it like you’re using (I think the docs need to be updated).
Hi RPaladin.
yes, I know the command to create a normal cube. I was just curious to understand what is the added function with the gizmo present in the library.
In VS Code I looked for the definition, I attach the figure. Respect to the normal Cube, it seems that the main difference is the presence of the “matrix” section, but I don’t understand what is its role.
Thanks
It’s difficult to explain in laymen terms. Basically, matrixes are used in the calculating of transform changes. And it’s also used in the rendering of 3D vertexes and polygons.
Yes,
I know something about matrices, but not much about their use in Blender API.
The use of a matrix in the Cube Gizmo function seems actually related to some sort of transformation, but I still don’t grasp its use and the reason of the error when one tries to insert in the scene. Probably it is a question of finding the correct context, but it seems that there is no documentation about it anywhere.
Thanks