Skip to documentation
DocumentationAll documentsEnglish

MGED(1)

NAME

mged - multi-display interactive combinatorial solid geometry editor

On this page

SYNOPSIS

mged [options] [_database.g_ [_command_]]

DESCRIPTION

MGED, a.k.a. the "Multi-Device Geometry Editor", is the central interaction environment for the BRL-CAD package. It offers both command line and menu driven interactions, as well as wireframe displays and integrated raytracing capabilities. It is the primary tool for BRL-CAD geometry creation and interactive manipulation.

MGED's history traces back to the earlier "GED" (a.k.a. "Geometry Editor"), and much of GED’s functionality is preserved in MGED. A full description of MGED’s abilities is beyond the scope of this document - the reader is referred to Volumes II and III of the BRL-CAD Tutorial Series, available at http://brlcad.org, for a more comprehensive introduction. This document will deal with the various options available when it comes to starting MGED.

The primary mode for modern MGED usage is the Tcl/Tk based environment, which offers menu support and a number of Tcl based tools. It is also possible to run more minimalist environments of terminal + framebuffer and a terminal without any display window. MGED also allows users to execute single commands from the command line without starting any environment, allowing for activities such as scripting. Some examples of such usage are present in the Examples section of this document.

Technically, MGED can be opened without a database file being supplied, but until one is supplied it will not be terribly useful. This can be done either by supplying a file name on the command line or by opening a database from within MGED using the File→Open…​ menu or the opendb command.

Options that affect per-session appearance (variables, grid, colour) are applied after any .mgedrc file is processed, so command-line flags always take precedence over saved settings.

OPTIONS

Display and Mode

-a type, --attach type

Specifies a display manager to automatically attach to when starting MGED.

Without specifying this option, MGED will prompt which display manager to attach during startup: attach (nu|X|ogl)[nu]?

The list of available display managers varies from platform to platform and across releases. Commonly available options include the nu (NULL) display manager (starts without any graphical display), the X display manager (X11 wireframe display), and the ogl display manager (OpenGL wireframe display).

-d display, --display display

Specifies which X server to connect to on platforms that have a running X11 server available. This option is an alternative to setting the DISPLAY environment variable. You can specify a local or remote display in X11 HOST:PORT format (e.g., -d :0 or -d host:0).

--dm-type type

Sets the display manager type to use (e.g., ogl, X, swrast). This corresponds to the mged_default(dm_type) Tcl variable used during GUI initialisation.

--geom WxH+X+Y

Sets the command window geometry (position and size) in standard X geometry format (e.g., --geom 800x600+0+0).

--ggeom WxH+X+Y

Sets the graphics/geometry window geometry in standard X geometry format.

Run Mode

-b, --background

Runs MGED as a background process, freeing the terminal from which it was started.

-c, --classic

Instructs MGED to start using classic mode instead of the default Tcl/Tk-based GUI. The -c option is often used when specifying an mged_command to indicate that MGED is being run in a command-mode without a default GUI.

-C, --gui

Instructs MGED to start in GUI (non-classic) mode. This is the default on platforms that support graphics.

-p, --pipe

Enables pipe mode. In this mode MGED emits a MGED_CMD_DONE <status> sentinel to stdout after every command completes on stdin, making it suitable for use as a subprocess driven by an automated tool.

-r, --read-only

Opens the database.g file in read-only mode.

rc File Control

--rcfile file

Loads file instead of the default .mgedrc during startup. This overrides the MGED_RCFILE environment variable.

--no-rc

Skips loading any .mgedrc file entirely, providing a clean-slate session unaffected by personal settings. Useful for automated testing and scripted invocations.

Variable Override Escape Hatches

--set VAR=VALUE

Sets an MGED variable by name after .mgedrc is processed (e.g., --set use_air=1). This provides access to any mged_vparse[] variable, including those not exposed as individual long options. May be repeated.

--rset ARGS

Passes arguments directly to the MGED rset command after .mgedrc is processed (e.g., --rset "ax draw 1"). Provides access to axes, full colour scheme, rubber-band, and any other rset resource. May be repeated.

Wireframe Appearance

--linewidth #

Sets the wireframe line width in pixels (must be >= 1).

--linestyle s|d

Sets the line style: s for solid, d for dashed.

--faceplate, --no-faceplate

Shows or hides the faceplate overlay.

--dlist, --no-dlist

Enables or disables display lists for wireframe rendering.

View and Interaction

--perspective #

Sets the perspective angle in degrees. Use -1 to disable perspective (orthographic view).

--eye-sep-dist #

Sets the stereo eye separation distance in millimeters. Use 0 for monoscopic (non-stereo) rendering.

--coords m|v

Sets the constraint coordinate system: m for model space, v for view space.

--rotate-about m|v|e

Sets the center of rotation: m for model origin, v for view center, e for eye point.

--transform v|a|e

Sets the mouse transform mode: v for view, a for adc (angle/distance cursor), e for edit.

--mouse-behavior v|a|e

Sets the mouse behavior mode.

--perspective-mode 0|1

Enables (1) or disables (0) perspective mode.

--sliders 0|1

