Theme

Writing Heck

The whole language on one page - for typing a drawing, or writing one from another program.

Heck says what a drawing is. This page is all of it: the words, the marks, every kind of thing and what it takes, what the program works out for itself, and what it writes back. Every example here is read by the program as it stands. Paste one into /source and press Apply to see it.

A file

A header, then a sheet block for each sheet:

HeckerSketch 2
units = ft in

// a comment here belongs to the first sheet
sheet 'Shop'
  scale = '1/4"'
  snap = '1/16"'
  view = 3d
  box Bench = 0 east, 0 north, 0 up; 6' east, 2' north, 3' up
end

The sheet's settings come first and are all optional: units, scale and snap (in quotes, because they are names from the program's own lists: '1/4"', '1/16"'), view (plan, iso or 3d), and the sheet's own ink, width and sides - the defaults for everything on it (sides is how many straight pieces a circle is drawn in, 24 unless said). The program also writes camera and cut there to remember the view; leave them out and it frames the drawing itself. A points block at the sheet's top level only names places: it draws nothing. Text pasted into /source without a header or a sheet is read as one sheet.

The one rule

A line with = is complete. A line without one opens a block, and end closes it. That is the whole block grammar. Every thing has both forms, and you may write either:

line = a to b

line Rafter
  points = a to b
  ink = red
  width = 2
end

A list too long for a line opens a bracket after the = and runs to the line that closes it:

face = (
  p1 p2 p3 p4 p5 p6 p7 p8
  p9 p10 p11 p12
)

A reader skips any block or line it does not know, so a newer drawing still opens in an older program. There is no begin (one is let pass if typed), and nothing in a file ever runs.

Words and marks

Lengths

units =Lengths look like
ft in5' 10 5/8" 4' 18" 3/4" 1.5' 2.84" 5ft 10 5/8in
in, ftthe same marks
mm, m1200 12.5 1200mm 1.2m

Places and steps

A place says all three directions, always: east or west, north or south, up or down. No number in a place is ever negative - the word carries the way. 0 up is on the floor.

2' east, 3' north, 0 up
3' west, 2' south, 6" down
x 2' y 3' z 0                  the letters are read too

A step says only what changes: 4' east, or 3" east, 2" up.

Wherever a place is wanted it may be a place, a name, or a name and a step: a, a + 1" up. In a list, places are joined with to, and + and a step means "from the one before", so a list is a walk:

face = 0 east, 0 north, 0 up to + 4' east to + 4' north to + 4' west

A list of names needs only spaces: face = a b c d, and a..h or ra1..ra24 is every name from one to the other.

Points and rings

A points block names places. Everything in the same block and the blocks inside it can use them, which is what makes a corner shared by three faces one corner:

points
  a = 0 east, 0 north, 0 up
  b = a + 4' east
  c = b + 4' north
  d = a + 4' north
end

b = a + 4' east is how b's place is written down, not a link: change the 4' and b moves, and so does whatever was written from it.

A ring is corners spaced evenly round a circle, said once. Its corners are its name and a number, counted anticlockwise seen from the side it faces:

points
  ring ra
    center = 2' east, 2' north, 2' up
    radius = 1'
    sides = 24
    facing = up
    starts = 15deg       where corner 1 is; 0 if left out
  end
end
face = ra1..ra24

A ring only names corners. Its edge loop is a run of lines like any other - line = ra1..ra24 ra1 goes round and back to the first. A face gets its edges drawn for it; a noface does not (it says which loop of lines is not a face, so the lines must be there).

facing is the way a flat thing looks: up, down, east, west, north, south; one that leans, up, leaning 30° toward east; or three numbers, 0.5 east, 0.5 north, 0.7071 up. Only the direction counts, so the numbers need not make a length of one: 3 east, 4 up is the same as 0.6 east, 0.8 up, and a step can be used as a facing as it stands. starts is measured from east for a thing facing up or down, otherwise from its level line - up x facing: facing east, corner 1 is on the north side of the center; facing north, on the west; facing south, on the east; facing west, on the south.

Every thing

Any thing may have a name after its word - box Lid, line Rafter. Defaults are in brackets; what is left out is the default.

