g-shell-rect [-b] [-n] [-i _initial_ray_dir_] [-g _cell_size_] [-R _edge_tol_]
[-a "_tol min_x min_y min_z max_x max_y max_z_"] [-p _plotfile_]
[-d _debug_level_] [-X _nmg_debug_] -o _output.g_ _database.g_ _object_ ...
G-SHELL-RECT(1)
NAME
g-shell-rect - build a triangulated shell from a BRL-CAD model by raytracing
On this page
SYNOPSIS
DESCRIPTION
g-shell-rect converts the specified object arguments from a BRL-CAD database.g into a single closed shell, written to a new output.g geometry file as either an NMG solid or a BOT (see the -b option).
The shape is captured by raytracing. Rays are fired in a uniform grid whose spacing is set by -g. The initial firing direction defaults to the principal axis with the largest projected bounding-box area, but may be forced with -i. The initial shell is built from only the first and last hit along each ray, which tends to leave large faces whose normals are perpendicular to the firing direction. Unless -n is given, these faces are subdivided and refined by firing additional rays from the other two axis directions.
The resulting mesh is an approximation of the original geometry and is useful for generating lightweight or watertight surface models from solid BRL-CAD objects. Output can be further processed with tools such as g-stl(1) or g-obj(1).
OPTIONS
- -o output.g
-
Name of the BRL-CAD geometry file to create. This option is required.
- -b
-
Output a BOT (Bag of Triangles) primitive instead of the default NMG (Non-Manifold Geometry) solid.
- -n
-
Skip the refinement stage. Only the initial coarse shell built from the first and last ray intersections is produced; no rays are fired from the secondary and tertiary axis directions.
- -i initial_ray_dir
-
Force the initial ray direction. Valid values are X, Y, or Z (case insensitive). By default the direction presenting the largest bounding-box area is chosen.
- -g cell_size
-
Grid cell spacing in millimeters, controlling resolution. The default is 50.
- -R edge_tol
-
Enable edge breaking (refinement) and set the edge tolerance used when subdividing faces. The default is 0.
- -a "tol min_x min_y min_z max_x max_y max_z"
-
Add a refinement bounding box (RPP). The single quoted argument supplies seven whitespace- or comma-separated numbers: an edge tolerance to use inside the box followed by the minimum and maximum XYZ corners. May be repeated to add several boxes.
- -p plotfile
-
Write a vdraw-style plot file recording the edge-breaking refinement steps, useful for debugging the refinement.
- -d debug_level
-
Set the application debugging level. Higher integers produce more diagnostic output.
- -X nmg_debug
-
Set the NMG library debug flags. The value is read as hexadecimal.
- -h, -?
-
Print a usage message and exit.
EXAMPLES
g-shell-rect -b -g 10 -o shell.g model.g hull
g-stl -o hull.stl shell.g shell
Raytrace the hull region of model.g on a 10 mm grid, writing a Bag of Triangles named shell into the new database shell.g, then convert that shell to an STL file for use in external meshing or 3D-printing workflows.
g-shell-rect -n -i Z -g 25 -o quick.g engine.g block
Build a coarse NMG shell of the block object using only first/last hits along Z-fired rays at 25 mm spacing, skipping the slower refinement pass.
SEE ALSO
brlcad(1), g-stl(1), g-obj(1), rt(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