gex [-h] [-f] [-c] [-d _objectname_] input.g [output.g]
GEX(1)
NAME
gex - examine, summarize, and compress a BRL-CAD geometry database
On this page
SYNOPSIS
DESCRIPTION
gex reads a BRL-CAD V5 geometry database (a .g file) and reports statistics about its contents. For each stored object it prints the DLI (H-flag) category, the major and minor type codes, and the object name, noting which objects carry attributes and which combinations are regions. A summary then tallies the number of free-storage, named, and other objects, the counts for each DLI/major/minor type, and the total amount of unused free space accumulated in the file.
The input database is opened read-only and is never modified.
With the -c option, gex writes a compacted copy of the database to output.g, omitting the free-storage blocks that build up as objects are created and deleted during modeling. If output.g is not given, the copy is written to input.g*.compressed.g*. This is a lossless alternative to round-tripping a model through g2asc(1) and asc2g(1), which can introduce numerical error.
The -d option hex-dumps the raw bytes of a single named object, which is useful for low-level inspection of how an object is encoded on disk.
OPTIONS
- -h, --help
-
Print a usage message and exit.
- -f, --force
-
Allow an existing output.g file to be overwritten. Without this option, gex refuses to clobber an existing output file.
- -c, --compress
-
Write a copy of the database to output.g with all free-storage blocks removed. If no output file is named, the copy is written to input.g*.compressed.g*.
- -d objectname, --dump objectname
-
Print a canonical hexadecimal dump of the raw on-disk bytes of the object named objectname.
EXAMPLES
gex model.g
Summarizes every object in model.g, listing DLI/major/minor types, combinations, regions, attributed objects, and the total free space in the file.
gex -c -f model.g model-clean.g
Writes a compacted copy of model.g to model-clean.g with unused free-storage blocks removed, overwriting model-clean.g if it already exists. Databases that have had many objects created and killed can shrink dramatically; for example a file bloated to tens of megabytes by repeated edits can collapse to a small fraction of its size with no loss of geometry.
gex -d sph1.s model.g
Prints a canonical hexadecimal dump of the raw bytes of the object named sph1.s, in addition to the usual database summary.
SEE ALSO
brlcad(1), asc2g(1), g2asc(1), gqa(1), mged(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