Cellular Automata Laboratory

JC Pattern Design

A good source of patterns is CelLab's library of predefined patterns, which we list in the first subsection. These patterns can be doctored by using the JC screen editor, along with the buffers and the logical operations. It is also quite easy to create patterns from scratch by using the JC Pattern Editor Menu.

The remaining subsections outline a technique by which CelLab can be used as a tool for professional graphic design. We provide you with two special utilities so that CelLab image processing can be inserted as an intermediate step between the creating of an image in AutoCAD or AutoSketch and the printing out of the image on a PostScript® printer. The subsections tell how to feed an AutoCAD or AutoSketch image to CelLab, and how to turn the resulting CelLab image into PostScript. Please write us as soon as you are able to sell a client an image created in this way; we'd like to have a record of such an historic first.

Predefined Patterns

A number of predefined patterns are supplied with CelLab. All are in compressed format. To see the list, type P Enter in JC or type dir *.jcp in DOS.

You can use these patterns "right out of the box," and you can also compose other patterns by loading them, storing them in the simulator's buffers, and then using the operations on bitmaps to perform logical operations to combine the patterns. Note that the arrow keys actually scroll the bitmap, not just the screen, so you can load a pattern, scroll it to where you want it on the screen, save it in a buffer, then load another pattern and combine it with the shifted pattern by performing a logical OR between the bit plane containing the second pattern and the buffer holding the shifted version of the first.

Since the scroll keys truncate material scrolling off the screen when used in open mode, you can crop patterns by flipping to open world mode with F3 (or with Alt-F8), scroll to delete unwanted material, then flip back to torus mode if that's the mode you'll be using for the simulation.

Converting AutoCAD Images to CelLab Patterns

AutoCAD provides a large collection of facilities for editing graphical images. CelLab users with access to AutoCAD may take patterns out of AutoCAD and feed them to CelLab. CAD/CAM indeed! By far the easiest way to get patterns from AutoCAD into the CelLab is printer plotting the AutoCAD image, then converting the plot into a CelLab pattern with a utility program called PRPJCP furnished with CelLab. This technique was used to create the BILLBORD, BIGLOGO, GRID, STARTREK, and TEAPOT patterns supplied with CelLab. Converting a printer plot into a pattern faithfully transmits the image but does not allow precise positioning of individual cells. Before we can make a printer plot into a pattern we need a suitable printer plot. Configure AutoCAD to use the Autodesk Device Interfacetm Printer Plotter driver, and answer the configuration prompts as follows (prompts not listed may be answered as you like):

Specify plot size in millimeters? <N> N
Maximum horizontal (X) plot size in inches <>: 320
Printer dots per inches in the
   horizontal (X) direction <>: 1
Maximum vertical (Y) plot size in inches <>: 200
Printer dots per inches in the
   vertical (Y) direction <>: 1

Output format, 0 to 2 <>: 0
Does the printer plotter support color? <> Y

 ...calibration...see below

Enter the Size or Width,Height in Inches) <>: 320,200

If you use the default "calibration" for aspect ratio, squares in the AutoCAD drawing will be converted to rectangles taller than they are wide when mapped to the VGA or CGA bitmap (the distortion is usually more extreme on the CGA, depending on how the monitor is adjusted). You can calibrate the printer plotter driver to compensate for this. First use the default calibration and plot a square that just about fills the screen. Use PRPJCP to make a pattern from the plot and load it. Measure the pattern on the screen and enter the actual sizes. Use the actual height for both the vertical and horizontal desired heights. When you calibrate the driver, you'll need to re-enter the response to the:

Enter the Size or Width,Height in Inches) <>: 320,200

prompt as indicated. After you've calibrated the driver you will see some odd-looking numbers for the sizes if you later reconfigure. Don't worry, AutoJCD knows what it's doing.

Patterns are prepared as AutoCAD drawings. You may specify bitplane assignments by setting the AutoCAD color number to the binary value you wish to assign to the lower 4 bit planes.

Since AutoCAD printer plot files output only 4 bits of color information, only states 0 through 15 may be set using this program.

AutoCAD       Plane Bits
 Color        3   2   1   0

