ASC-NMG(1)

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

πŸ’… 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


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