TCL commands not working with loaded database
Open Source Solid Modeling CAD
Brought to you by:
brlcad
The following problem occurs in BRLCAD Versions 7.30.2-1 and 7.32.0 on Windows 10:
MGED doesn't recognize higher level TCL commands like "list" or "lsearch", as well as user defined procedures, if database is loaded. TCL commands work fine without a loaded database.
The attached file is a TCL script to generate a simple Block from a sketch with a triangle between 3 points. The individual commands work as intended in MGED command window without a database loaded, but the file can not be run to generate the geometry.
Error message: wrong # args: should be "set varName ?newValue?"
set glob_compat_mode 0in the script does the trick!BRL-CAD allows special characters, which e.g. surround inner TCL commands, in object names. You can change this behavior either in the GUI: File -> Preferences -> Special Characters (the setting can be saved with File -> Create/Update .mgedrc) or by including
set glob_compat_mode 0in your script.Yes, this is intentional behavior and due to the default glob_compat_mode setting being on. With globbing turned on, the mged command line requires that glob characters to be escaped or for glob_compat_mode to be turned off. Globbing is what makes things like "draw .r" work. In your example, brackets are globbing characters (e.g., "draw sphere[14]0031[0-9abc].s") so you'd have to escape them "set mylist \[ list a b c \]" or turn glob_compat_mode off in order for "set mylist [ list a b c ]" to work.
Last edit: Sean Morrison 2021-01-22