STL2GBR Command Line Syntax

Those that wish to use the stl2gbr converter by calling it from another program or from a script should use the syntax shown below:


The command line uses the following syntax:

 stl2x.exe  input_file  output_file  target_layer(s) -z:z_value(s) -gbr [options]

stl2x.exe        name (and path) of the gbr2stl engine; 
                 must also include -gbr option

input_file       name (and path) of the input file which must be an .stl file

output_file      basename (and path) of the output file (which is gerber file)

target_layer(s)  layer on which to produce the Gerber data - each layer
                 will be appended to the Gerber basename.
                (also a comma delimited list) i.e. 0,1,2,3

-z:z_value         the z_value for the "slice" 
                 (also a comma delimited list) i.e. -z:1,2,3,4

-gbr             create Gerber output format. required option.


-incr          the -incr (increment) parameter is used when the designer 
               wants a series of equally spaced slices commencing at a given 
               Z value and rising by the increment amount.

-linc          the layer increment controls the stepping of the gerber layer 
               name and is used together with the -incr command line if the 
               layer increment is to be a value other than 1.

-info          instead of actually performing the slicing and conversion, 
               the -info command instructs the stl2gds engine to calculate 
               the X,Y,Z extents and to count the number of facets in the 

-scale:X instructs stl2gbr to scale up (or down) the data by the scale value X. Default = 1. -units:UNIT units of the output Gerber file: MM and INCH are the only valid units for Gerber data. Default = MM -format:I.J output format of the Gerber data. Valid range is 1.1 to 3.5 but in any event, I+J must be less than or equal to 8. if not specified the program will choose the format based on the extents of the data.


The following examples should help clarify the function of the command line arguments.

Example 1    Getting Info

 stl2x.exe stlinput.stl out.gbr -info

This command line executes stl2gbr on the input file stlinput.stl. It does not produce a Gerber output file (even though one must be listed on the command line); because of the -info argument it scans the STL file and outputs a file called out.log to disk that contains the X,Y,Z extents and the number of facets in the file.

Example 2    Slice at Z=0.1

 stl2gbr.exe c:\test_files\input.stl c:\test_files\results\output.gbr  1 -z:0.1  -gbr

in this example stl2gds will process a file called input.stl, slice it at Z=0.1 and output the results to a file called output.gbr (note that input.stl and output.gbr are not in the same directory). Since the user failed to supply a unit argument the GBR file will be in units of MM and the output format is determined by the "extents" of the STL file. This is not a recommended command line - the designer should always specify the units and grid values.

Example 3    Multiple Slices, Comma Delimited

stl2x.exe input.stl output.gbr 1,7,19 -z:1.5,3.2,0.8 -units:MM -format:3.4

In this example stl2gbr will produce multiple Gerber files:

elevation    Gerber File Name
  1.5           output_1.gbr
  3.2           output_7.gbr
  0.8           output_19.gbr

by using a comma delimited list for the target layer numbers and the z values for the slices.

Example 4    Multiple Slices, Incremented

stl2x.exe input.stl output.gbr 1 -z:0.1 -incr:0.02 -units:MM -format:3.3 -gbr

In this example stl2gbr will produce multiple Gerber files starting at z=0.1 and incrementing by Z=0.02 until it reaches the "top" of the data extents. Assuming the Z values top out at 2.1 the following layers would be produced.

Z Elevation        Gerber File Name
  0.10 MM            output_1.gbr
  0.12               output_2.gbr
  0.14               output_3.gbr
  0.16               output_4.gbr
  0.18               output_5.gbr
  0.20               output_6.gbr

Example 5    Multiple Slices, Incremented II

stl2x.exe in.stl out.gbr 0 -z:0.1 -incr:0.02 -lincr:5 -units:MM -format:4.3  -gbr

In this example stl2gbr will produce data on multiple layers starting at z=0.1 and incrementing by Z=0.02 until it reaches the "top" of the data extents. Assuming the Z values top out at 2.1 the following Gerber files would be produced. The Gerber file names corresponding to these slices begin at 0 and are incremented by 5.

elevation        gdsii layer number
  0.10 MM            out_0.gbr
  0.12               out_5.gbr
  0.14               out_10.gbr
  0.16               out_15.gbr
  0.18               out_20.gbr
  0.20               out_25.gbr

Example 6    Scaling & Units

stl2x.exe input.stl output.gbr 1  -z:.1 -scale:0.03937 -units:inch -format:2.4 -gbr

In this example the STL file was output in units of millmeters but the Gerber file should be in units of inches.(It is not clear in practice why one would want to do this ...) This requires that the data be scaled down by .03937

elevation        Gerber File Name
  .1(mm)             output_1.gbr
Details Download Revision History Price