With this article we begin to explore some of the possibilities offered by the integration of these scripts to create new models of geometry or modify objects in Blender, increasing our creative potential for substantially.
In this first approach, we will begin to see how is the work environment by performing a small guided examples. We will later introduce a detailed study of the internal data structure of Blender and the possibilities of access and modification of this.
Access to the Python console.
The Python console provides a method of quick access to IPY (Application Program Interface), namely, to the instruction set that provides Python to interact with Blender. This console allows you to automatically complete instructions with a function of completion which simplifies the access to the same.
The Python console is one window more than the working environment of Blender.
Console by selecting the corresponding icon will be displayed on screen.
We can see that there is a button “AutoComplete” in the console window, and that the text that appears indicates a keyboard shortcut “Ctrl – Space” by simultaneously pressing the button of control and space bar.
If I started writing some texts suggesting from the included modules (Builtin Modules) We can fill them with this auto-complete functionality.
For example, If we write “bpy.” and click the AutoComplete button, will show you the following options:
For example, If we wanted to know the date of compilation of the program could reach the function “Build_date” as seen in the following image
We can create references to operators to simplify its incorporation. The assignment operator will be the symbol of equality. “=”
“add_cube = bpy.OPS.mesh.primitive_cube_add“
With the function “print” We can verify this allocation
We can use this reference to create a new object in a position (“Location”) given
You can see the result in the 3D window
The incorporation of isolated instruction does not provide great advantages. The programming of these will allow us, with little effort, very interesting results.
Ready to start programming in Python with Blender?