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 below.
Other files included in the "psfiles/python/" directory are intended for use with xcircuit, as extensions to xcircuit commands. At any given time, some of these functions may be under develpment. Functions which are operational and of interest are listed below.
See below for a detailed explanation of the contents of the netlist dictionary returned to Python.
Those functions indicated with "number" take a parameter as part of the function name; e.g., "Page 1" and "Page 2" are two different bindings, as is "Rotate 3" (rotate clockwise 15 degrees) and "Rotate -3" (rotate counterclockwise 15 degrees).
function name function description default binding "Page" number Go to indicated page 1 through 9, 0 "Justify" number Text justification KP_1 through KP_9 "Superscript" Start text superscripting KP_Add "Subscript" Start text subscripting KP_Subtract "Normalscript" End text sub- or superscript KP_Enter "Nextfont" Switch to next font in list Alt_f "Boldfont" Change to boldface font Alt_b "Italicfont" Change to italic font Alt_i "Normalfont" Change to normal font Alt_n "Underline" Start text underline Alt_u "Overline" Start text overline Alt_o "ISO Encoding" Change to ISO-Latin1 encoding Alt_e "Halfspace" Insert half-space Alt_h "Quarterspace" Insert quarter-space Alt_q "Special" Insert special character \ "Tab Stop" Define tab stop Alt_Tab "Tab Forward" Tab forward Tab "Tab Backward" Tab backward Shift_Tab "Text Return" Finish text edit Enter "Text Delete" Delete last character Delete "Text Right" Move right one character Right "Text Left" Move left one character Left "Text Home" Move to label beginning Home "Text End" Move to label end End "Return Char" Insert carriage-return Alt_Enter "Parameter" Insert parameter value Alt_p "Edit Break" Break polygon at point x "Edit Delete" Delete polygon point d "Edit Insert" Insert polygon point i "Edit Next" Go to next edit point e "Attach" Attach edit point to element A "Next Library" Go to next library l "Library Directory" Go to library directory L "Library Move" Move objects within library M "Library Copy" Return to page in copy mode c "Library Edit" Edit an object name E "Library Delete" Delete a library object D "Library Duplicate" Duplicate a library object C "Library Hide" Hide a library object H "Page Directory" Go to page directory P "Library Pop" Return from library > "Help" Generate help window h, ? "Redraw" Redraw the drawing window Space "View" Center the current drawing v "Zoom In" Enlarge the view Z "Zoom Out" Shrink the view z "Pan" Move window center to cursor position p "Double Snap" Double the snap spacing + "Halve Snap" Halve the snap spacing - "Pan Left" Pan left one-half screen width Left "Pan Right" Pan right one-half screen width Right "Pan Up" Pan up one-half screen height Up "Pan Down" Pan down one-half screen height Down "Write" Pop up output properties window W "Rotate" number Rotate element r, R, o, O "Flip X" Flip element horizontal f "Flip Y" Flip element vertical F "Snap" Snap element to snap grid S "Pop" Return from current edit < "Push" Edit object > "Delete" Delete element Delete "Select" Select element Button2 "Box" Generate box b "Arc" Generate arc a "Text" Generate label t "Exchange" Exchange order of elements X "Copy" Make copy of an element c "Join" Join elements into a path j "Unjoin" Separate path into elements J "Spline" Generate a Bezier curve s "Edit" Edit an element e "Undelete" Retrieve last deleted element u "Select Save" Create new library object M, m "Unselect" Unselect an element x "Dashed" Change border to dashed style | "Dotted" Change border to dotted style : "Solid" Change border to solid style _ "Prompt" Prompt for Python command % "Dot" Create a "solder dot" . "Wire" Start a wire (polygon) w, Button1 "Start" Start command (general) Button1 "Finish" End command (general) Button2, Shift_Button1 "Cancel" Cancel command (general) Button3 "Nothing" Null command (general) Button3 "Exit" Quit XCircuit Control_Alt_q "Netlist" Generate Python netlist Alt_q "Swap" Move schematic <--> symbol / "Pin Label" Generate "Pin" label T "Info Label" Generate "Info" label I "Connectivity" See network connectivity Alt_w "Sim" Generate "sim" format output Alt_s "SPICE" Generate "SPICE" format output Alt_Shift_S "PCB" Generate "PCB" format output Alt_p "SPICE Flat" Generate flattened SPICE output Alt_f
dict = | { | "type" | : | "Polygon", | |
"color" | : | colorval, | |||
"style" | : | styleval, | |||
"linewidth" | : | widthval, | |||
"points" | : | pointlist | } |
dict = | { | "type" | : | "Arc", | |
"color" | : | colorval, | |||
"style" | : | styleval, | |||
"linewidth" | : | widthval, | |||
"radius" | : | intval, | |||
"minor axis" | : | intval, | |||
"start angle" | : | floatval, | |||
"end angle" | : | floatval, | |||
"position" | : | pointval | } |
dict = | { | "type" | : | "Bezier Curve", | |
"color" | : | colorval, | |||
"style" | : | styleval, | |||
"linewidth" | : | widthval, | |||
"control points" | : | pointlist | } |
dict = | { | "type" | : | "Object Instance", | |
"color" | : | colorval, | |||
"name" | : | stringval, | |||
"position" | : | pointval, | |||
"rotation" | : | intval, | |||
"scale" | : | floatval | } |
dict = | { | "type" | : | "Path", | |
"color" | : | colorval, | |||
"style" | : | styleval, | |||
"linewidth" | : | widthval, | |||
"parts" | : | partslist | } |
dict = | { | "type" | : | "Label", | |
"color" | : | colorval, | |||
"position" | : | pointval, | |||
"rotation" | : | intval, | |||
"scale" | : | floatval, | |||
"justify" | : | justval, | |||
"pin" | : | pinval, | |||
"string" | : | xcstringval | } |
{ | "Text" | : | stringval | } |
{ | "Parameter" | : | intval | } |
{ | "Font" | : | stringval | } |
{ | "Font Scale" | : | floatval | } |
{ | "Kern" | : | pointval | } |
{ | "Color" | : | rgbval | } |
"End Parameter" |
"Tab Stop" |
"Tab Forward" |
"Tab Backward" |
"Return" |
"Subscript" |
"Superscript" |
"Normalscript" |
"Underline" |
"Overline" |
"No Line" |
"Half Space" |
"Quarter Space" |
pagedict = | { | "filename" | : | stringval, | |
"page label" | : | stringval, | |||
"output scale" | : | floatval, | |||
"grid space" | : | intval, | |||
"snap space" | : | intval, | |||
"orientation" | : | intval, | |||
"output mode" | : | intval, | |||
"coordinate style" | : | intval, | |||
"page size" | : | pointval, | |||
"drawing scale" | : | pointval | } |
objectdict = | { | "name" | : | stringval, | |
"width" | : | intval, | |||
"height" | : | intval, | |||
"viewscale" | : | floatval, | |||
"viewcorner" | : | pointval, | |||
"boundingbox" | : | pointval, | |||
"parts" | : | partslist, | |||
"parameters" | : | paramlist | } |
User (xcircuit) units to window (X11) units conversion. Note that due to the graph-like layout of xcircuit, the Y user axis follows the standard mathematical convention of increasing Y values toward the top of the window, whereas X11 follows the opposite convention of increasing Y values toward the bottom of the window.Definitions:
For any pointval value P, P[0] = X value, P[1] = Y value. U = pointval, user coordinate, tuple (X,Y). W = pointval, window coordinate, tuple (X,Y). viewscale = floatval, scale conversion between user and window coordinates. viewcorner = pointval, in user coordinates, tuple (X,Y) window_height = pixel height (X11 coordinates) of the XCircuit window.Functions:
User (xcircuit) to window (X11) units conversion:
W[0] = (U[0] - viewcorner[0]) * viewscale W[1] = window_height - (U[1] - viewcorner[1]) * viewscaleWindow (X11) to user (xcircuit) units conversion:
U[0] = W[0] / viewscale + viewcorner[0] U[1] = (window_height - W[1]) / viewscale + viewcorner[1]
Important note: I changed the format between xcircuit-2.5.4 revision 7 and revision 8. The change is to denote nets by number instead of name, and provide a dictionary for each subcircuit equating net numbers to names. The separation of nets from their names makes it much easier to flatten netlists by remapping the net numbers when visiting each subcircuit call.
rdict = | { | "globals" | : | globals, | |
"circuit" | : | circuit | } |
globals = | { | intval1 : xcstringval1, intval2 : xcstringval2, | ... | intvalN : xcstringvalN | } |
circuit = | [ | subckt1, subckt2, | ... | subcktN | ] |
subckt = | { | "ports" | : | portlist | |
"parameters" | : | paramlist | |||
"calls" | : | calllist | |||
"nets" | : | netlist | |||
"devices" | : | devicelist | } |
portlist = | [ | intval1, intval2, | ... | intvalN | ] |
paramlist = | [ | paramvalue1, paramvalue2, | ... | paramvalueN | ] |
netlist = | { | intval1 : xcstringval1, intval2 : xcstringval2, | ... | intvalN : xcstringvalN | } |
calllist = | { | callval1, callval2, | ... | callvalN | } |
callval = | { | "name" | : | xcstringval, | |
"parameters" | : | paramlist, | |||
"ports" | : | portlist | } |
devicelist = | [ | xcstringval1, xcstringval2, | ... | xcstringvalN | ] |
Back to the xcircuit home page. . .
email: tim@bach.ece.jhu.edu