This script generates radially symmetric geometry applied to the design of a dc motor armature. The design is fixed with a circle stroke section shape for the armature's end piece or mushroom cap and a rectangular shape for the stem portion. For the given design, you can automatically set: the number of arms/coils, length of the arm, and the dimensions of the mushroom cap.
Basic Blender proficiency is required including loading and running add-on scripts manually using the text editor. Once loaded, you will need proficiency with the Boolean modifier. With the basic geometry loaded, you will want to bevel. For beveling you will want to select edges by similar length and area.
Basic python proficiency and algebra & geometry skills are required. This script generates a simple geometry and symmetrically rotated geometries. You will need to know how to convert between Radial and Rectangular/Cartesian coordinate systems. There are diagrams available demonstrating the calculations performed.
Simply load your script in the text editor and run it. Edit the geometry configuration settings in script in the text editor and re-run it.
bpy - blender python - generating geometry for an electric motor armature design youtu.be/UfTsiyjgAtc channel: youtube.com/@nadeemelahi593 playlist: playlist?list=PLJUHxPFa4XqOoZ8U4L8CyYz8hyTnGkLEI
A Blender UI for adjusting the initialization settings is not included. The initialization settings must be editing in the code. Scroll to line 164. There abouts you will notice settings for coilCnt, inner, outer, step, divisions, xlft, and thickness. The following diagram annotates those settings on the geometric outcome.
This script gives you a 2d mesh in the x-y plane as a starting point for modelling a dc motor armature. Once you are satisfied with your 2d design outcome you are free to work in Blender as per usual. You are left with two meshes. You will want to extrude in the z direction eventually but first you will probably want to start by applying the Boolean - Union modifier operation. You will want to add a center ring for the armature to sit on a shaft. Finally you will want to add a cylinder to depict a motor shaft.
The script itself contains notes at the bottom starting at line 236 for a sample design workflow producing the following result:
Scripting geometry in Blender as with any OpenGL platform requires creating arrays/lists of vertices of your mesh. Faces of your mesh are similarly defined using arrays/lists except of indices each corresponding to a vertex in the array/list of vertices.
The algorithms for geometry generation in this script are not commented. However the functions are named semantically and there is no tricky programming styles or techniques employed. The astute python programmer should be able to understand the code as it is with out comments. The array module is not used. The basic list data structure is used. You should understand the difference between list's append method and joining lists using the + operator.
This script has been testing to be working on Blender 2.83 and 4.1.
On Blender 2.83 the mesh of the armature's mushroom cap portion appears blacked out. This can be corrected simply by re-calculating normals (ALT + N)