Program Code Description

This page will describe the various elements of the PythonCAD source code and the object hierarchy.


The PythonCAD distribution tar file contains the following files and directories:

  • PythonCAD directory (contains source code)
  • po directory (contains language translation files - currently English and Spanish)
  • (main routine to start GTK-based pythonCAD)
  • (main routine to start Mac Cocoa-based PythonCAD)
  • (global preferences file)
  • (installation program)
  • pythoncad.spec (build/installation file?)
  • (part of build/installation?)
  • pythoncad.xsd (XML schema for drawing file format)
  • pythoncad.desktop (Linux file?)
  • pythoncad.png (icon image)
  • README (text introduction to PythonCAD)
  • TODO (text To Do list)
  • NEWS (text Change Log release notes)
  • INSTALL (text Unix installation instructions)
  • COPYING (text GPL license)

—- The source code is contained in the PythonCAD directory. All code that comprises the core objects in the program, and anything else that is interface neutral, is kept in the Generic subdirectory. The interface code is kept in an Interface directory, and the code for a specific interface is kept in a subdirectory below that.

Generic directory

(basic CAD code)

There are presently no subdirectories in this directory. It is in this directory that the code for things like points, segments, layers, etc., is located. Also, there is code in here for things such as calculating intersections of the objects, compressed file reading and writing, saving and loading of files, and various utility functions. There will probably be several subdirectories in here at some point, and files performing certain functions will be moved as needed, but these changes will depend on how the program evolves. All code that finds its way into this directory should never rely on any Python modules outside of the standard set of Python modules.

Generic code

Interface directory

(User interface code for GTK and Apple Cocoa)

Here is where the Gtk subdirectory sits, and in that directory is all the code for presenting the user interface. It is this code that relies on the PyGTK module. So far that module is the only third party module needed for running PythonCAD.

As more interfaces are added, their code should then be placed in this directory. All code in the Interface directory uses code in the Generic directory to whatever extent is needed. If a particular interface is requiring some specific functionality in the drawing entities, rather than code being added in this directory that performs the function, that functionality should be considered being moved to the entity itself so that other interfaces may also benefit. By enriching the basic functionality of the core objects, the interface code can be kept to a minimum, and interface-specific object functionality will be reduced. This should hopefully produce a more robust core code-base.

GTK code

Cocoa code

Object Hierarchy

Pythoncad R38 Hierarchy

program_code_description.txt · Last modified: 2010/04/10 07:29 by