Here is the script, showing how to do the same thing in a more elegant way. This can be applied to almost anything in life. You can hammer away at it or you can stop and think.
// Two ways to build a hollow box:
// 1: brute force - define and locate
// each member
rule frame {
{ s 0.1 1.1 0.1 x 5 z 5 } box
{ s 0.1 1.1 0.1 x 5 z -5 } box
{ s 0.1 1.1 0.1 x -5 z 5 } box
{ s 0.1 1.1 0.1 x -5 z -5 } box
{ s 1 0.1 0.1 y 5 z 5 } box
{ s 1 0.1 0.1 y 5 z -5 } box
{ s 1 0.1 0.1 y -5 z 5 } box
{ s 1 0.1 0.1 y -5 z -5 } box
{ s 0.1 0.1 1 y 5 x 5 } box
{ s 0.1 0.1 1 y 5 x -5 } box
{ s 0.1 0.1 1 y -5 x 5 } box
{ s 0.1 0.1 1 y -5 x -5 } box
}
{ y 2 } frame
// 2: Use the program:
// create two frame members
rule mem {
{ s 0.1 1.1 0.1 x 5 z 5 } box
{ s 0.1 1.1 0.1 x -5 z 5 } box
}
// make them into a square
rule sq
{
{
mem
{ rz 90 } mem
}
// make two squares and two sets
//of frame members into a hollow box
rule frame2
{
{
sq
{ z 1 } sq
{ rx 90 y 1} mem
{ rx -90 y -1} mem
}
// Here they are in a row.
mem
{x 2 } sq
{ x 4 } frame2
No comments:
Post a Comment