g2asc — convert a BRL-CAD mged geometry database from binary to ASCII form.


g2asc input.g output.asc


g2asc is a utility provided by BRL-CAD used to convert mged(1) geometry databases in binary format to ASCII form to be later converted back by asc2g(1). Databases in the new format will be converted to the new (Tcl script) ASCII format and databases in the old format will be converted to the old ASCII format (see HISTORY).

The local machine binary representation of a mged database is inherently non-portable. g2asc and its converse, asc2g , are simple filters which convert between the binary form and an ASCII representation.

This was traditionally performed so the files could be transferred to another machine in a portable format. Although no longer necessary for the current binary geometry database files that are created by mged ("v5" format), the conversion process is still necessary if manipulating older ("v4" format) geometry database files.


g2asc file.g file.asc

On the local machine, convert the mged databases to ASCII using g2asc .

scp file.asc remote:file.asc

Transfer the converted databases to the remote machine.

ssh remote "asc2g file.asc file.g"

On the remote machine, convert the files back to the binary representation for that machine using asc2g .


g2asc does not take any options. However, you have to supply the input and output files.


input.g is a geometry database previously created using mged and output.asc is the name of the file in which the ASCII representation should be stored.


asc2g(1), brlcad(1), mged(1)


The diagnostics are intended to be self-explanatory. Any warning messages are written to standard error.


Reports of bugs or problems should be submitted via e-mail to <>.


Release 6.0 introduced a new ASCII format. This format is simply a Tcl script that, when executed by a simplified geometry command interpreter (in essence, a properly empowered Tcl interpreter), rebuilds the database from which it was derived.

In contrast, the old ASCII format consisted of a sequence of one-line records that corresponded to the old database format records.


Charles Michael Kennedy

Michael John Muuss


This software is Copyright (c) 1989-2016 by the United States Government as represented by U.S. Army Research Laboratory.


The ASCII representation of BRL-CAD geometry databases is not a fixed format and is allowed to change without deprecation notice. In general, this will not occur any more frequently than the binary geometry database format changes, though both are open specifications. Regardless, the ASCII representation is subject to change without notice and should not be relied upon by external codes. (See HISTORY.)