G-STL(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… G-STL(1) β€” the BRL-CAD manual page, but make it make sense πŸŽ€

okay bestie so this is g-stl from the BRL-CAD fam (yes that BRL-CAD, the one your CAD professor keeps hyping) β€” let's get into it ✨


✨ NAME ✨

g-stl β€” convert BRL-CAD geometry to the STL file format πŸ¦‹ like, it takes your big fancy BRL-CAD model and turns it into something a 3D printer can actually vibe with.


🌸 SYNOPSIS 🌸

g-stl [-bvi8] [-x rt_debug] [-X nmg_debug] [-a abs_tol] [-r rel_tol] [-n norm_tol] [-D dist_tol] [-o output_file.stl | -m directory] database.g object ...

no cap, that's the whole shape of it πŸ’–


πŸ‘‘ DESCRIPTION πŸ‘‘

g-stl converts the specified object(s) from a BRL-CAD database.g file into the stereolithography (STL) file format by tessellating the geometry into triangle facets via the NMG boolean evaluator. Lowkey the whole point: it smashes your smooth geometry into lil triangles so machines can read it. STL is widely used for 3D printing and rapid prototyping β€” it's giving "the people's format" ngl πŸ–¨οΈβœ¨

By default an ASCII STL stream is written to standard output. With -o a single STL file (ASCII or, with -b, binary) is produced; with -m each region is written to a separate file in the named directory, with the region's path name mangled into the file name ("/" becomes "@" and spaces or periods become "_"). Yes, mangled β€” that's the actual word and the actual behaviour, she's a little chaotic but she works πŸ’…

⚠️ Binary output cannot be sent to standard output. So if you pass -b you need -o or -m, no exceptions, periodt.

Output units default to millimeters; see -i. Related converters include g-obj(1), g-ply(1), and stl-g(1) for the reverse direction (iykyk β€” that one goes STL β†’ BRL-CAD πŸ¦‹).


✨ OPTIONS ✨

  • -b β€” Write a binary STL file instead of the default ASCII format. Compact, slay, chef's kiss. But binary output cannot be written to standard output, so -o or -m is required β€” fr fr, don't skip that part.
  • -v β€” Enable verbose output, reporting object names, tolerances, and conversion statistics. Main character energy: she tells you everything she's doing πŸ—£οΈ
  • -i β€” Use inches as the output units (the default is millimeters). USA USA πŸ‡ΊπŸ‡Έ lol.
  • -8 β€” Tessellate using the marching cubes algorithm rather than the default NMG boolean evaluation. Different vibe, different triangles πŸ’€
  • -a abs_tol β€” Set the absolute tessellation tolerance in millimeters (the maximum chord deviation). Setting this clears the relative tolerance. So it's one or the other, bestie β€” no having both 🫢
  • -r rel_tol β€” Set the relative tessellation tolerance as a fraction of the bounding box (default 0.01).
  • -n norm_tol β€” Set the surface normal tessellation tolerance in degrees. Setting this clears the relative tolerance. Same deal as -a πŸ’œ
  • -D dist_tol β€” Set the calculation distance tolerance in millimeters used to decide whether two vertices are coincident (default 0.0005). Tiny number, huge consequences 🧚
  • -x rt_debug β€” Set the librt debugging flags as a hexadecimal value. Debug girlies rise πŸ”₯
  • -X nmg_debug β€” Set the libnmg debugging flags as a hexadecimal value. Same energy, different library.
  • -o output_file.stl β€” Write all converted geometry to the named output file. Mutually exclusive with -m β€” pick a lane, bestie πŸ’…
  • -m directory β€” Write each region to its own STL file inside the named directory. Mutually exclusive with -o. One solid per file, very organized of her 🌈
  • -h, -? β€” Print a usage message and exit. The "help I forgot the flags" button πŸ™ˆ

πŸ“ EXAMPLES πŸ“

Example 1. Convert a component to a binary STL file for 3D printing

g-stl -b -i -a 0.1 -o bracket.stl model.g bracket

Tessellates the bracket region from model.g with a 0.1 mm absolute tolerance, writing a compact binary STL in inch units suitable for slicing and printing. Cute, tiny, printable β€” she ate πŸŽ€

Example 2. Export every region of an assembly to separate files

mkdir parts
g-stl -m parts model.g assembly

Walks the assembly tree and writes one ASCII STL file per region into the parts directory, each named after the region's full path. This is convenient when downstream tools expect a single solid per file. Iconic behavior honestly πŸ‘‘


🌈 SEE ALSO 🌈

brlcad(1), stl-g(1), g-obj(1), g-ply(1), g-dxf(1), mged(1)

(the whole converter friend group πŸ’–)


πŸ’œ AUTHOR πŸ’œ

BRL-CAD Team β€” legends, no notes.


This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.


πŸ¦‹ BUG REPORTS πŸ¦‹

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org

not me telling you to email your bugs, but like, do email your bugs πŸ“§πŸ˜­

aaaand that's the page! mwah πŸ’‹ β€” with love from the BRL-CAD crew, dated all the way back to 1989 and running through 2026, G-STL(1) forever 🫢✨

πŸ“¦ where this page comes from