Skip to content

Commit

Permalink
Finished auto generation script and Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cold-soda-jay committed Dec 28, 2020
1 parent 829879e commit de4e4db
Show file tree
Hide file tree
Showing 12 changed files with 413 additions and 218 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ docs/Motor.zip
*.stl

docs/backup/

Add Motor/
Binary file added Add Motor.zip
Binary file not shown.
88 changes: 87 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,87 @@
blender_Motor_Factory
# Blender Motor Factory

This is an blender addon which can create motor. We parameterized many features of a motor and so user can generate various model in same type but different parameters.

This addon only support [blender version 2.90.1](https://download.blender.org/release/Blender2.90/). Other version may cause unpredictable falier.

## 1. Installation

1. Download the project via ``git clone https://github.com/cold-soda-jay/blender_Motor_Factory.git``.
2. In Blender, go *Edit > Preference > Install* and find the file **Add Motor.zip**. Make sure it is activated.
3. Now you can find it in *Add >Mesh*

## 2. Advanced

### 2.1 Save model

This Addon allow user generate various model and save the parameter as well as model as .stl file. To save the model, you can run the command in blender Console (**Shift + F4** to open it):
``bpy.ops.mesh.add_motor(save_path="Path of folder")``

The model will be saved as a whole entity and seperate parts

<div align="left"><img src="pic\saved_file.png" alt="Image" style="zoom:0%;" /></div>

<div align="center"><img src="pic\parts_model.png" alt="Image" style="zoom:80%;" /></div>

### 2.2 CSV data

The parameters of generated model will be saved into a csv file when ``save_path`` setted. Every model will be saved in a separate folder with a number as name. This number represent the Id of the model. The parameters of this model can be found in csv file.

The position of all bolts will also be saved as a list in the file. The order of bolt position is from bottom to top.

### 2.3 Auto generation

To generate more models at once, you can use script ``./src/auto_generate.py``. In the script you can set the number of generated models and define several parameters when generating. Here are all parameters:

```python

[
"mf_Head_Type",
"mf_Extension_Type_A",
"mf_Extension_Type_B",
"mf_Gear_Orientation_1",
"mf_Gear_Orientation_2",
"mf_Flip",
"mf_Color_Render",
"mf_Bottom_Length",
"mf_Sub_Bottom_Length",

"mf_Lower_Gear_Dia",
"mf_Lower_Gear_Position",
"mf_Upper_Gear_Dia",

"mf_Bit_Type",
"mf_Bolt_Orientation",
"mf_Lower_Gear_Bolt_Random",

"mf_Lower_Gear_Bolt_Position_1",
"mf_Lower_Gear_Bolt_Position_2",

"mf_Gear_Bolt_Random_B",
"mf_Gear_Bolt_Nummber_B",
"mf_Gear_Bolt_Position_B_1",
"mf_Gear_Bolt_Position_B_2",
"mf_Gear_Bolt_Position_B_3",


"mf_Upper_Bolt_Nummber",
"mf_Upper_Gear_Bolt_Random",
"mf_Upper_Gear_Bolt_Position_1",
"mf_Upper_Gear_Bolt_Position_2",
"mf_Upper_Gear_Bolt_Position_3",

"mf_Type_B_Height_1",
"mf_Type_B_Height_2",

"save_path",

]
```

After setting the parameters, you can runthe script in command line with following command:

```
blender --background --python path/of/auto_generate.py"
```

See more details in `auto_generate.py`
116 changes: 0 additions & 116 deletions docs/blender.md

This file was deleted.

Binary file removed docs/pic/motor-typeA.png
Binary file not shown.
Binary file added pic/parts_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pic/saved_file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit de4e4db

Please sign in to comment.