-------------------------------------------
var,funct: write stereolithography/3D printer surface
  set outsurf <surface>
  write_stl_surface
-------------------------------------------

Large Panel Only: [fn-]F3

The "STL" button on the "outsurf:" line on the
large fn-F3 panel writes out current surface as a
STL (stereolithography for 3D printer) ASCII file
whose name is current value of $outsurf (entry at
left) after auto-appending ".stl" if it isn't
already there.

The button checks overwrite but the equivalent
tclfunct, write_stl_surface, doesn't.

The vertex coordinates are translated into the
all-positive octant, but are otherwise native
freesurfer coordinates.  The units are
millimeters.

The format of the file is written as:

  --line 1: solid <object-name>
  --line 2: facet normal <xn> <yn> <zn>
  --line 3:  outer loop
  --line 4:   vertex <x> <y> <z>
  --line 5:   vertex <x> <y> <z>
  --line 6:   vertex <x> <y> <z>
  --line 7:  endloop
  --line 8: endfacet
  ...
  ... [to vertex-count groups each like line2-8]

For example, a .stl file looks like this
(indented below, but natively left justified):

  solid marser-qT1
  facet normal 0.058335 -0.992071 -0.096673
   outer loop
    vertex 26.366608 0.001556 22.375313
    vertex 26.245121 0.032227 22.085220
    vertex 26.731939 0.047028 22.294407
   endloop
  endfacet
  ...
  ...
  facet normal -0.994432 0.085947 0.060131
   outer loop
    vertex 6.264633 235.800507 63.428627
    vertex 6.239880 234.987000 64.281990
    vertex 6.389610 236.444626 64.618721
   endloop
  endfacet
  endsolid marser-qT1
