Usage Questions and Answers

A stated goal of the PythonCAD project is to produce an easy to use CAD package. Still, questions will arise as to how to do some certain operation in PythonCAD. This page will hopefully provide answers to these questions. Keep in mind that the program is in its earliest form, so an answer stating That cannot be done as the code for doing that has not yet been written will be common. Over time, that answer should appear less and less frequently, and some happy day in the future it will not appear at all. If you are able to help develop the code and do so, that day arrives sooner.

How do I ...

This list is by no means complete, and will be added to as various new question arise.

Entering Data

If you are being prompted for a single value of something, like the radius of a circle, just type it in the entry field below the drawing. If you type in the value as an integer value (no decimal point), PythonCAD will convert it to a float value if needed. If it does not do this then you have found a bug. When PythonCAD wants you enter a point in the entry area below the drawing, it will expect you to enter the point in parenthesis, with the x and y coordinates separated by a comma. So, if you wanted to enter a point at the location (0.0,0.0), just type it in like that. You do not need quotes around the parentheses, nor around the digits.

Some effort is made to evaluate what you enter, so if you enter the point like this ((3.4 + 5.5), (2.3 + 3.2)), PythonCAD will create a point at (8.9, 5.5). Entering any arbitrary expression into will probably not work (yet), though at some point it is hoped that PythonCAD will be able to handle really complex expressions. As Python itself can handle the expressions, the weakness is in the PythonCAD code.

Working with Layers

PythonCAD is built around the idea that a drawing is simply a collection of layers with various entities stored in each layer. There is no restriction as to how many layers a drawing may have. All drawings will have at least one layer, and, if you wanted to, you could put all the entities comprising the drawing in that single layer. As drawings get more complex, though, it will probably be clearer if you split up the entities between the layers. One idea could be to place all the dimensions in a layer, the construction lines and circles in another, etc. You will have to decide what works best for your particular needs.

Nearly all the layer operations can be done through the layer display on the side of the drawing. If you right-click a particular layer, a pop-up menu will appear. This menu gives you the choices of renaming the layer, hiding or showing it, and hiding or showing any layers that are children of that layer. Eventually the code will allow you to drag and drop the layers so you can re-parent them as needed. For now the drag and drop functionality only allows you to re-order the layers under a parent. That is, the children layers A-B-C can be reordered to A-C-B.

If you add a new layer, the new layer becomes the active layer. Any entities that are drawn will now be stored in this layer. If you want to change which layer is active, just click on the layer that you want to activate. When a drawing has multiple layers, the entities in the active layer are drawn showing what color they have. Entities kept in the inactive layers are all drawn the same color (currently a blue color). A future release will allow you to choose the color for inactive layers, but for now you have to stick with blue.

If you draw an object in one layer, and then decide you want to move it to another layer, you can do that through the use of the Transfer menu item in the Modify menu. After you invoke the menu item, you can click on the objects that you want to pull into the current active layer. Fillets and chamfers cannot be pulled from one layer to another just yet; this problem should be rectified in an upcoming release.

Printing and Plotting

As of the seventeenth release, PythonCAD can now print! The program will generate a PostScript file that can be sent to a printer or saved to a file. The initial printing support has several know flaws, such as not printing the dimension end-point markers like arrows or slashes. Subsequent releases will fix these problems as well as enhance the overall printing abilities of the program.

The strategy for printing support had always been to generate a file in some format that did not depend on the interface, and PostScript has filled that bill nicely. For people not using PostScript printers, there are third party software packages like Ghostscript that can convert the PostScript output into other formats.

Setting Object Attributes

Values for the object attributes in a drawing are set with the Set menuitem under the Draw menu. Depending on your choice of submenu a dialog box will appear and allow to to examine and change the attribute values as needed.

Changing Object Attributes

The ability to change an objects color, linetype, thickness, or style was added in the second release. First, you must select the objects that you want to change. Use the Select menu item in the Edit menu to select the entities that will get modified. Next, go to the Modify menu, and use one of the choices found in the Change submenu. After clicking OK in whichever dialog box that appears, the selected objects will now have the new attribute values from your menu and dialog choice.

Selecting an entity to change an attribute will cause the entity color to change indicating it has been selected. Once the attribute change has been applied, the entity will redraw itself. After changing an attribute of the selected entities, the selected entity list is cleared. This behavior may or may not be a considered a feature, and could change depending on user feedback.

Adding new Linetypes/Styles/Dimension Styles

There is no interface code written for doing this yet, so adding one of these things means delving into the code. There should be either a simple dialog box, or a sequence of dialogs, that will make it easy to do this sort of work, but none of that has been written. Also, questions regarding the saving and loading of these customized features will need answers, as the initial release (and probably many following releases) do not have any support for reading what would be a customization or preferences file.

For storing preferences, it is envisioned that there will be a global set of preferences stored in some file, and a user-specific set of preferences kept in each user's directory. If these files are written in Python code, then they could be brought into the program via an import statement, or the use of the imp module, though the decision as to what these files will be written in, let alone their format, has yet to be made. Feedback to the developers will determine what route to pursue. Other file format options are things like XML or some home-grown key/value text file.

Writing the preference files in Python does seem to present advantages over other formats, as there would be no need to try and write some sort of parser to read the file. Reading the file would be very quick, and any errors could be caught by a simple try/except block. Other alternatives could require more work for the importation of the data in the files. Still, it may be simpler to write the information out in a format other than Python, and that may be a deciding factor on just how to handle this problem.

Update: Storing the preferences as files written in Python has been implemented since the fifth release. This approach has utilized the imp module to load the file and, as the preference file is Python code, makes use of the Python interpreter to parse the file. This approach has worked reasonably well, and has provided a good initial implementation of storing and loading user preferences. At present editing the global preference file is done with a text editor, and probably requires root access as the file is hard-coded to reside in the /etc/pythoncad/ directory.

Update: As of the thirty-fifth release PythonCAD stores the global preferences values in the file ${HOME}/.pythoncad/prefs.py. The file itself is Python code and can be edited directly, but care must be exercised if doing so. The values stored in this file are used when new Images are created, but the values can be adjusted later on a per-Image basis.

Dimensioning

Dimensions are currently the most complex objects in PythonCAD. Any individual dimension has a large number of attributes that can be set, such as line and font color, dimension text position and formatting, and various properties relating to the dimension lines themselves. Dimensions are also at a very early stage in the code, so for all the things they can do, there are many lines of code still needing to be written in order to exercise all the dimension functionality that exists.

The fourth release of PythonCAD addressed many of the shortcomings in the earlier releases. Angular dimensions can be created, displayed, and saved, and linear dimensions will be displayed (they could be created but wouldn't show up). The display of the dimension text is also improved, and the interactive creation of dimensions now has some visual feedback to indicate the dimension points and text location. There is still much work to be added in making dimensions more flexible and editable, but progress is being made, and the fourth release contains vastly improved dimensioning capabilities.

General dimension properties can be set through the Preferences dialog box viathe Edit menu. Dimension setttings within an Image can be adjusted by moving thorough the Draw->Set menus. Lastly, adjusting the attributes of an existing dimension within an Image can be done via the Modify->Change->Dimension menu path.

Commands

The seventh release of PythonCAD shipped with the first iteration of a command interpreter. The long-term goal with the command interpreter is to make it possible to use PythonCAD to a great extent by just typing commands in the entry box at the bottom of the screen. As this functionality is new, it is quite limited in what it can do at the moment. Future releases of PythonCAD will add more commands and enhance the usability of the command interpreter.

Visit this page for a description of the available commands in PythonCAD.