ASC-NMG(1)
π ASC-NMG β the girlies are converting ASCII NMG to a real database β¨
okay so real talk, this is the asc-nmg page from the BRL-CAD manual set, and it's genuinely one of the most underrated little tools in the whole kit. sit down, bestie, we're building solids out of plain text π«Ά
β¨ NAME β¨
asc-nmg β convert an ASCII NMG description to a BRL-CAD database π
π SYNOPSIS π
asc-nmg [-h | -?] [filein | -] [fileout]
π¦ DESCRIPTION π¦
So asc-nmg reads a simple ASCII description of an n-manifold geometry (NMG) solid and writes out a binary BRL-CAD geometry database (.g) containing the resulting NMG object. periodt. π
heads up, bestie: the input is not a standard BRL-CAD .asc geometry database. it's a line-oriented list of loops and vertices β the whole serve is below π
If filein is omitted, or you pass it as -, the description gets read from standard input (very demure, very stdin). If fileout is omitted, the database goes to a file named nmg.g in the current directory. Iconic default, honestly.
The output database always contains a single NMG solid named s.nmg inside a region named r.nmg. No notes. π§
πΈ the input token tea πΈ
The ASCII input is made of whitespace-separated tokens, and here's every single form they can take:
β starting a new outer loop
To start a new outer (counter-clockwise) loop for a face:
l
β starting a hole loop
To start a new "hole" (inner) loop in the current face:
l hole
β defining a vertex with coords
To define a vertex and its coordinates in the current loop:
v# x y z
where # is an integer vertex number (like v0 or v1) and x, y, z are its coordinates. so v0 1 -1 -1 is literally saying "vertex zero, right here, these coords, slay" β¨
β reusing a vertex
To reuse a previously defined vertex in the current loop, just omit the coordinates:
v#
β extruding the first face
To extrude the first face by a vector:
e x y z
where x, y, z form the extrusion vector.
π the part where you have to be careful π
If you supply an extrusion vector, the first described face gets extruded to form a solid. This is intended for the case where exactly one face is described. π
Supplying an extrusion vector when more than one face is present may produce erroneous results. like, no cap, don't do it.
Otherwise (no extrusion vector), you need to describe enough faces to form a closed shell. fr fr, the geometry has to actually close.
And remember: each run of asc-nmg produces a single NMG object. one run, one object, no crumbs. π
π OPTIONS π
-h,-?β print a usage message and exit.
and that's genuinely it. asc-nmg takes no other options β all remaining arguments are interpreted as file names. that's the whole menu, bestie π
π₯ EXAMPLES π₯
Example 1. Extruding a face into a solid
With filein.txt containing a single face plus an extrusion vector:
l
e -1 0 0
v0 1 -1 -1
v1 1 1 -1
v2 1 1 0
v3 1 0 0
v4 1 0 1
v5 1 -1 1
the command:
$ asc-nmg filein.txt sample.g
extrudes the 'L'-shaped face along the vector (-1, 0, 0) to build a solid NMG object in sample.g, which can then be raytraced with rt(1) or viewed in mged(1). go off, sample.g π
Example 2. Creating a face with a hole and converting to facetized geometry
A square outer loop with a square inner hole loop (inner loop wound opposite to the outer loop β remember this, it matters π):
l
v0 0 0 0
v1 10 0 0
v2 10 10 0
v3 0 10 0
l hole
v4 2 2 0
v5 8 2 0
v6 8 8 0
v7 2 8 0
$ asc-nmg square_with_hole.txt square.g
$ mged square.g facetize s.nmg bot.nmg
The first command produces a single planar NMG face containing a square hole; the second converts that NMG into a BoT primitive for further processing. literally the glow-up arc of your geometry ππ
π«Ά SEE ALSO π«Ά
brlcad(1), mged(1), rt(1), g-stl(1), asc2g(1)
π AUTHOR π
BRL-CAD Team
π COPYRIGHT π
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. tell them everything, be dramatic, they can take it π
and that's the whole page, bestie β you're now fully fluent in ASCII NMG π β¨
courtesy of the BRL-CAD crew, page ASC-NMG(1), copyright 1989-2026 β go build something iconic π¦
π¦ where this page comes from
- nixpkgs unstable: brlcad 7.44.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms