If you have a large number of name plates to make, it is convenient to make the on the command line rather than using the Blender UI. This process is very similar to process introduced in the making models on the command line blog post.
EDIT (Feb 24, 2020): For Blender 2.80 or higher make sure to use v4.0 or higher of the plugin. New features have also been added since these posts were made, updated version will be available soon.
Setting up the directory structure
To start we will set up our directory structure. Each galaxy will go into its own folder and the make_name_plate.py
and TU_startup.blend
files from our github page should be placed in the same directory as these folders. This should look something like this:
TU_name_plate_examples ├── M51 │ ├── i.json │ └── i_notches.json ├── M100 │ ├── i.json │ └── i_notches.json ├── make_name_plate.py └── TU_startup.blend
Where the json
files are configuration files we will go into more in the next section.
You can download this example’s folder structure for either Unix based systems or Windows.
Configuration files
For this example we will set up the code to crate two versions of each name plate, one with notches and one without. The configuration files for M51
should contain the following:
i.json
{ "name_plate_keywords": { "Text": "M51 i", "Notches": false }, "output_name": "M51_i_name_plate" }
i_notches.json
{ "name_plate_keywords": { "Text": "M51 i", "Notches": true }, "stl_keywords": { "axis_forward": "-Z", "axis_up": "-X" }, "output_name": "M51_i_notch_name_plate" }
The configuration files in the M100
should adjust the Text
and output_name
to match the galaxy’s name.
Running the code
With your terminal in the top level directory you can run the script to make one name plate with the following command (bash):
cd M51 blender ../TU_startup.blend --python-exit-code 1 --python ../make_name_plate.py -- i_notches.json
or for Windows:
cd M51 blender ..\TU_startup.blend --python-exit-code 1 --python ..\make_name_plate.py -- i_notches.json
This will crate two files: M51/M51_i_notch_name_plate.stl
and M51/M51_i_notch_name_plate.blend
. The final step is to create a bash script that will look for all sub folders and json
files and create a name plate for each. This script will be called process_configs.sh
and will sit in the top level directory (bash).
#!/bin/bash set -e for d in */; do cd $d for config in $(ls *.json); do echo $d$config blender ../TU_startup.blend --python-exit-code 1 --python ../make_name_plate.py -- $config > /dev/null done cd .. echo '======' done
To run this code type source process_configs.sh
into the terminal.
For windows this script should be called process_configs.bat
and should contain:
set PATH=%PATH%;"C:\Program Files\Blender Foundation\Blender\" for /D %%d in (*) do ( cd %%d for %%c in (*.json) do ( @echo %%d\%%c blender.exe ..\TU_startup.blend --python-exit-code 1 --python ..\make_name_plate.py -- %%c ) cd .. @echo ====== )
To run this code type process_configs.bat
into the terminal or just double click the file.
The final file structure
Once the code is done running the final file structure will look like:
TU_name_plate_examples ├── M51 │ ├── M51_i.png │ ├── i.json │ ├── i_notches.json │ ├── M51_i_notch_name_plate.stl │ ├── M51_i_notch_name_plate.blend │ ├── M51_i_name_plate.stl │ └── M51_i_name_plate.blend ├── M100 │ ├── M100_i.png │ ├── i.json │ ├── i_notches.json │ ├── M100_i_notch_name_plate.stl │ ├── M100_i_notch_name_plate.blend │ ├── M100_i_name_plate.stl │ └── M100_i_name_plate.blend ├── make_model.py ├── TU_startup.blend └── process_configs.sh
Hi thanks for sharing tthis
LikeLike