Skip to documentation
DocumentationAll documentsEnglish

G-PLY(1)

NAME

g-ply - convert BRL-CAD geometry to a Stanford PLY file

On this page

SYNOPSIS

g-ply [-v] [-s] [-t _type_] [-a _abs_tol_] [-r _rel_tol_] [-n _norm_tol_] [-D _dist_tol_] [-x _rt_debug_] [-X _nmg_debug_] -o _output.ply_ _database.g_ _object_ [_object ..._]

DESCRIPTION

g-ply converts the listed object(s) from a BRL-CAD database.g to the Stanford PLY (Polygon File Format) geometry file named by -o. Each object is tessellated into a faceted mesh by way of the NMG booleans before being written, so any solid, region, or combination that can be evaluated to a triangle mesh may be exported. The output may be ASCII or binary PLY, and by default all requested objects are merged into a single file.

OPTIONS

-o output.ply

Name of the PLY file to write. This option is required. When -s is given, this name is appended as a suffix to each per-object file, which is named object**_output.ply.

-s

Write a separate PLY file for each object instead of merging all objects into a single file.

-t type

Select the PLY encoding. Valid values are asc for ASCII, le for binary little-endian, and be for binary big-endian.

-a abs_tol

Absolute tessellation tolerance in millimeters (the maximum chord distance between the true surface and a facet edge). Setting this clears the relative tolerance. Default is 0.0 (disabled).

-r rel_tol

Relative tessellation tolerance, expressed as a fraction of the bounding-box size of the object. Default is 0.01.

-n norm_tol

Surface normal tessellation tolerance, the maximum angle in degrees between facet normals. Setting this clears the relative tolerance. Default is 0.0 (disabled).

-D dist_tol

Calculational distance tolerance in millimeters used when deciding whether two vertices are coincident. Default is 0.0005.

-x rt_debug

Set the librt debug flag to the given hexadecimal value.

-X nmg_debug

Set the libnmg debug flag to the given hexadecimal value.

-v

Enable verbose output during conversion.

-h, -?

Print the usage message and exit.

EXAMPLES

Example 1. Export a single ASCII PLY for downstream tools
g-ply -t asc -a 0.5 -o widget.ply widget.g body bracket

Tessellates the body and bracket objects from widget.g with a 0.5 mm absolute tolerance, merging them into one human-readable ASCII PLY file that can be inspected or imported into mesh editors and 3D printing slicers.

Example 2. Write one binary mesh per object
g-ply -s -t le -r 0.005 -o parts.ply assembly.g part1 part2 part3

Produces a compact little-endian binary PLY for each of part1, part2, and part3 using a tighter relative tolerance, keeping the individual components in separate files for per-part processing.

SEE ALSO

brlcad(1), ply-g(1), g-stl(1), g-obj(1), mged(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