Using "create" as an mged command

  • Mark Hobley

    Mark Hobley - 2011-02-13

    I would like to operate brlcad using reusable scripts. Currently to create a database, we have to navigate through the menus, file, new, and then type our database name. It would be useful, if we could simple use a one line command, such as:

    new ~/brlcad/sphere2.g

    Also, can we use the tilde to represent the home directory? This is becoming fashionable.


  • Sean Morrison

    Sean Morrison - 2011-02-16

    Pretty much every option on the menus can be performed without the GUI.  The MGED Quick Reference card lists many of the more commonly used commands.  You can even "push" virtual edit buttons and change editing states without touching a mouse.  To open/create a new database, run the "opendb" command:

    opendb brlcad/sphere2.g

    The '~' tilde expansion won't necessarily work as you'd hope, so recommend using relative path dirs (use the "pwd" command to find out where you are at).  There's a way to make it work, but it's Tcl-specific and not as convenient as just using a relative dir.  An alternate to the tilde that should work is this:  opendb \\/brlcad/sphere2.g

    If you're scripting, you can add a trailing 'y' (opendb file.g y) and that will avoid any yes/no interactive creation query.



Log in to post a comment.