XCircuit has a command-line feature intended to duplicate the menu and keyboard functions in xcircuit. A command line can be executed in three different ways:The command line functions are written in Tcl if xcircuit has been selected as a Tcl extension at compile time, or in Python, if Python has been compiled into xcircuit. Whether this is true is indicated by the command-line prompt when the '%' macro is chosen, which is a question mark ('?') if the interpreter is the old-style xcircuit interpreter, and the usual Python prompt ('>>>') if the interpreter is Python. If Tcl is the interpreter, there is no "%" macro, and the interpreter prompt is available in the Tcl/Tk console window, which can be accessed from the menu command File->Tcl Console. The old xcircuit command line syntax is as follows:
- Read as part of the .xcircuitrc file on program startup
- Read as part of an executable script run from the menu selection File->Execute script
- Entered directly into the message window as a result of typing the "%" key macro (Python and non-interpreter versions only) or
- Entered into the console window (Tcl version only). The console window is popped down on startup (beginning with version 3.1.6) but can be deiconified by selecting menu option "File->Tcl Console".
The Tcl command line syntax accepts any valid Tcl/Tk code. XCircuit functions imported into Tcl are summarized in Tcl-Based XCircuit page. Note especially the changes in syntax for overrides and library loads. Some of this has been (somewhat awkwardly) made backwardly-compatible, but the preferred syntax is "library override" for the override command, and "library number load filename" for libraries. Note that TCL has a habit of dropping all input when an error is encountered, so an error at the top of the .xcircuitrc file will prevent the remainder of the file from being parsed.
- override [default] option
Override system startup defaults. Necessarily, these commands are only useful when included in the .xcircuitrc file, and have no effect when run from the command line or executed from a script. option can be one of:
- library
Don't load libraries from the startup script. Libraries are expected to be listed individually using the "library" command. No libraries are loaded otherwise. Library elements will be loaded as usual into the "User Library" page from input files.- color
Don't use the pre-defined set of colors. Colors are expected to be listed individually using the "color" command. Necessarily for basic operation, black and white will always be defined. Colors will also be loaded as required from input files.- font
Don't load fonts from the startup script. Instead, a list of fonts is expected to follow with the "font" command. Necessarily for basic operation, one font will be loaded so that object names can be listed. Other fonts will be loaded as required from input files.- enable | disable option
Where option can be one of:
- grid makes grid lines visible or invisible
- snap makes snap-spacing dots visible or invisible
- axis makes axis lines visible or invisible
- xschema turns the schematic capture system on or off
- toolbar turns the toolbar on or off
- set [default] option
Sets the designated xcircuit global (default) option. The keyword "default" is redundant. option can be one of:Alternately, the set command sets the designated option for the current page. The keyword "default" is redundant. Options for new pages are taken from the first page. On program startup, the current page is set to the first page, so this command acts on the default page.
- font [fontname | scale value]
Set the default font of fontname, which will be loaded if it does not already exist in the list of fonts. The font name incorporates font style (italic, bold) and encoding (Adobe standard, ISO).
Or, set the default text scale to floating-point value value.- color colorname
Set the default drawing color to colorname, which will be added to the color list if it is not there already.- colorscheme [normal | inverse]
Switch between the normal (black-on-white) and inverse (white-on-black) color schemes.- boxedit [normal | manhattan | rhomboid-a | rhomboid-y | rhomboid-x ]
Set the polygon edit style to the specified type.- linewidth value
Set the default linewidth to the given floating-point value value.
option can be one of:
- coordstyle [cm | in] Coordinate system is in inches or centimeters
- orient [landscape | portrait] Landscape or portrait orientation of output
- pagestyle [encapsulated | full] Encapsulated or full-page PostScript output.
- gridspace value Grid spacing set to value.
- snapspace value Snap-to spacing set to value.
- library filename [number]
Add filename (a .lps file) to the User Library (default), or to the library page designated by number. If the designated library page does not exist, it will be created.- font fontname
Add fontname to the list of known fonts. Preferably there should be corresponding font encoding and vector files for accurate character drawing, but this is not a necessity.- color colorname | #RGB
Add color colorname to the list of known colors.- beep [on | off]
Turn warning bell on or off.The Python command line syntax accepts any valid Python code. Special functions in the embedded interpreter, imported as a module, link the Python interpreter to internal xcircuit variables. These special commands are summarized in The Python Interpreter page.
Note on Key Bindings: The new key bindings scheme includes a difference from the original behavior. Originally, the BackSpace and Delete keys were both interpreted as "Delete". In the new key bindings scheme, only Delete deletes the previous character, while BackSpace acts like the left arrow cursor (moves one space to the left). If you prefer the original behavior, it can be emulated with the following commands (Python version) (to be put, for instance, in your home .xcircuitrc file):
unbind("BackSpace", "Text Left")
bind("BackSpace", "Text Delete")
If a configuration file named ".xcircuitrc" exists in the current working directory (first place searched) or the user's home directory (second place searched) or the xcircuit library directory (last place searched), it will be loaded on startup. The syntax of the .xcircuitrc file is the same as an executable xcircuit script or command-line entry, and is described in the section "The XCircuit Command Line".
The difference between ".xcircuitrc" and "startup.script" in the library is that ".xcircuitrc" will be overridden if a file of the same name exists in a user's current working directory or home directory. "startup.script" always runs, although default libraries and fonts listed therein can be forcibly ignored by the user with the "override" command. Thus, it is recommended that "startup.script" restrict itself to loading fonts and libraries, and that ".xcircuitrc" be used for all other commands, unless the administrator has totalitarian tendencies and wishes to force a consistent interface among users, such as for an instructional course.
- startup.script Startup script
The master list of fonts and libraries to load on program startup. Which one is used depends on whether the source was compiled with the Python interpreter enabled.- .xcircuitrc Secondary startup script
Commands to run on startup. The syntax of this file depends on whether the source was compiled with the Python interpreter enabled.
Back to the xcircuit home page. . .
email: |
Last updated: August 5, 2016 at 6:54pm