Next, we will create a couple of variables that we will use
later in the spreadsheet.
You do not need to use a variable; you can enter simple
numbers into the spreadsheet cells. With a variable, you
can define a value once and use it multiple times in the
spreadsheet. You can in the future change the value of the
variable and all the cells in the spreadsheet that use the
variable will track the change.
The array of four buttons towards the bottom of the
spreadsheet window open up sheets. Sheets in Mac OS X are
windows that are attached to a main window, in our case,
the spreadsheet window. Sheets drop down from the title bar
of a window. They are modal, and until they are closed, you
cannot do anything else with the spreadsheet that they are
attached to. You will hear a warning beep from the computer
when you attempt to do anything to the spreadsheet before
closing a sheet.
Click on the Variables
button now. The
sheet will drop from the title bar of
the spreadsheet window.
table consists of three columns. The
first is the name
of the variable, the second is a
that is assigned to the variable,
and the third column is for you to place comments
cocoaNEC does not actually use the comments
column; it is there for you to make notes for yourself.
Notice the plus
table. These buttons are used to
create new variables and to remove existing variables.
Click on the plus
button now to create a new
Notice that cocoaNEC has created a new empty variable item
for you. It has also selected the name field of the new
item, ready for you to enter a variable name.
Type "height" into this field and hit return
the keyboard. Double click on the same row under the
this should select the
field for this variable. You can also hit
the tab key on the keyboard to signal the completion of a
field and selecting the next field.
Type 40' into the value field.
Notice the foot symbol (a single quote) after the number
40. This tells cocoaNEC to interpret the number as a value
in feet instead of in meters. If you had entered 40 without
the foot symbol, cocoaNEC will assume the number is in
meters. For this tutorial example, we want the
variable to be 40 feet.
Hit the return key when you are done entering the value
field. You can click on any part of the variables window to
deselect the "height" row.
sheet should now look like this:
There are some names that are reserved by cocoNEC and
cannot be used as spreadsheet variables. These are the
names of NC types (int
), NC operators
and NC functions
Now create a second variable called "elem" and assign it a
value of 5 (meters).
Click on the "height" row in the table and then click on
button. This should add a new variable
the "height" row. Enter "elem" as the name
and tab over to assign "5" as its value. Since there is no
foot symbol after the 5, this number will be interpreted to
be in meters.
Had you not selected the "height" row before hitting the
button, the new variable would have been
added to the top of the Variables
does not care about the order of the variables in the
If you attempt to define the same variable name twice, you
will receive a warning from cocoaNEC.
Variable names are case sensitive. As far as cocoaNEC is
concerned, the names "reflector" and "Reflector" are
different variables. Spaces are not allowed in variables;
you can use the underscore character instead. Other than
the underscore character, variable names can contain any
upper or lower cased alphabet or a numerical digit, but the
leading character of a variable must not be a numerical
At this point, your Variables
sheet should look
We are done entering our variables. You can now close the
sheet by clicking on the close
button at the bottom right of the sheet.
Next: Creating a Wire Element...