Level_1 is a Bricklayer interface (technically speaking an SML structure) that provides a (restricted) set of functions for “putting” LEGO bricks in the xz-plane. The naming conventions for the “put” functions are as follows:
- Every put function begins with put2D_.
- Next comes the dimensions of the brick. In Level_1, the choices are limited to:
- After the dimensions comes an underscore followed by a restricted set of brick types. In Level_1, the choices are limited to:
In Level_1, the xz-coordinate is the only parameter to a “put” function. See Vitruvia Concepts 5-9 for exercises relating to Level_1 functions.
To get (direct) access to all the functions in Level_1, place the following command at the beginning of your bricklayer program:
|build2D : dimensions2D → unit||This function creates, in Bricklayer, a virtual xz-plane having the given dimensions. The dimensions of the xz-plane are represented as a tuple of the form (x,z). For example, the evaluation of the function call
will create a virtual xz-plane whose width (x-dimension) is 5 and whose depth (z-dimension) is 7. It is in this virtual space, (0,0),…,(4,6), that LEGO bricks may be placed. It is only after this function call has been evaluated that you will be able to build things.
|show2D : string → unit||This function calls upon LDD to display the 2D LEGO artifact you have created. The input to the show2D function is a string (a sequence of alphanumeric characters enclosed in double quotes) which you can use to give a name to your LEGO artifact. Suppose you created a LEGO structure that looks like the flag of Italy. In this case, your show2D function call might be something like
show2D “Flag of Italy”;
|show2D_STL_ASCII : string → unit||This function will create a STeroLithography (STL) version of a Bricklayer artifact. Specifically, the Bricklayer artifact created by the program is written to an stl file called cube.stl. This file can be found at Bricklayer/UserCode/lego-models/cube.stl.
Calling the show2D_STL_ASCII function is conceptually the same as calling the show2D function.
show2D_STL_ASCII “3D print me”;
If your machine has a tool for viewing stl files (e.g., 3D Builder on Windows), then the STL artifact will be displayed using this tool in a manner similar to how LDD views artifacts.
|put2D_1x1_RED, put2D_1x1_WHITE, put2D_1x1_BLUE,
put2D_1x1_YELLOW, put2D_1x1_GREEN, put2D_1x1_GRAY, put2D_1x1_BLACK,
|These functions can be used to put 1×1 bricks of various types at given locations. For example,
will “put” a 1×1 red brick at location (0,0).
|put2D_1x2_RED, put2D_1x2_WHITE, put2D_1x2_BLUE,
put2D_1x2_YELLOW, put2D_1x2_GREEN, put2D_1x2_GRAY, put2D_1x2_BLACK,
|These functions can be used to put 1×2 bricks of various types at given locations. For example,
will “put” a 1×2 green brick at location (0,2).
|put2D_2x1_RED, put2D_2x1_WHITE, put2D_2x1_BLUE,
put2D_2x1_YELLOW, put2D_2x1_GREEN, put2D_2x1_GRAY, put2D_2x1_BLACK,
|These functions can be used to put 2×1 bricks of various types at given locations. For example,
will “put” a 2×1 gray brick at location (3,0).
|put2D_2x2_RED, put2D_2x2_WHITE, put2D_2x2_BLUE,
put2D_2x2_YELLOW, put2D_2x2_GREEN, put2D_2x2_GRAY, put2D_2x2_BLACK,
|These functions can be used to put 2×2 bricks of various types at given locations. For example,
will “put” a 2×2 blue brick at location (3,4).
|put2D_2x3_RED, put2D_2x3_WHITE, put2D_2x3_BLUE,
put2D_2x3_YELLOW, put2D_2x3_GREEN, put2D_2x3_GRAY, put2D_2x3_BLACK,
|Functions that puts 2×3 bricks of various types at given locations. For example,
will “put” a 2×3 yellow brick at location (2,4).
|put2D_3x2_RED, put2D_3x2_WHITE, put2D_3x2_BLUE,
put2D_3x2_YELLOW, put2D_3x2_GREEN, put2D_3x2_GRAY, put2D_3x2_BLACK,
|These functions can be used to put 3×2 bricks of various types at given locations. For example,
will “put” a 3×2 white brick at location (1,1).
|put2D_2x4_RED, put2D_2x4_WHITE, put2D_2x4_BLUE,
put2D_2x4_YELLOW, put2D_2x4_GREEN, put2D_2x4_GRAY, put2D_2x4_BLACK,
|These functions can be used to put 2×4 bricks of various types at given locations. For example,
will “put” a 2×4 white brick at location (1,1).
|put2D_4x2_RED, put2D_4x2_WHITE, put2D_4x2_BLUE,
put2D_4x2_YELLOW, put2D_4x2_GREEN, put2D_4x2_GRAY, put2D_4x2_BLACK,
|Functions that puts 4×2 bricks of various types at given locations. For example,
will “put” a 4×2 red brick at location (2,0).