0 Black       0   0   0   0
1 Red         0   0   0   1
2 Yellow      0   0   1   0
3 Green       0   0   1   1
4 Cyan        0   1   0   0
5 Blue        0   1   0   1
6 Magenta     0   1   1   0
7 White       0   1   1   1
8             1   0   0   0
9             1   0   0   1
10            1   0   1   0
11            1   0   1   1
12            1   1   0   0
13            1   1   0   1
14            1   1   1   0
15            1   1   1   1

All other colors are taken modulo 16, with zeroes changed to 7s (not terribly useful, but that's how AutoCAD does it). You can also convert monochrome printer plot files, but such files may only be used to set bits in plane 0.

Use the PRPLOT command to generate a printer plot (.prp) file, then convert it to a CelLab pattern file with the command: PRPJCP plotname where plotname is the name of the AutoCAD-generated printer plot file, with no file type specified. PRPJCP reads the printer plot file and emits a CelLab pattern named plotname.jcp. The pattern files generated by PRPJCP are in uncompressed format. If you want to create a compressed pattern file from a printer plot, make an uncompressed file with PRPJCP, load that file into JC, then save it as a compressed file by pressing Ctrl-F4. The default pattern-save-mode of JC is compressed.

Converting AutoSketch Images to CelLab Patterns

AutoSketch printer plots can be converted to .JCP files using the same PRPJCP utility that converts AutoCAD images. You'll need AutoSketch 2.0--earlier releases don't include the ADI® printer plotter driver that writes the files PRPJCP reads. Configure AutoSketch for the pointing device and display you normally use, but use the following dialogue to configure the plotter:

Select plotter:
3. Autodesk Device Interface Printer
Plotter selection: 3
Select output format:
1. Binary file
Output format 1 or 2 <2>: 1
Specify plot size in millimeters? <N>: N
Maximum horizontal (X) plot size in inches <11.0>: 3.2
Printer dots per inch in horizontal (X)
    direction <100.00>: 100
Maximum vertical (Y) plot size in inches <8.50>: 2
Printer dots per inch in vertical (Y)
    direction <100.0>: 100
Does the printer support color? <N>: Y

Use AutoSketch to create the pattern, then make a plot of it by selecting Plot Area and entering 3.2 in the "X Plot Size" box and 2 in the "Y Plot Size" box. Select "OK", then move and scale the resulting plot box to enclose the material you want plotted. The size and shape of the plot box accurately reflects what you'll see on the screen in CelLab. You can assign CelLab state codes 1 through 7 to the standard AutoSketch colors by selecting "Pen Info" and assigning pen numbers equal to the desired state codes to the colors in your drawing. Finally, make a plot. This will write a .PRP file, on which you run PRPJCP. The resulting .JCP file may be loaded directly into CelLab.

Converting CelLab Patterns to PostScript

If your computer has a screen dump utility, it is usually possible to print a CelLab pattern by pressing Print Screen or Shift-Print Screen. But the results of screen dumps are unpredictable and can be difficult to repeat. For commercial image generation it is much better to use Ctrl-F4 to save a satisfactory pattern to a .JCP file and to then convert the .JCP file to PostScript.

If you have a PostScript printer, you can print patterns by converting them to PostScript with the JCPPS utility supplied with CelLab. PostScript files produced by JCPPS may also be included in many publishing systems, allowing inclusion of illustrations of CelLab screens in documents. To generate a PostScript representation of a pattern, first save the pattern into a .JCP file with Ctrl-F4. You can save the pattern in either compressed or uncompressed form. Exit CelLab to return to DOS, then enter the command:

jcpps [options] patfile

where patfile is the name of the pattern file you saved. JCPPS.EXE and your .JCP pattern file must be in the same directory. Don't specify the .JCP file type--it is added automatically by JCPPS, which places the PostScript output in a file with the same name but with file type .PS. You may send the PostScript to your printer or use it in other ways as with any PostScript file. JCPPS normally produces a PostScript image that prints in "landscape" mode: the horizontal edge of the screen is aligned with the long direction of the paper. This fills the page and provides higher resolution, but if you're including the image in a publishing system it results in the image standing on its end. To prevent this, specify the "-P" option to select "portrait" orientation; the image will appear at the bottom of the page with the bottom of the screen drawn along the short direction of the paper.

The output from JCPPS is by default a complete PostScript file including a header and showpage command to print the image. If you set the "-R" option JCPPS writes, instead, a "raw" PostScript file consisting only of the image operator that defines the pattern bit map.

Back to The JC Program

Onward to The JC Rules

Next Previous Contents