Shows (1) or hides (0) the slider bars.

--context 0|1

Enables (1) or disables (0) context-sensitive editing mode.

--hot-key #

Sets the character code of the hot key used to switch the active display manager.

Air and Geometry Settings

--use-air, --no-use-air

Enables or disables the use_air flag (controls whether air regions are included in ray-trace intersection lists).

--nmg-eu-dist #

Sets the NMG edge-use distance tolerance.

Framebuffer

--fb, --no-fb (via --set)

Use --set fb=1 or --set fb=0 to enable or disable framebuffer overlay.

--fb-overlay 0|1|2

Sets the framebuffer overlay mode: 0 (framebuffer under geometry), 1 (interleaved), 2 (framebuffer over geometry).

--port #

Sets the port number for the framebuffer server (0-65535).

View Predictor

--predictor, --no-predictor

Enables or disables the view predictor (ghost image of predicted view during rotation).

--predictor-advance #

Sets the predictor advance time in seconds.

--predictor-length #

Sets the predictor trail length in seconds.

Grid

--grid-draw 0|1

Shows (1) or hides (0) the grid overlay.

--grid-snap 0|1

Enables (1) or disables (0) snap-to-grid.

--grid-rh #

Sets the horizontal grid resolution (model units).

--grid-rv #

Sets the vertical grid resolution (model units).

--grid-mrh #

Sets the number of minor grid intervals per major horizontal grid line.

--grid-mrv #

Sets the number of minor grid intervals per major vertical grid line.

Colour

Colour values may be specified as three space-separated integers 0–255 (R G B), as a slash-separated triplet (R/G/B), or as an HTML hex colour (#RRGGBB).

--bg R G B

Sets the background colour.

--geo-color R G B

Sets the default geometry wireframe colour.

Debugging

-x , --rt-debug

Sets the debug level for librt (hexadecimal integer).

-X , --bu-debug

Sets the debug level for libbu (hexadecimal integer).

Information

-v, --version

Displays version information and exits.

-h, -?, --help

Prints a brief help statement showing available options and exits.

RC FILE

MGED searches for a startup configuration file (.mgedrc) in three locations, in order:

  1. If the environment variable MGED_RCFILE is set, that path is used.

  2. If the environment variable HOME is set, $HOME/.mgedrc is used.

  3. If .mgedrc exists in the current working directory, it is used.

The first file found is used and the others are ignored. Use --rcfile to specify an explicit path, or --no-rc to skip rc file processing entirely.

Command-line options that affect MGED variables (all the long options listed above) are applied after the rc file is processed, so they always take precedence.

SCRIPTING (BATCHING) MGED

Often it is convenient to generate a series of MGED commands outside MGED and then submit the command list to MGED, which will react as if each command were being manually entered within it. Simply create a file (say, "cmds.txt") with each line being a desired command, and then have MGED execute the list. At the normal shell prompt, execute

$ mged -c tgm.g < cmds.txt

Note that the procedure described above is very useful in rapid prototyping or automated TGM processing without resorting to low-level library programming in C or C++.

For fully non-interactive scripted use, the --no-rc flag avoids loading any personal .mgedrc that could affect the session:

$ mged --no-rc -c --use-air --linewidth 2 model.g 'some_command arg'

HINTS

MGED database names conventionally end with .g .

SIGINT aborts the current command.

"q" or EOF exits the program.

EXAMPLES

The following are run from the operating system command prompt:

Example 1. Running the MGED l from the operating system command line.

user:~mged /usr/brlcad/share/brlcad/7.12.2/db/m35.g l component

Opened in READ ONLY mode
component:  --
   u bed
   u frame
   u cab
   u suspension
   u misc
   u power.train
Example 2. Running MGED without a display manager.

user:~mged -c

BRL-CAD Release 7.13.0  Geometry Editor (MGED)
    Thu, 09 Oct 2008 22:31:41 -0400, Compilation 1
    user@localhost:/usr/brlcad/

attach (nu|X|ogl)[nu]? nu
mged>
Example 3. Running MGED and bypassing the attach prompt by specifying the X11 display manager.

user:~mged -a X -c

BRL-CAD Release 7.15.0  Geometry Editor (MGED)
    Tue, 22 Sep 2009 12:40:01 -0400, Compilation 1
    user@localhost:/usr/brlcad/

ATTACHING X (X Window System (X11))

mged>
Example 4. Running MGED with a custom background colour and no personal rc file (scripted use).

user:~mged --no-rc --bg 0 0 64 --use-air -c model.g

Example 5. Setting an MGED variable not exposed as a dedicated option.

user:~mged --set eye_sep_dist=65 model.g

Example 6. Setting a grid resource via the rset escape hatch.

user:~mged --rset "g snap 1" --rset "g rh 10" model.g

SEE ALSO

Computer Graphics for Target Descriptions, BRL Technical Report ARBRL-TR-02480, GED: An Interactive Solid Modeling System for Vulnerability Assessments

brlcad(1), rt(1), comgeom-g(1), vdeck(1), librt(3)

DIAGNOSTICS

Error messages are intended to be self-explanatory.

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