BRLCAD_BIN=/path/to/brlcad/bin python gen_object_types.py # rebuild all
BRLCAD_BIN=/path/to/brlcad/bin python gen_object_types.py ell tor # rebuild some
Object-type catalog figure generator
On this page
This directory generates the figures used by
doc/asciidoc/articles/object_types.adoc. The objtype_*.png images in the
parent images/ directory are a committed snapshot: the documentation build
consumes them like any other image, and this generator is the developer tool
that refreshes them from the actual built BRL-CAD tools.
Every pixel of every figure — the shaded solids, the edge lines, and all the on-image text — is produced by BRL-CAD tools. No image-drawing library is used.
Pipeline
For each object the generator:
-
probes the object with
rt(autoview) to learn the view and how much of the frame the object fills, then picks aviewsizeso it fills ~80% of the frame; -
ray traces the shaded solid with
rtinto a disk framebuffer; -
overlays silhouette + crease edges with
rtedge(overlay,detect_distance,detect_normals) so every shape reads clearly; -
draws the parameter callouts (arrows, vectors, dimensions, labels) with
fblineandfblabel; -
grabs the framebuffer to PNG with
fb-png.
Variety montages render each cell the same way (with a fblabel caption burned
in) and then tile the finished cells into a grid.
Python is used only to orchestrate the tools, to project 3D parameter points to
2D pixels (reconstructed from the exact view rt reports, so callouts land on
the geometry), and for image I/O (measuring the object extent, tiling montage
cells).
Files
-
objtype_lib.py— tool drivers, the projection/Viewhelper, the framebuffer drawing primitives, andrender/render_cell/montage. -
gen_object_types.py— one builder per object type plus a registry.
Requirements
-
A built BRL-CAD (
rt,rtedge,mged,fbline,fblabel,fb-png,png-pix, …). -
Python 3 with
numpyandPillow(measurement / montage tiling only).
Usage
If BRLCAD_BIN is unset the script looks for a build under out/build/… or
build/ relative to the repository root.
Platform notes
-
The disk framebuffer only behaves at dimensions >= 512, so cells are rendered at 512 and downsampled.
-
A framebuffer device name is always a bare relative name (a
D:...path is misread ashost:port), and the tools are run with their working directory set to this scratch directory; data files (dsp,ebm,vol) are likewise referenced by bare basename. -
nmgis a real facetize -n solid, ray traced single-threaded (-P1): the NMG hitmiss freelist (re_nmgfree) is a process-global that is not thread-safe, so parallel shooting races. Two libnmg init fixes (src/libnmg/isect.c, innmg_isect_ray_model) make the single-threaded path correct. -
submodelis a real instanced submodel; a librt path-resolution fix (src/librt/primitives/submodel/submodel.c,rt_submodel_resolve_path) lets it find a relativefile=next to the parent.g. -
clineis built withput(its tcl keys areV H R T). -
Scratch files (
_*) are temporary and are not committed.