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


asc2g input.asc output.g


asc2g is a utility provided by BRL-CAD used to convert mged(1) geometry databases in ASCII form outputted by g2asc(1) to the new binary format. The utility will always create the new binary format, but it will accept either of the two ASCII formats (see HISTORY).

The local machine binary representation of a mged database is inherently non-portable. asc2g and its converse, g2asc , 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 .


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


input.asc is a file previously created using g2asc and output.g is the name of the file where the resulting binary database should be stored.


g2asc(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.)