ThingOne lineAs a block
lineline = a to b, or a to b to c for a run of lines - a cable, a pipe route, a ring's edge looppoints; ink, width, soft (false - an edge of a curved surface, hidden but for the outline), ref (false - a reference line). What a block says holds for every line of its run.
circlecircle Hole = center; radius, and a third part, the way it faces, when that is not up: circle Port = 0 east, 0 north, 1' up; 6"; northcenter, radius, facing; starts (0), sides (24), ink, width
arc-center, radius, facing, sweep; starts (0), sides, ink, width
faceface = a b c d, or face = Hole for the disk in a circle (and points = Hole in a block, to paint it)points, hole (as many as it has), paint, ink
nofacenoface = a b c d - a loop of lines that is not a face-
rectrect = corner; size - two parts: 3' east, 2' north lies flat, 3' east, 2' up standsat, size; paint, ink, width
boxbox = corner; size - the low south-west corner and a three-part size - and ; open top for sides left openat, size; open (none - any of top bottom east west north south), paint, ink, width
pullpull = outline; step - pull = Hole; 3' up is a cylinderpoints (corners, or a circle's name: points = Hole), by; paint, ink, width
loftloft = outline; outline; ... - loft Boom = Big; Smallthrough; open (none - start, end or ends), paint, ink, width
solid-paint first, then its points, faces, lines and bores
bore-inside a solid: points (the opening), goes (a step through)
group-locked (false), hidden (false), jig, data, then everything in it
note-at (where the text is), text (a line each, repeated); to (where a leader from it points), size (1: a multiple of the normal text size), ink (its color)
dim-from, to, off (a step: how far and which way the dimension line stands off from the two points); label (text in place of the measured length), ink
guideguide = place to place, or one place for a guide point-
points, const-names, as above

Faces

Faces are what closed lines become, and a face always has edges round it - as in SketchUp, there is no face without them. Twelve lines that close a cube give you its six faces, so a plain face is never written. Write a face only when something about it is not automatic: it is painted, it has a hole the lines would not cut, or it faces the other way.

Solids

A solid is one piece: push/pull moves only its own geometry, and lines drawn against it do not join its edges (a circle or loop drawn on one of its faces in its group still cuts that face, as above). A points block goes inside a solid or a loft; for a box or a pull, name the points in the group around it. It names its corners, then gives its lines, and faces only where needed:

solid Wedge
  paint = gray
  points
    a = 5' east, 0 north, 0 up
    b = a + 1' east
    c = a + 1' north
    d = a + 1' up
  end
  line = a to b
  line = b to c
  line = c to a
  line = a to d
  line = b to d
  line = c to d
end

box and pull are solids in one line. A box is a rectangle pulled up; a pull is any flat outline - corners, or a circle by name - moved a step. The program writes a solid back as a box or a pull while it still is exactly one, and as its corners and lines once it has been changed. A box with a side rubbed out on the sheet is still a box, written with open. A solid that is exactly a box is written as one even if you wrote out its corners, and their names go with them.

Lofts

