Appendix B
File Contents and formats.

All files associated with MaxCAD are in plain ASCII text. I thought initially that after development was completed I would change them to binary files but they are so small I can't see much to be gained by this change. In addition plane text falls in line with a desire to maintain the open nature of the program.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.1 The Drawing File.

All drawing files have a "dwg" extension. The first 27 lines are the file header. This header looks like this.

Shape File Prefix
Sc
Font File
Schematic.fnt
Limits
-5
-3.75
5
3.75
Grid
True
0.4
Snap Non Ortho
3
0.1,0.1
Zoom
1891.2
Pan
9515
6303
Plot Scale
2
Start Text Height
0.1
Hidden Line
0.2
0.06

The explanatory text was originally included to assist in early debugging of the program. It has been left in for convenience.

The next item is very important. It is the number of objects in the file. Each Arc, Circle, Dial, Line, Shape, or Text, is one object.

I recently experienced an incident in which a drawing file appeared to be empty. Its backup was in the same state. I opened it in Notepad and found that the entire file was there but the number of objects was set to zero. Recovery was easy because each object is numbered in the file. I changed the number to the correct value and the file was recovered. There's a lot to be said for open format. This might or might not have been possible if the file format were binary or even encrypted. Even if possible it certainly would have been much harder.
Each type of object has it's own format. They will be given below.

B.1.1 Object Header.

All objects have a standard header. The format is as follows.

  1. Object Name:

  2. Object Number: Sequential number of the object in the file.

  3. Object Color: An integer representing the color of the object. List follows.

    1. 1. White.

    2. 2. Red.

    3. 3. Yellow.

    4. 4. Green.

    5. 5. Cyan.

    6. 6. Blue.

    7. 7. Magenta.

  4. Object Parameter: This is different for each type of object and will be explained for each one.

B.1.2 Arc.

  1. Object Parameter = Radius.

  2. Center X: X coordinate of Center.

  3. Center Y: Y coordinate of Center.

  4. Starting angle in radians.

  5. Ending angle in radians.

  6. X Flip factor, 1 or -1.

  7. Y Flip factor, 1 or -1.

B.1.3 Circle.

  1. Object Parameter = Radius.

  2. Center X: X coordinate of Center.

  3. Center Y: Y coordinate of Center.

  4. X Flip factor, 1 or -1.

  5. Y Flip factor, 1 or -1.

B.1.4 Dial.

  1. Object Parameter = 15, always. This is the number of parameters necessary to define the dial scale.

  2. Center X: X coordinate of Center.

  3. Center Y: Y coordinate of Center.

  4. Numbers Inside/Outside of arc. 1 = Outside, 0 = Inside.

  5. Numbers oriented for sideways meter. 0 = No, 1.5708 = Yes.

  6. Radius.

  7. Angle Spanned.

  8. Rotation Angle.

  9. Major Marks.

  10. Major Mark Length.

  11. Minor Marks. *

  12. Minor Mark Length. *

  13. CCW Value.

  14. CW Value.

  15. Decimal Places.

  16. Text Height.

  17. Intermediate Marks. *

  18. Intermediate Mark Length. *

* Intermediate marks were added after the file format had been set. It was easier to just add them to the end instead of inserting them in order. It only matters to someone who is digging into the file as you must be now, or you wouldn't be reading this appendix.

B.1.5 Dimension.

Placing a "Dimension" on the drawing board does not create a dimension object. As such the "Dimension" object is really a pseudo object. It causes "Line" and "Text" objects to be created but a dimension object is not created and does not really exist.

B.1.6 Line.

A real world line, as opposed to a theoretical line in geometry, can be fully defined by its end points. As used in this drawing program a line can go from one point, to another, to another, etc. Such a line is fully defined by these turning points plus its end points.

No attempt has been made to make a distinction between a closed figure and an open figure. Thus an open figure made up of 3 line segments might have these coordinates.

0,0
1,0
1,1
0,1

A closed triangle might have these coordinates.

0,0
1,0
1,1
0,0

A few bytes might have been saved by making this distinction but I doubt if it would make much difference in the overall scheme of the universe.

Here are the file contents for a line.

  1. Line Type, 0 = Solid (continuous), 1 = Dashed, (Hidden).

  2. Line Width. Not implemented. Value is always 0.

  3. Object Parameter = Number of points.

  4. X value of point. *

  5. Y value of point. *

  6. * These two repeat as many times as there are points that define the line.

  7. X Flip/Scale factor, any real value.

  8. Y flip/Scale factor, any real value.

B.1.7 Shape.

