Skripten für Massenanfertigung von Objekten
Massenanfertigung - Mass production
Define vertices in a list (Vertices)
make a command for a single component
pyramide:
p_{1}=Pyramid(Polygon({A, B, C}), AB)
p_{1}=Pyramid(Polygon(Take(Vertices,1,3)), Element(Vertices,4))
Sequence(
"p_{" + (j) + "}={Polygon(" + (First(Element(Vertices, j), 3)) + "),
Pyramid(Polygon(" + (First(Element(Vertices, j), 3)) + ")," + (Element(Vertices, j, 4)) + ")}", j, 1, 24)
move=Translate(p_{1},Vector(s*Vector(M,Sum({A,B,C,AB})/4)))
and transform in a text comand version (PyramidesΔ, TranslateΔ) with access the data form vertices list by a sequence loop variable (j).
Execute the command sequence:
q=2
s=Slider(0,2,0.1,1,100,false,false,false,false)
Execute({"A=((-q)/2,(-q)/2,0)","B=(q/2,(-q)/2,0)","C=(q/2,q/2,0)","A'=A+(0,0,q)","B'=B+(0,0,q)","C'=C+(0,0,q)","D=((-q)/2,q/2,0)","D'=D+(0,0,q)","AB=(A+B+B'+A')/4","AD=(A+D+D'+A')/4","BC=(C+B+B'+C')/4",
"CD=(C+D+D'+C')/4","M=(A+B+C+D)/4+(0,0,q/2)","O=(A'+B'+C'+D')/4","U=(A+B+C+D)/4"})
Vertices={{A,B,M,AB},{B,B',M,AB},{A',B',M,AB},{A,A',M,AB},{B,C,M,BC},{C,C',M,BC},{B',C',M,BC},{B,B',M,BC},{C,D,M,CD},{D,D',M,CD},{C',D',M,CD},{C,C',M,CD},{D,A,M,AD},{A,A',M,AD},{D',A',M,AD},{D,D',M,AD},{A',B',M,O},{B',C',M,O},{C',D',M,O},{D',A',M,O},{A,B,M,U},{B,C,M,U},{C,D,M,U},{D,A,M,U}}
PyramidesΔ=Sequence("p_{"+(j)+"}={Polygon("+(First(Element(Vertices,j),3))+"),Pyramid(Polygon("+
(First(Element(Vertices,j),3))+"),"+(Element(Vertices,j,4))+")}",j,1,24)
Execute(PyramidesΔ)
TranslateΔ=Sequence("t_{"+(j)+"=Translate(p_{"+(j)+"},Vector(s*Vector(M,"
+(Sum(Flatten(Element(Vertices,j)))/4)+")))",j,1,24)
Execute(TranslateΔ)
Example
A=(64.5693, -28.77679)
B=(59.33533, -41.33831)
C=(49.39079, -41.33831)
r=Slider(0, 12, 0.1, 1, 200, false, true, false, false)
g=Slider(0, 12, 0.1, 1, 200, false, true, false, false)
b=Slider(0, 12, 0.1, 1, 200, false, true, false, false)
CIRCLES=Sequence("c_{"+j+"}=Circle(Rotate(B, 2°*"+(j-1)+", C), A)", j, 1, 180)
COLORS=Sequence("SetDynamicColor(c_{" + (j) + "},
Distance(Rotate(B,2°*" + (j-1) + ",C),B) / r, Distance(Rotate(B,2°*" +
(j-1) + ",C),A) / g, Distance(Rotate(B,2°*" + (j-1) + ",C),A) / b)", j,
1, 180)
Execute(CIRCLES)
Execute(COLORS)