A loft is a solid that runs through outlines in order - a cone, a reducer, a tapered boom, a fuselage, a duct transition. Each outline is a circle by name or a list of corners, and every outline has as many corners as the first (a circle has its sides, 24 unless said). The first or the last outline may be one point instead, a tip every corner of the outline beside it runs to - a cone, a spinner, a nose. Corner 1 of one outline joins corner 1 of the next, and so on round, so give the outlines the same start (see where a ring's corner 1 is, above) or the sides twist.

// a tail boom: 8" round to 3" round, rising a little
circle BoomFront = 3' west, 0 north, 4' 8" up; 8"; east
circle BoomTail = 21' west, 0 north, 5' up; 3"; east
loft Boom = BoomFront; BoomTail

// a spinner: a circle to a point in front of it
circle SpinnerBase = 9' east, 0 north, 4' up; 6"; east
loft Spinner = SpinnerBase; 9' 10" east, 0 north, 4' up

// an airfoil wing: a points block inside the loft names its corners
loft Wing
  points
    r1 = 0 east, 0 north, 7' up
    r2 = r1 + 16" west, 5" up
    r3 = r1 + 64" west
    r4 = r1 + 12" west, 2" down
    t1 = 0 east, 16' north, 7' 9" up
    t2 = t1 + 12" west, 4" up
    t3 = t1 + 48" west
    t4 = t1 + 9" west, 1 1/2" down
  end
  through = r1..r4; t1..t4
  paint = white
end

// a body through several rings: Nose, Front, Middle and Rear are
// circles drawn before it, all facing the way the body runs
loft Cabin
  through = Nose; Front; Middle; Rear
  paint = red
end

// a duct from 12" square to 6" square, 3' up and offset: open both ends
loft Transition
  through = 0 east, 0 north, 0 up to + 1' east to + 1' north to + 1' west; 3" east, 3" north, 3' up to + 6" east to + 6" north to + 6" west
  open = ends
end

Groups

A group keeps a piece to itself: it is picked, moved, hidden and locked as one thing, its geometry never joins its neighbor's, and groups go inside groups for an assembly. A point or circle named in a group or a solid is known inside it and the blocks within it; a name given at the sheet's top level is known everywhere. Keeping every name different is simplest. There is no paint for a whole group: paint goes on each solid, box or pull.

group 'Hangers'
  locked = true
  jig = 'hangers' with Count = 6, Spacing = 16"
  ...
end

jig names a program that writes the group's contents (see Jigs); data is a block a tool keeps for itself, kept as it is.

What comes back

The program reads Heck into a drawing and writes the drawing out again - on every save, and in /source as you work. What it keeps and what it puts its own way:

A mistake stops the whole Apply, marked on its line with what was expected; nothing on the sheet changes until the text reads.

Examples

A chest with its lid propped open on the back edge, and a post and a plate beside it:

// a chest: a box, and its lid swung up 30 degrees on the back edge
group 'Chest'
  box Body
    at = 0 east, 0 north, 0 up
    size = 3' east, 2' north, 1' 6" up
    paint = brown
  end
  // the front edge has swung up: 2' cos 30 = 20.7846" back,
  // 2' sin 30 = 12" up
  solid Lid
    paint = brown
    points
      h1 = 0 east, 2' north, 1' 6" up
      h2 = h1 + 3' east
      f1 = h1 + 20.7846" south, 12" up
      f2 = f1 + 3' east
    end
    line = h1 to h2
    line = h2 to f2
    line = f2 to f1
    line = f1 to h1
  end
end
// a cylinder is a pulled circle; a circle on a box's top cuts it
group 'Post and plate'
  circle Post = 6' east, 1' north, 0 up; 3"
  pull Column = Post; 3' up
  circle Hole = 9' east, 1' north, 2" up; 3"
  box Plate = 8' east, 0 north, 0 up; 2' east, 2' north, 2" up
end

A round tube from one place along any step - a roll cage, a pipe - is a circle facing the way the tube runs, pulled by the step. The step is its own facing, so there is nothing to work out:

// 1 3/4" tube from the top of the front hoop, back 7" and up 24"
circle HoopTop = 15" west, 62" north, 29" up; 7/8"; 7 south, 24 up
pull UpperHoop = HoopTop; 7" south, 24" up

Tubes meeting at a joint simply overlap there; each stays a tube of its own.

A painted panel with a square window in it:

face Panel
  points = 20' east, 0 north, 0 up to + 4' east to + 4' north to + 4' west
  hole = 21' east, 1' north, 0 up to + 1' north to + 1' east to + 1' south
  paint = #3366CC
end

An open tray on legs, built in groups, is on the Heck page.

What there is not yet: a statement for a turned or swept shape - an elbow, a dome, a sphere (a loft through rings does a lot of it) - and paint on a box, pull or rect written on one line (write it as a block to paint it). A round solid with different ends is a solid of rings with lines between them; an elbow is two pulls meeting, or a loft through rings turned a little each.

A checklist for writing a model

  1. A group for each part, groups inside groups for an assembly.
  2. A name on each part you will want to talk about later, and a comment above it saying what it is.
  3. Name the corners of a solid you write by hand; the names are kept, so a later change can say which corner it means.
  4. Lines, not faces. Faces come from closed lines. Write a face only for paint, a hole, or a way round; use open on a box and noface elsewhere for what is open.
  5. The shorthand where it fits: box for blocks, pull for a profile pushed some distance, circle with pull for round things.
  6. Places exact: every corner of a face on one flat plane, and shared corners written once, by name, so they meet.
  7. Read it back. Paste it into /source and press Apply; a mistake is marked on its line.