A shape is not inserted into the drawing. As you will see, only information about the shape is inserted and when the screen must be redrawn or the drawing sent to the printer, or an HPGL file, the shape file is read from disk and inserted at that time.

  1. object Parameter = Scale factor.

  2. Shape file name without extension.

  3. X Flip factor, -1 or 1.

  4. Y Flip factor, -1 or 1.

  5. Insertion (rotation) angle in radians.

  6. X Coordinate of insertion point. *

  7. Y Coordinate of insertion point. *

  8. Footprint X minimum.

  9. Footprint X maximum.

  10. Footprint Y minimum.

  11. Footprint Y maximum.

* This is the location of the 0,0 point in the original shape drawing file.

The "Footprint" information is used when selecting shapes.

B.1.8 Text.

  1. Object Parameter = Text Height.

  2. Text String. String of characters that make up the text object.

  3. Text placement. M = Middle, C = Center, S = Start, and E = End.

  4. Insertion (rotation) angle.

  5. X Coordinate of Placement Point.

  6. Y Coordinate of Placement Point.

  7. Footprint X minimum.

  8. Footprint X maximum.

  9. Footprint Y minimum.

  10. Footprint Y maximum.

As with the Shapes, the "Footprint" information is used when selecting Text objects.

Objects are locked by setting the color number to a negative value. When the object is drawn or printed the absolute value of the color number is read to correctly set the color. When objects are being selected, the routine checks the value of the color number and if it is negative the selection is forbidden.

B.1.9 At the end of the file.

The last four entries are the footprint information for the entire file. This is used only when a ".dwg" file is interpreted as a shape file. The order is this.

  1. Footprint X minimum.

  2. Footprint X maximum.

  3. Footprint Y minimum.

  4. Footprint Y maximum.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.2 MaxCAD_ArrayRec_Data.dat.

This file consists of only 6 lines. They are as follows.

  1. Number of rows.

  2. Number of columns.

  3. Cell spacing or overall array size, (X,Y).

  4. State of "Cell Spacing" button.

  5. State of "Total Array" button.

  6. State of "Enter Dimensions Using Mouse" Checkbox. 0 = unchecked, 1 = checked.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.3 MaxCAD_Help.hlp.

This is an ASCII plain text file. The first line is "". After that the text begins.

Each of the help pages begins with the name of the menu enclosed in < and > signs. The file ends with

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.4 MaxCAD_Last_Group_Open.dat.

This file contains 20 lines. The first is the path to the most recently opened file. The next line is the file name. Subsequent lines are; path, name, path, name, etc. When the file is full it contains 10 paths and 10 names.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.5 MaxCAD-Default.dat.

This file contains 23 lines. They are.

  1. Drawing Board Color in 24 bit RGB.

  2. Default Draw Color in 24 bit RGB.

  3. Grid Color in 24 bit RGB.

  4. Select Color in 24 bit RGB.

  5. Font File Prefix.

  6. Compiled Font File Name.

  7. Text Descender.

  8. Default shape library Prefix.

  9. Plot Scale.

  10. Path to shape and font files.

  11. Default Text Height.

  12. Dashed (Hidden) line Gap.

  13. Dashed (Hidden) line Dash.

  14. Right X limit.

  15. Top Y limit.

  16. Left X limit.

  17. Bottom Y limit.

  18. Grid Spacing.

  19. Grid On/Off.

  20. Snap Spacing.

  21. Snap Status. 0 = off, 1 = X only, 2 = Y only, and 3 = Both.

  22. Line Type reverts to solid after drawing one line.

  23. Default Drawing File Path.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.6 MaxCAD-Dial.DAT.

This file contains 17 lines. They are.

  1. Scale Radius.

  2. Total Angle.

  3. Rotation Angle.

  4. Number of Major Marks.

  5. Major Mark Length.

  6. Number of Minor Marks.

  7. Minor Mark Length.

  8. CCW Value.

  9. CW Value.

  10. Number of Decimal Places.

  11. Text Height.

  12. Center Location, % Height.

  13. Center Location, % Width.

  14. Number of Intermediate Marks.

  15. Intermediate Mark Length.

  16. Numbers Inside/Outside of Arc. 1 = Inside, 2 = Outside.

  17. Numbers oriented for sideways meter. 0 = No, 1 = Yes.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.7 MaxCAD-PrntSet.dat.

This file contains 5 lines. They are.

  1. Print Scale.

  2. Printer X offset.

  3. Printer Y offset.

  4. Printed line width.

  5. Landscape mode, 0 = No, 1 = Yes.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.

B.8 Schematic.fnt.

Because this feature has not been implemented the file contains numbers from 32 to 126 alternating with zeros. This file actually serves no useful function at the present time.

Back to Fun with Transistors.
Back to Fun with Tubes.
Back to Table of Contents.
Back to top.