BREP(nged)

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…

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… BREP(nged) β€” the BRL-CAD MGED brep command, explained πŸŽ€

okay so bestie, welcome to brep, the main character of BRL-CAD when it comes to NURBS boundary representation objects (we call them brep objects, iykyk). There's like so much functionality stuffed in here that the command literally had to spawn subcommands to keep it all organized. it's giving "folder structure but make it unix." ✨


🌸 SYNOPSIS 🌸

brep {obj} [bool | bot | bots | brep | csg | flip | info | intersect | pick | plate_mode | plot | selection | solid | split | shrink_surfaces | tikz | valid] [arguments]

πŸ¦‹ DESCRIPTION πŸ¦‹

So brep exposes a whole combo plate of BRep manipulation goodies: some of it comes straight from the OpenNURBS libraries, and some is hand-implemented in BRL-CAD's own libraries. It also handles a bunch of type conversions, namely:

  • the bot subcommands will generate meshes from BRep data 🌈
  • the csg subcommand tries to find a CSG implicit representation of the shape of a specified NURBS BRep
  • the brep subcommand tries to generate a BRep representation of the specified CSG object
πŸ’€ real talk: a bunch of the problems these commands try to tackle are known to be extremely difficult. bool is the poster child, but bot and csg are also out here attempting genuinely challenging algorithms. Users using these commands should expect to encounter problems, and are advised to back up the .g file they'll be operating on before applying them. no cap, please do the backup. 🫢

✨ the available subcommands ✨

  • bool β€” attempts to perform a BRep boolean evaluation and produce a new BRep object. Supported ops are u (union), - (subtract), i (intersect), and x (exclusive or). πŸ”₯
  • bot β€” attempts 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 β€” attempts to produce triangle meshes for multiple objects that don't overlap. Experimental β€” you've been warned, bestie πŸ™ˆ
  • brep β€” attempts 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 β€” attempts 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 β€” flips all face normals on the specified BRep. Super useful if a conversion results in importing faces with the normals reversed. πŸŒ€
  • info β€” reports textual information about a BRep. See the brep_info man page for more detail.
  • intersect β€” calculates intersections between BRep object components. Primarily an option for low level testing of bool routines. See the brep_intersect man page for more detail.
  • pick β€” selects 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 is 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 β€” the current method implemented as of 2022 probably won't reliably give us the actual closest face. 😭)
  • plate_mode β€” reports and sets 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 intersecting 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, it just reports the current thickness and cos/nocos setting. πŸ‘‘
  • plot β€” visualizes components and data associated with a BRep. See the brep_plot man page for more detail.
  • selection β€” manipulates elements of a BRep. See the brep_selection man page for more detail.
  • solid β€” reports 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 tighten the definition of face surfaces to more closely match the uv parameter 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 β€” 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 β€” reports if the BRep object is topologically valid. vibe check for topology, fr fr πŸ’…

πŸ’– OPTIONS πŸ’–

  • -h, --help β€” print help for the selected brep subcommand. when in doubt, ask for help, bestie 🫢
  • -v, --verbose β€” increase reporting verbosity for subcommands that support additional diagnostic output. more words! more lore! πŸ—£οΈ
  • -C, --color r/g/b β€” set the color used by subcommands that create plotted or highlighted output. aesthetic matters 🌈
  • --plotres # β€” set plotting resolution for subcommands that sample curves or surfaces for display output. crank it up for the pretty pixels ✨

⭐ EXAMPLES ⭐

Example 1. Inspect a few specific faces of a BRep object.

mged>brep hull.brep info F 0-3

Prints textual information for faces 0 through 3 of hull.brep, which is useful when checking face orientation, trims, or surface indexing before a repair step. literally the pre-repair glow-up inspection 🧚

Example 2. Split selected faces into plate-mode BReps with an explicit thickness.

mged>brep hull.brep split -t 1.5 -o hull_plate 4 5 6

Creates plate-mode output from faces 4, 5, and 6 of hull.brep with a default thickness of 1.5 model units, writing the result under the hull_plate naming root. ate and left no crumbs πŸ“


πŸ‘‘ AUTHOR πŸ‘‘

BRLCAD-TEAM

πŸ’€ BUG REPORTS πŸ’€

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. don't be shy, they wanna hear it 🫢


okay that's the whole page, you're totally caught up bestie πŸ’œ this came to you straight from the BRL-CAD MGED User Commands set β€” the BREP(nged) page β€” so go forth and brep responsibly, and remember: back up that .g file first. mwah πŸ’‹

πŸ“¦ where this page comes from