brep — The brep command is the primary means in BRL-CAD for working with NURBS boundary representation objects (a.k.a brep objects). Because there is a large amount of functionality implemented for this purpose, the brep command defines subcommands to organize these capabilities.
brep
{obj
} [ bool
| bot
| bots
| brep
| csg
| flip
| info
| intersect
| pick
| plate_mode
| plot
| selection
| solid
| split
| shrink_surfaces
| tikz
| valid
] [arguments
]
The brep exposes a combination of BRep manipulation functionality both defined in the OpenNURBS libraries and implemented in BRL-CAD's own libraries. Also handled by this command are a number of type conversions - in particular, bot subcommands will generate meshes from BRep data and the csg subcommand will attempt to find a CSG implicit representation of the shape of a specified NURBS BRep. Also, the brep subcommand will attempt to generate a BRep representation of the specified CSG object.
A number of the problems these commands attempt to address are known to be extremely difficult problems - bool is a particular case in point, but the bot and csg commands also attempt to implement very challenging algorithms. Users using these commands should expect to encounter problems and are advised to first back up the .g file they will be operating on before applying them.
The available subcommands are:
bool
{op
} {obj2
} {output_objname
}
Attempt to peform a BRep boolean evaluation and produce a new BRep object. Supported ops are u (union), - (subtract), i (intersect), and x (exclusive or).
bot
Attempt to produce a triangle mesh from the object. Unlike the visualization triangulation, this algorithm spends more time attempting to produce a solid, clean mesh. Outputs the result in an object called obj.bot where obj is the original BRep object name.
bots
{op
} {obj1
} [objN
...]
Attempt to produce triangle meshes for multiple objects that don't overlap. Experimental.
brep
Attempt to produce a brep object to represent the specified CSG object. Generally only useful for solid objects. Outputs the result in an object called obj.brep where obj is the original CSG object name.
csg
Attempt to produce a CSG hierarchy that reproduces the shape of the brep object. Objects will use the root of the original obj name to generate solid names. If a BRep can't be fully represented as CSG, it will be broken down into a combination of simplified BReps and CSG solids.
flip
Flip all face normals on the specified BRep. Can be useful if a conversion results in importing faces with the normals reversed.
info
Report textual information about a BRep. See the brep_info man page for more detail.
intersect
Calculate intersections between BRep object components. Primarly an option for low level testing of bool routines. See the brep_intersect man page for more detail.
pick
{E|F|V
} [px py pz dx dy dz
...]
Select the closest edge, face or vertex to either the specified ray, or to the currently defined GED view center and direction. (NOTE: for faces this actually a rather difficult problem, requiring a solution to the closest NURBS surface point to a line problem. Not sure that even the LIBRT ray intersection code has what's needed to do this right - current method implemented as of 2022 probably won't reliably give us the actual closest face.)
plate_mode
[#|cos|nocos
...]
Report and set plate mode properties of BRep objects. Will not work on a solid BRep - to generate a plate mode BRep, see split. If a number is supplied the plate thickness is set. Passing cos or nocos will toggle how an interseting ray should interpret the thickness as a function of ray hit angle - nocos reports the same thickness for all angles, while cos attempts to adjust for shallow ray hits. If no options are supplied, just report the current thickness and cos/nocos setting.
plot
Visualize components and data associated with a BRep. See the brep_plot man page for more detail.
selection
Manipulate elements of a BRep. See the brep_selection man page for more detail.
solid
Report if the BRep object is solid (i.e. defines a closed volume in space, within tolerance.) In the general case this is a hard problem - this report is helpful but may not catch all potential problems.
shrink_surfaces
Uses an opennurbs routine to tightening the definition of face surfaces to more closely match the uv paramater space of the trimming loops. typically this isn't something users will need to worry about too much, but it can occasionally improve the visualization behavior of an oddly defined brep.
tikz
{output_file
}
Generates plotting output for the object using the TikZ plotting language. The output is intended for incorporation into documents being typeset with LaTeX and the PGF plotting package.
valid
Report if the BRep object is topologically valid.
Reports of bugs or problems should be submitted via electronic
mail to <devs@brlcad.org>