SAVEVIEW(nged)

Write the current MGED view and displayed objects to an executable raytrace script.

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’Ύ SAVEVIEW(nged) β€” or, "bestie, save this view before you lose it" ✨

okay so this is a page from the BRL-CAD user commands, and honestly? it's a whole little lifesaver. it lives in nged (that's the MGED manual section, iykyk) and it's called saveview.


🌸 NAME 🌸

saveview β€” writes the current MGED view and the objects you've got displayed out to an executable raytrace script πŸ’…

like, it literally takes your vibe right now and saves it as a runnable shell script. iconic behavior.


πŸŽ€ SYNOPSIS πŸŽ€

saveview [-e command] [-i input.g] [-l logfile] [-o output] filename [args]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” saveview writes a shell script that describes the current MGED view plus all the objects currently displayed. when you run that generated script, it runs a command in -M mode, and it feeds the saved viewing parameters straight into that command on standard input. cute, right?

by default, the generated script runs rt -M. and if perspective is enabled in your current view? the script also adds the matching -p option. no cap, it just knows. πŸ”₯

any extra args you toss in after filename get copied into the generated command line unchanged. like, character for character, bestie, it does not touch them.

⚠️ heads up: the script gets opened in append mode. if filename already exists, the new script block is just appended onto the existing file. also, the file gets marked executable. so like… don't be surprised when your file grows πŸ™ˆ

unless you override them, the script does all of this:

  • writes image output to a file derived from filename with .pix appended
  • writes stderr output to a file derived from filename with .log appended
  • uses the currently opened database file as the geometry input
  • includes the currently displayed objects as the raytrace object list

and here's a lil detail that's lowkey important πŸ‘‘: when it's deriving those default .pix and .log names, a trailing .sh suffix gets removed from filename first, if it's there. so for example, saveview render.sh defaults to render.pix and render.log, while saveview render.rt defaults to render.rt.pix and render.rt.log. see? it's giving attention to detail. πŸ’…

the following options are supported:

  • -e command β€” run command instead of rt. the command gets invoked with -M. and psst β€” if command begins with nirt, saveview does not emit a default -o output option 🫢
  • -i input.g β€” use input.g in the generated script instead of the currently opened database pathname
  • -l logfile β€” write the stderr redirection to logfile instead of the default derived .log file
  • -o output β€” pass -o output to the generated command instead of the default derived .pix file

the resulting script contains the view state you need to reproduce the current display, including view size, orientation, eye point, and the displayed object list. and the scripts saveview generates can be read right back into MGED with loadview to restore the same view and the same displayed objects. round trip slay πŸ’–


🌈 EXAMPLES 🌈

these examples show how saveview records the current MGED view into a reusable shell script ✨

⭐ Example 1. Write a default raytrace script for the current view.

mged>saveview render.rt

appends an executable shell script to render.rt that runs rt -M on the currently displayed objects using the current view.

⭐ Example 2. Write a script that passes an explicit image size to the generated raytrace command.

mged>saveview render.rt -s1024

appends a script to render.rt and passes -s1024 through to the generated raytrace command.

⭐ Example 3. Write a script that runs nirt instead of rt.

mged>saveview -e nirt raycast.sh

appends an executable script to raycast.sh that runs nirt -M using the current MGED view.


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team 🫑


πŸ’€ BUG REPORTS πŸ’€

reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org β€” like, pls tell them, they wanna know, fr fr 😭


and that's the whole page, bestie πŸŽ€ this little gem comes to you courtesy of BRL-CAD, and the footer on the original says SAVEVIEW(nged) β€” go forth and save those views πŸ’œ

πŸ“¦ where this page comes from