手搓月饼

手搓月饼

最近中秋节,看到群里面有 月饼加工图,于是也来整个烂活 打印月饼 试试。

建模的话 emmm 就懒得开 Fusion 360 了,还是使用 OpenSCAD 来进行吧。

分析

  • 月饼主体: cylinder
  • 周围是一圈小的 cylinder
  • 文字使用 text 生成后用 linear_extrude 挤出
  • 中间的圈用 difference() 两个 cylinder 来制作
  • 花纹用 difference() 制作
  • 月饼周围的斜面用月饼主体和一个很大的 sphere 进行 intersection() 来制作

建模

根据以上分析搓代码进行建模。

parametric_mooncake.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
pi = 3.1415926;
segments = 24;
diameter = 50;
height = 17;
outer_displace = -2;
outer_d = diameter * pi / segments + 1;

decoration_type = 1;
text_frame = false;

intersection()
{
union()
{
for(i=[0:1:segments])
{
x=cos(i*360/segments)*(diameter/2+outer_displace);
y=sin(i*360/segments)*(diameter/2+outer_displace);

translate([x,y,0])
cylinder(d=outer_d,h=height, $fn=48);
}

if(decoration_type==1)
{
difference()
{
cylinder(d=diameter,h=height+.5,$fn=96);

translate([0,0,height])
union()
{
rotate([0,0,10])
for(cx=[-7:1:7])
for(cy=[-5:1:5])
{
dx=cx%2;
translate([cx*5*sin(60),cy*5+dx*5/2,0])
cylinder(h=2,r=2.5,$fn=6);
}
}}
}
else if(decoration_type==2)
{
cylinder(d=diameter,h=height,$fn=96);

translate([0,0,height])
for(i=[0:1:30])
{
x=cos(i*360/30)*(diameter/2-5);
y=sin(i*360/30)*(diameter/2-5);

translate([x,y,0])
difference()
{
cylinder(d=10,h=.5, $fn=48);
cylinder(d=8.5,h=2, $fn=48);
}
}
}
else if(decoration_type==3)
{
cylinder(d=diameter,h=height,$fn=96);

translate([0,0,height])
{
lines=6;
difference()
{
cylinder(d=diameter,h=.5, $fn=lines);
cylinder(d=diameter-2,h=.5, $fn=lines);
}
rotate([0,0,360/16])
difference()
{
cylinder(d=diameter,h=.5, $fn=lines);
cylinder(d=diameter-2,h=.5, $fn=lines);
}
}
}
else if(decoration_type==4)
{
cylinder(d=diameter,h=height,$fn=96);
for(cx=[-10:1:10])
translate([cx*4,-35,height])
cube([.8,70,0.5]);

for(cy=[-10:1:10])
translate([-35,cy*4,height])
cube([70,.8,0.5]);

}

}

translate([0,0,-42.3])
sphere(d=130);

}

translate([0,0,height])
{
difference()
{
cylinder(d=diameter -9,h=.5+1,$fn=48);
cylinder(d=diameter -11,h=2,$fn=48);
}

difference()
{
cylinder(d=diameter -14,h=.5+1,$fn=48);
cylinder(d=diameter -15,h=2,$fn=48);
}

cylinder(d=diameter -10, h=.5,$fn=96);
}

if(text_frame)
{
translate([0,0,height])
{
difference()
{
cube([17,28,1+1], center=true);
cube([17-1.5,28-1.5,2+1], center=true);
}
}
}

translate([0,0,height])
linear_extrude(1.5)
{
text("糊", size = 21, font = "楷体", halign = "center", valign = "center");

/*text("莲", size = 10, font = "楷体", halign = "center", valign = "bottom");
text("蓉", size = 10, font = "楷体", halign = "center", valign = "top");*/
}

生成 stl:

stl

打印

导出 4 种花纹和文字的 stl,直接使用 bambu studio 切片后用竹子打印。

  • material: PLA
  • nozzle: 0.4mm
  • layer: 0.2mm

Plate

出锅!

4种颜色和花纹的月饼

看起来很好吃(

Author

InariAimu

Posted on

2023-09-26

Updated on

2023-10-23

Licensed under