aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2015-01-08 11:59:10 +0100
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2015-01-08 11:59:10 +0100
commit949f685f7a04463bcea98b431fc14d1365552f71 (patch)
tree01125772d48b50549b38a9547759d4035192711d
parent6f68e2da92764305afb1f5ab57a7f4c370857d42 (diff)
downloadchimaera_mplek-949f685f7a04463bcea98b431fc14d1365552f71.zip
chimaera_mplek-949f685f7a04463bcea98b431fc14d1365552f71.tar.gz
chimaera_mplek-949f685f7a04463bcea98b431fc14d1365552f71.tar.bz2
chimaera_mplek-949f685f7a04463bcea98b431fc14d1365552f71.tar.xz
add make STL make targets
-rw-r--r--Makefile72
-rw-r--r--mplek.py13
2 files changed, 47 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index 0a34fa0..4fd4058 100644
--- a/Makefile
+++ b/Makefile
@@ -1,43 +1,49 @@
-TARGETS := mplek_12.0mm.dae
-TARGETS += mplek_12.5mm.dae
-TARGETS += mplek_13.0mm.dae
-TARGETS += mplek_13.5mm.dae
-TARGETS += mplek_14.0mm.dae
-TARGETS += mplek_14.5mm.dae
-TARGETS += mplek_15.0mm.dae
-TARGETS += mplek_15.5mm.dae
-TARGETS += mplek_16.0mm.dae
-TARGETS += mplek_16.5mm.dae
-TARGETS += mplek_17.0mm.dae
-TARGETS += mplek_17.5mm.dae
-TARGETS += mplek_18.0mm.dae
-TARGETS += mplek_18.5mm.dae
-TARGETS += mplek_19.0mm.dae
-TARGETS += mplek_19.5mm.dae
-TARGETS += mplek_20.0mm.dae
-TARGETS += mplek_20.5mm.dae
-TARGETS += mplek_21.0mm.dae
-TARGETS += mplek_21.5mm.dae
-TARGETS += mplek_22.0mm.dae
-TARGETS += mplek_22.5mm.dae
-TARGETS += mplek_23.0mm.dae
-TARGETS += mplek_23.5mm.dae
-TARGETS += mplek_24.0mm.dae
-TARGETS += mplek_24.5mm.dae
-TARGETS += mplek_25.0mm.dae
-TARGETS += mplek_25.5mm.dae
-TARGETS += mplek_26.0mm.dae
-TARGETS += mplek_26.5mm.dae
+TARGETS := mplek_12.0mm
+TARGETS += mplek_12.5mm
+TARGETS += mplek_13.0mm
+TARGETS += mplek_13.5mm
+TARGETS += mplek_14.0mm
+TARGETS += mplek_14.5mm
+TARGETS += mplek_15.0mm
+TARGETS += mplek_15.5mm
+TARGETS += mplek_16.0mm
+TARGETS += mplek_16.5mm
+TARGETS += mplek_17.0mm
+TARGETS += mplek_17.5mm
+TARGETS += mplek_18.0mm
+TARGETS += mplek_18.5mm
+TARGETS += mplek_19.0mm
+TARGETS += mplek_19.5mm
+TARGETS += mplek_20.0mm
+TARGETS += mplek_20.5mm
+TARGETS += mplek_21.0mm
+TARGETS += mplek_21.5mm
+TARGETS += mplek_22.0mm
+TARGETS += mplek_22.5mm
+TARGETS += mplek_23.0mm
+TARGETS += mplek_23.5mm
+TARGETS += mplek_24.0mm
+TARGETS += mplek_24.5mm
+TARGETS += mplek_25.0mm
+TARGETS += mplek_25.5mm
+TARGETS += mplek_26.0mm
+TARGETS += mplek_26.5mm
-TARGETS += mstamp.dae
+TARGETS += mstamp
-all: $(TARGETS)
+TARGETS_DAE := $(TARGETS:=.dae)
+TARGETS_STL := $(TARGETS:=.stl)
+
+all: $(TARGETS_STL)
mplek_%mm.dae: mplek.py
blender -P $< -- $* $@
+mplek_%mm.stl: mplek.py
+ blender -P $< -- $* $@
+
mstamp.dae: mstamp.py
blender -P $< -- $@
clean:
- rm -f $(TARGETS)
+ rm -f $(TARGETS_DAE) $(TARGETS_STL)
diff --git a/mplek.py b/mplek.py
index 91ca0b2..537c7ac 100644
--- a/mplek.py
+++ b/mplek.py
@@ -18,6 +18,8 @@ B = 1 # bevel thickness
N = 12 # number of edges of polygonal prism
P = pi/N # edge angle of polygonal prism
+# optimized for 'strong and flexible' material print at Shapeways
+# needs to be adapted for DIY filament printers
prec = 1.01
W = 4 # width of bar magnet
@@ -109,10 +111,11 @@ bpy.ops.transform.rotate(value=pi/4, axis=(0, 0, 1))
inner.select = False
bar.select = False
-# export to Collada
-bpy.ops.wm.collada_export(filepath=sys.argv[5], selected=True, apply_modifiers=True)
-
-# export to STL
-#bpy.ops.export_mesh.stl(filepath=sys.argv[5], check_existing=False, ascii=True, use_mesh_modifiers=True)
+if(sys.argv[5].endswith(".dae")):
+ # export to Collada
+ bpy.ops.wm.collada_export(filepath=sys.argv[5], selected=True, apply_modifiers=True)
+elif(sys.argv[5].endswith(".stl")):
+ # export to STL
+ bpy.ops.export_mesh.stl(filepath=sys.argv[5], check_existing=False, ascii=True, use_mesh_modifiers=True)
bpy.ops.wm.quit_blender()