aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2014-08-08 19:07:51 +0200
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2014-08-08 19:07:51 +0200
commit5012fd242b106c1dd20cd20e6007dc42e2140064 (patch)
tree6f8584894d6ceffe79dc9f5c972987f3ead93ac2
parent5ebe242ed769f14d4c82d54209839660e59c4dda (diff)
downloadchimaera_mplek-5012fd242b106c1dd20cd20e6007dc42e2140064.zip
chimaera_mplek-5012fd242b106c1dd20cd20e6007dc42e2140064.tar.gz
chimaera_mplek-5012fd242b106c1dd20cd20e6007dc42e2140064.tar.bz2
chimaera_mplek-5012fd242b106c1dd20cd20e6007dc42e2140064.tar.xz
update designs
-rw-r--r--.gitignore4
-rw-r--r--Makefile66
-rw-r--r--mplek.py29
-rw-r--r--mstamp.py21
4 files changed, 57 insertions, 63 deletions
diff --git a/.gitignore b/.gitignore
index 31d1dc4..7742f30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-mplek_*mm.stl
-mstamp.stl
+mplek_*mm.dae
+mstamp.dae
diff --git a/Makefile b/Makefile
index cea0563..0a34fa0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,42 +1,42 @@
-TARGETS := mplek_12.0mm.stl
-TARGETS += mplek_12.5mm.stl
-TARGETS += mplek_13.0mm.stl
-TARGETS += mplek_13.5mm.stl
-TARGETS += mplek_14.0mm.stl
-TARGETS += mplek_14.5mm.stl
-TARGETS += mplek_15.0mm.stl
-TARGETS += mplek_15.5mm.stl
-TARGETS += mplek_16.0mm.stl
-TARGETS += mplek_16.5mm.stl
-TARGETS += mplek_17.0mm.stl
-TARGETS += mplek_17.5mm.stl
-TARGETS += mplek_18.0mm.stl
-TARGETS += mplek_18.5mm.stl
-TARGETS += mplek_19.0mm.stl
-TARGETS += mplek_19.5mm.stl
-TARGETS += mplek_20.0mm.stl
-TARGETS += mplek_20.5mm.stl
-TARGETS += mplek_21.0mm.stl
-TARGETS += mplek_21.5mm.stl
-TARGETS += mplek_22.0mm.stl
-TARGETS += mplek_22.5mm.stl
-TARGETS += mplek_23.0mm.stl
-TARGETS += mplek_23.5mm.stl
-TARGETS += mplek_24.0mm.stl
-TARGETS += mplek_24.5mm.stl
-TARGETS += mplek_25.0mm.stl
-TARGETS += mplek_25.5mm.stl
-TARGETS += mplek_26.0mm.stl
-TARGETS += mplek_26.5mm.stl
+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 += mstamp.stl
+TARGETS += mstamp.dae
all: $(TARGETS)
-mplek_%mm.stl: mplek.py
+mplek_%mm.dae: mplek.py
blender -P $< -- $* $@
-mstamp.stl: mstamp.py
+mstamp.dae: mstamp.py
blender -P $< -- $@
clean:
diff --git a/mplek.py b/mplek.py
index a1a8170..e78a9e0 100644
--- a/mplek.py
+++ b/mplek.py
@@ -28,8 +28,6 @@ R0 = D/2 # radius of 2nd phalanx
R1 = R0+1.5*T+H/2 # minimal radius of polygonal prism
R2 = R1/cos(P) # maximal radius of polygonal prism
-C = 6 # diameter of circular magnet
-
cen = (0, 0, 0) # origin
# clear scene
@@ -48,12 +46,6 @@ bar = bpy.context.active_object
bar.name = "bar"
bpy.ops.transform.resize(value=(H/2*prec, W/2*prec, L/2*prec))
-# create cylinder magnet
-bpy.ops.mesh.primitive_cylinder_add(vertices=64, radius=C/2*prec, depth=T*2, location=(R1-T*2-H, 0, 0), rotation=(0,pi/2,0))
-cyl = bpy.context.active_object
-cyl.name = "cyl"
-cyl.select = False
-
# create partially cut polygonal prism
P2 = P*2
coords=[]
@@ -95,12 +87,6 @@ bevel.name = "bevel"
bevel.width = B
bevel.segments = 1
-## add simple deform modifier
-#bpy.ops.object.modifier_add(type="SIMPLE_DEFORM")
-#simple = outer.modifiers["SimpleDeform"]
-#simple.name = "simple"
-#simple.angle = P
-
# subtract inner from outer cylinder
bpy.ops.object.modifier_add(type="BOOLEAN")
sub_inner = outer.modifiers["Boolean"]
@@ -115,13 +101,14 @@ sub_bar.name = "sub_bar"
sub_bar.operation = "DIFFERENCE"
sub_bar.object = bar
-# subtract cyl from outer cylinder
-bpy.ops.object.modifier_add(type="BOOLEAN")
-sub_cyl = outer.modifiers["Boolean"]
-sub_cyl.name = "sub_cyl"
-sub_cyl.operation = "DIFFERENCE"
-sub_cyl.object = cyl
+# rotate 45°
+outer.select = True
+inner.select = True
+bar.select = True
+bpy.ops.transform.rotate(value=pi/4, axis=(0, 0, 1))
+inner.select = False
+bar.select = False
# export to STL
-bpy.ops.export_mesh.stl(filepath=sys.argv[5], check_existing=False, ascii=True, use_mesh_modifiers=True)
+bpy.ops.wm.collada_export(filepath=sys.argv[5], selected=True, apply_modifiers=True)
bpy.ops.wm.quit_blender()
diff --git a/mstamp.py b/mstamp.py
index 5409f25..10729a5 100644
--- a/mstamp.py
+++ b/mstamp.py
@@ -12,11 +12,12 @@ import sys
import bpy
from math import pi, sin, cos
-add = 0.05
+prec = 1.01
-W = add+4 # width of bar magnet
-H = add+3 # height of bar magnet
-L = add+20 # length of bar magnet
+T = 1 # wall thickness
+W = 4 # width of bar magnet
+H = 3 # height of bar magnet
+L = 20 # length of bar magnet
R0 = 3
L0 = 50
@@ -49,10 +50,10 @@ bpy.ops.transform.resize(value=(W*1.2, L/2, H*2))
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0))
bar = bpy.context.active_object
bar.name = "bar"
-bpy.ops.transform.resize(value=(W/2, L/2, H/2))
+bpy.ops.transform.resize(value=(W/2*prec, L/2*prec, H/2*prec))
# create base
-bpy.ops.mesh.primitive_cube_add(location=(0, 0, -H*2))
+bpy.ops.mesh.primitive_cube_add(location=(0, 0, -H*2 + (H/2-T)))
base = bpy.context.active_object
base.name = "base"
bpy.ops.transform.resize(value=(W*2, L*2, H))
@@ -91,6 +92,12 @@ sub_knob4.object = base
# apply modifiers
bpy.ops.object.modifier_apply(modifier="sub_knob1")
+
+# rotate
+base.select = False
+bpy.ops.transform.rotate(value=-75/180*pi, axis=(1, 0, 0))
+bpy.ops.transform.translate(value=(0, 45, 14-50))
+
bpy.ops.object.modifier_apply(modifier="sub_knob2")
bpy.ops.object.modifier_apply(modifier="sub_knob3")
bpy.ops.object.modifier_apply(modifier="sub_knob4")
@@ -102,5 +109,5 @@ scn.objects.unlink(bar)
scn.objects.unlink(base)
# export to STL
-bpy.ops.export_mesh.stl(filepath=sys.argv[4], check_existing=False, ascii=True, use_mesh_modifiers=True)
+bpy.ops.wm.collada_export(filepath=sys.argv[4], selected=True, apply_modifiers=True)
bpy.ops.wm.quit_blender()