PYTHONCAD HAS MOVED TO A NEW SITE

This website is out-of-date. PythonCAD has found a new maintainer, and with it a new home. Please visit the new site http://sourceforge.net/projects/pythoncad. Update your bookmarks as necessary.

Welcome to the (old) PythonCAD home!

PythonCAD is a CAD package written, surprisingly enough, in Python. The PythonCAD project aims to produce a scriptable, open-source, easy to use CAD package for Linux, the various flavors of BSD Unix, commercial Unix, and other platforms to which someone who is interested ports the program. Work began on PythonCAD in July, 2002, and the first public release was on December 21, 2002.

The thirty-sixth release of PythonCAD was made available on May 12, 2007. This release is primarily a bug-fix release. Several bugs regarding user preference storage were fixed, as were a number of drawing and entity selection bugs. PythonCAD users on Windows will now have their preferences stored in a PythonCAD subdirectory in the APPDATA environment defined directory.

Between the sixteenth and seventeenth releases of the program, the code was moved around internally to better cooperate with other Python programs. Unfortunately the Cocoa front-end code has suffered since then due to lack of maintenance and is currently not functional. Releases after the seventeenth release have attempted to improve the situation, but to no avail. A developer or team of developers running Mac OS X is needed to bring the Cocoa code into a usable state.


Requirements

PythonCAD requires a few bits of software to be up and running on your machine before it will work. You need to have Python 2.2 or newer installed with the zlib module, gtk-2.0, and pygtk-2.0. The code uses features introduced in Python 2.2, so earlier versions will not work, and the GTK/PyGTK code requirements are equally strict, as code for the pygtk-2.0 module do not work with the earlier release. If you want things to work with gtk-1.2 and the older PyGTK, you will have to do some coding.

Users on Mac OS X wishing to try the native Cocoa based front end will need the Python/Objective-C bridge. Download the code from http://pyobjc.sf.net. Also, Mac OS X should be at version 10.3, as using older releases produces erratic results.

Screenshots

What would a web page for a CAD package be without screenshots? Go see what PythonCAD looks like!

Download the Code

Archives for the release, as well as information for gaining access to the code repository is kept on the download page. Go get the code!

Building PythonCAD

The code for PythonCAD is just Python, so the typical configure && make step that many if not most open source programs require does not apply. At some point in the future, parts of the code may be written in C, but one of the goals with this project is to write minimal code in a language other than Python. Developing with Python, or in a broader sense a higher level language than C, means quicker development time, fewer lines of code to debug, fewer platform dependency issues, and a much simpler way to get a program working. Plus, writing the application in Python means a scripting language for the application is built in!

Thanks go out to the Python developers for all their work in making Python the powerful, flexible, fast, and easy to use language it has become.

Installing PythonCAD

As mentioned above, you will need to have Python and PyGTK installed before you can run PythonCAD. Installing these programs is highly platform specific, so no installation guide for these requirements can be provided here. You need to follow whatever steps your platform requires, whether it is installation via a pre-built package or a download/compile/install routine.

The installation of PythonCAD is done in two steps. First, you need to invoke the setup.py script:

$ python setup.py install

Now, copy the file gtkpycad.py to a directory in which you can install programs. For example, copy it to /usr/local/bin ...

$ cp gtkpycad.py /usr/local/bin
$ chmod a+x /usr/local/bin/gtkpycad.py

At this point you should be set. Just type gtkpycad.py (without the quotes) at the prompt and the program should start.

The examples above assume that you do not need to be the root user to do the installation. Whether you do the installation as the administrator or not depends on your system configuration. There is no reason to make the gtkpycad.py script a setuid script.

Update: PythonCAD has a means of reading a global and user preference file. Installing the global preference file will require root access. To install the file prefs.py, as the root user do the following ...

# mkdir /etc/pythoncad
# cp prefs.py /etc/pythoncad

The preferences file prefs.py is written in Python. There are numerous comments in it describing the various items that can be set, and the file also has examples of adding new linetypes, drawing styles, and dimension styles to PythonCAD. This file can also be copied into a .pythoncad directory in a user's home directory, allowing an individual user to add additional customization to PythonCAD beyond those in the global preferences file.

Instructions and Documentation

So now that PythonCAD is installed, just how does it work? This page is where to go for some basic instructions. In the future, as more documentation is created, it will be located here in addition to being distributed with the code.

Update: PythonCAD now has a Wiki page! Follow the link for more information! My thanks to Jose Antonio Martin Prieto for creating and hosting the Wiki pages.


Development

Unlike many other open-source projects, this one doesn't use CVS. Instead, it uses Subversion as the source code management system. Subversion is aiming to replace CVS, fixing many of the shortcomings currently found in the CVS program.

A read-only copy of the main Subversion repository is available. Details about retrieving the PythonCAD code through Subversion are given on the download page. Mirroring the repository can possible begin soon, depending on interest from people with the disk space, tools, and network access needed to act as a mirror site.

Mailing List

There is a mailing list for people interested in developing and using PythonCAD. Visit the mailing list homepage for information about subscribing to the list. This page also provides a link to the mailing list archives that are viewable in a web browser.

Thanks to the good people running the mailing lists hosted at the Python domain for hosting this list.

Program Design

The following list provides links to pages that describe in detail various aspects of PythonCAD that will be of use to developers:

PythonCAD offers an initial implementation of a command interpreter that allows for the entry of commands within the PythonCAD text entry field and executes them. This feature will is in an early stage of development, but is planned to eventually allow for the creation of drawings without using the mouse and menus. The long term goal is to provide a clean, robust way for end users to have a command set that is comparable to that found in other CAD packages and make PythonCAD easier to use. The current list of commands is available here.


Design Issues

The program is designed to keep the interface code as separate from the generic code as possible. The goal is to ease the development of new interfaces for the program. Currently, the interface code uses PyGTK to present a GTK-based front end. As a similar Python module for KDE exists, there is no technical reason why the program could not have a native KDE front end. Similarly, a GNOME front end could be created if the appropriate module is used. As Python modules for other GUI environments appear, then ports to those interfaces should be possible. What will be needed are developers willing to make these ports happen.

Building a program that would run under many different interfaces would be a challenge. However, the difficulty is much less than that faced by programs written in languages like C, as Python has provided a common base on which to build. Having the code run under KDE, GNOME, GTK, and whatever else would be a great way to keep focused on designing a solid core program that does not rely too heavily on one particular environment and its requirements. Additionally, watching it run under various graphical interfaces would be simply neat.

Future Development Directions

A page for listing some of the areas in which PythonCAD development should address is here. If you can think of some features that PythonCAD should have, check the page and see if they are there. If not, send a description of what you want to have added.

PythonCAD has now been publicly available for two years. A short summary of the development efforts over the second year is now available. The summary that appeared after the first year of development is found here.


Links

Here are a few links to the things you need to run PythonCAD.

PythonCAD does run on Windows if you have the Windows ports of the required libraries and modules. The following links can help you get the GTK and PyGTK libraries. Please note that there almost certain to be issues with regards to file saving and loading on the windows ports due to line-terminating differences. These will be worked out eventually.

Other sites may offer similar builds of these packages as well.

Here are a few links to some other good things ...


E-mail the Developer

Just who is behind this?
My name is Art Haas. I started this project, and am currently the primary developer. Care to join in the fun?
Can I reach you via e-mail?
Yes. Here is my e-mail address: ahaas@airmail.net. Send me any patches you create, suggestions for improvements you would like to see in PythonCAD, problem reports regarding PythonCAD, etc. There is also a mailing list for PythonCAD. Visit the mailing list homepage for more info.