PythonCAD Command Interpreter Reference

The table below gives the available commands in PythonCAD. An example of a command set like those in the keywords.py file is available at the bottom of the page. The commands are listed in the second column of the table. The third column in the table represents an internal command that gets run when the command in the second column is seen.

It bears repeating that the ability of PythonCAD in dealing with these commands is a new feature, and therefore you should expect to encounter some undocumented features. As the development of PythonCAD advances, the command interpreting abilities of the program should stabilize and become more powerful with fewer surprises.

Command Interpreter (05/29/2003)
Command Description Default Name(s) Command Executed
Draw Angled Construction Line acline,acl acline
Arc(Radius/Angle) arc arcc
Draw Construction Circle(Two Points) ccir2 ccir2p
Draw Construction Circle(Point/Radius) ccir ccircen
Chamfer Object chamfer chamfer
Draw Circle(Two Points) cir2 cir2p
Draw Circle(Point/Radius) cir circen
Draw Construction Line (Two Points) cl cl
Close Drawing Window close close
Copy Object copy copy
Cut Object cut cut
Delete Object delete, del delete
Open Dimension Prefrences Window dimpref dimpref
Fillet Object fillet fillet
Horizontal Construction Line hcline, hcl hcline
Draw Leader (Multi-Point) leader, lead leader
Mirror Object mirror, mir mirror
Move Object move, mv move
Move Object Horizontally moveh moveh
Move Object Vertically movev movev
Open New Window new new
Paste Object paste paste
Draw Perpendicular Construction Line pcline pcline
Draw Point point point
Draw Polyline (Multi-Point) polyline, pline polyline
Open Prefrences Menu Window pref pref
Quit Application quit quit
Draw Rectangle (Two Points) rectangle, rect rect
Redraw Screen Objects redraw redraw
Refresh Screen Objects refresh, r refresh
Select all: arcs saa saa
Select all: angled construction lines saacl saacl
Select all: circles sac sac
Select all: construction circles sacc sacc
Select all: construction lines sacl sacl
Select all: horizontal construction lines sahcl sahcl
Select all: polylines sap sap
Select all: segments sas sas
Select all: vertical construction lines savcl savcl
Save Drawing as New Filename saveas saveas
Save Drawing saves, sv saves
Draw Segment (Two Points) segment, seg, l segment
Split Object split split
Stretch Object (Two Points) str str
Stretch Horizontal strh strh
Stretch Vertical strv strv
Draw Tangent Construction Line tcline, tcl tcline
Input Text text text
Transfer to Current Layer transfer transfer
Draw Vertical Construction Line vcline, vcl vcline
Zoom Default zoomd, z zoomd
Zoom Fit zoomf, zf zoomf
Zoom In zoomi, zi zoomi
Zoom Out zoomo, zo zoomo

Example Command Set

Defining a command set is essentially defining a Python dictionary. The key is the command, and the value is the internal command to execute when the user enters the command key. Here is a commands set called mycommands.

mycommands = {
	'foobar' : quit,
	'foo' : segment,
	'X' : quit,
	'O' : opend
}

As the command interpreter is a new PythonCAD addition, it will undoubtedly go through several iterations before it begins to stabilize. The command set, internal command set, and means of selecting which dictionary to use to try and interpret the commands are guaranteed to change. It is also likely that commands may appear in one release, disappear in the next, then reappear in the release after that, or that commands will change meanings.