Scripting masks in L-edit

This is a step-by-step guide which will introduce you to scripting masks in L-edit. The advantage of scripting masks in l-edit is that you can take advantage of programming strengths such as loops for creating repeating structures, or easily define variable dimensions. The masks created are usually for photolithography used in micro-fabrication. Most of the documentation for the code can be found in the L-Edit User Guide page 1726 and forward.

The Basic Script
Scripting in L-edit is done by creating a macro. Therefore this is the most basic script:

This script defines the module which contains all our functions, loads all the necessary c-language libraries, loads our Measurements file (which is empty), creates the register function, and an empty function. Finally the script calls the register function.

The register function is special. It registers the macro "My design" with L-edit and links a call to this macro with the function "createDesign".

Masks in L-edit are built up from different cells. These cells are then instanced into each other to create the chips, and finally the mask.

Adding a new layer
Each mask is drawn on a separate layer. The following code will generate a new layer: There are several points in this code which deserve explanation. The  is defined by a call to the   function which we have not defined yet. It simply returns a reference to the file which is currently being edited. The color index of 2 gives a green color. Other possible indexes are given in the table:

Another important point is the fill pattern. The fill pattern is generated by an 8 by 8 matrix. Each row is assigned an integer value. This value defines which cells are filled (1) or empty (0) based on the base-2 conversion of the integer. A value of 255 equals. A value of 51 equals. To create a striped pattern you could use: which corresponds to:

Creating the first cell
Now that we have created a layer upon which we can draw, we can create our first cell. This is done with the following code: At this point we start using the Measurements file. The two integer values:  and   are defined in our Measurements file: The  function takes six arguments: There are other functions which can be used to draw with such as:
 * which cell to draw in
 * which layer to draw on
 * the bottom left x-coordinate
 * the bottom left y-coordinate
 * the top right x-coordinate
 * the top right y-coordinate.

However, in order to be able to run the script multiple times (which happens frequently when drawing a new mask), we must reinitialize the cell every time: This code essentially deletes the cell at the start of the script to ensure that objects which have been removed from the code are also removed from the mask. In the event of an error (which might happen when trying to delete a cell which is instanced somewhere else) the function calls  to translate the error. This function is defined below:

Instancing a cell
In order to instance a cell the following code is used: This code places an instance of our cell  at (0, 0) in the (undefined) cell. The code to instance the cell has a lot of functionality. It can:
 * translate the cell to any x, y coordinate
 * magnify the cell up or down
 * place multiple copies of the cell
 * rotate the cell