A CAD package written in Python using the PyQt interface

Free Software

PythonCAD is a CAD package written, surprisingly enough, in Python using the PyQt interface. The PythonCAD project aims to produce a scriptable, open-source, easy to use CAD package for Linux (Cross Platforms)

PythonCAD Features:

  • Free Source Scripting in Python
  • Cross Platform
  • Light
  • Easy
  • Read dxf file

Basic CAD Concepts of PythonCAD:

  • PythonCAD Entities

Entities are graphical objects in a CAD system. Typical entities which are supported by most CAD systems are: points, lines and circular and elliptical arcs. More complex and CAD specific entities include polylines, texts, dimensioning, hatches and splines. AttributesEvery entity has certain attributes such as its color, line type and line width.

  • PythonCAD Layers

A basic concept of computer aided drafting is the use of layers to organize a drawing. Every entity of a drawing is on exactly one layer and a layer can contain lots of entities. Typically entities with a common 'function' or common attributes are put on the same layer. E.g. you might want to put all axes in a drawing on a layer named 'axes' (see Figure 1). Layers can have attributes (color, line width, line style). Each entity can have its own attributes or have its attributes defined by the layer it is placed on. In the latter case you can change for example the color of all 'axes' entities by changing the color of the layer 'axes'.

In manual drafting, a similar approach was used. Different building systems, such as wiring and air conditioning were often drawn on separate transparent sheet of paper. These sheets were then overlaid on one another to produce final drawings.

  • PythonCAD Blocks

A Block is a group of entities. Blocks can be inserted into the same graphic more than once with different Attributes and different locations, scaling factors and rotation angles (see Figure 2). Such an instance of a block is usually called an Insert. Inserts have attributes just like entities and layers. An Entity that is part of an Insert can have its own attributes or share the attributes of the Insert. Once created, Inserts are still linked to the Block they instantiate. The power of inserts is, that you can modify the Block once and all Inserts will be updated accordingly.

  • PythonCAD Drafting in CAD

In many ways, CAD is similar to traditional drafting. When drawing a plan or a view of an object on a paper, you would use tools such as a ruler to draw lines. In CAD systems there is a variety of tools available to achieve the same goal. The big advantage of a CAD system is the fact that you can change every entity of your drawing easily after you've created it. This might be the most difficult thing to learn when moving from paper to CAD. When working with a CAD system you will very often create lines that won't be on the final printout or which don't have the correct length and need to be trimmed later (see Figure 3). A common mistake of CAD beginners is wanting to create the final drawing right away.

  • PythonCAD Coordinate Systems

A good understanding of how coordinates work is absolutely crucial if you are to make the best use of any CAD program. If you're not familiar with coordinates it's highly recommended that you take some time to familiarize yourself with the basic concepts.

  • PythonCAD Origin

The origin of the drawing is the point where the X and Y axis cross each other. It's the absolute zero of the drawing. In addition to the origin there's a relative zero point. This is a helpful spot that changes it's position depending on the current user interactions. The relative zero point can also be moved around by the user.

  • PythonCAD Cartesian Coordinates

The Cartesian coordinate system is the standard coordinate system. It was named after the French philosopher René Descartes (1596-1650). The position of a point is described by its distance from two axes, X and Y. It is commonly denoted by x, y where x and y are the distances. Positive X direction is left while positive y direction is up.

Cartesian coordinates can also originate in a position different from the origin. In that case we talk about 'relative coordinates'.

  • PythonCAD Polar Coordinates

Polar coordinates use a distance and an angle to describe the position of a point.

Just like Cartesian coordinates, polar coordinates can also originate in a position different from the origin.

  • PythonCAD Object and Grid Snapping

To specify a coordinate, you can use the snap feature which allows you to precisely select grid points or significant points on existing objects: endpoints or midpoints of lines, etc.

  • PythonCAD Basic Editing

Entities can be inserted, selected, and, once selected, can be deleted, transformed or duplicated. To insert an entity means to draw it by selecting the appropriate drawing tool, such as line, arc, etc., and by locating points that define the object to be drawn, such as the endpoints of a line.

  • PythonCAD Entity Selection

An entity must be selected before it can be deleted, duplicated, or transformed. Entity selection is one of the most basic of CAD operations. There are a wide variety of selection tools to quickly select groups of entities, entities within a range, connected entities, etc.

  • PythonCAD Deletion

Deleting an entity means to remove it from the drawing.

  • PythonCAD Modifications

Basic modifications of a CAD systems include translation, rotation, reflection, and scaling. As well as these operations which don't alter the characteristic geometry of selected entities, there are some that do. You can break, trim, extend or stretch existing entities.

  • PythonCAD Dimensions

The required sizes of features are conveyed through use of dimensions. Distances may be indicated with either of two standardized forms of dimension: linear and ordinate.

  1. With linear dimensions, two parallel lines, called “extension lines,” spaced at the distance between two features, are shown at each of the features. A line perpendicular to the extension lines, called a “dimension line,” with arrows at its endpoints, is shown between, and terminating at, the extension lines. The distance is indicated numerically at the midpoint of the dimension line, either adjacent to it, or in a gap provided for it.
  2. With ordinate dimensions, one horizontal and one vertical extension line establish an origin for the entire view. The origin is identified with zeroes placed at the ends of these extension lines. Distances along the x- and y-axes to other features are specified using other extension lines, with the distances indicated numerically at their ends.

Sizes of circular features are indicated using either diametral or radial dimensions. Radial dimensions use an “R” followed by the value for the radius; Diametral dimensions use a circle with forward-leaning diagonal line through it, called the diameter symbol, followed by the value for the diameter. A radially-aligned line with arrowhead pointing to the circular feature, called a leader, is used in conjunction with both diametral and radial dimensions. All types of dimensions are typically composed of two parts: the nominal value, which is the “ideal” size of the feature, and the tolerance, which specifies the amount that the value may vary above and below the nominal. Architectural Dimensions

  • PythonCAD Viewing in CAD

Unlike in manual drafting, there is no need in CAD to determine in advance the sheet size and drawing scale. There is no drawing scale: all sizes and distances are specified using their full-scale values. A 10 meter object is drawn as a 10 meter object. Only at the printing stage, the drawing scale needs to be determined based on sheet size and drawing size.

On the screen, the user can adjust the currently visible area of the drawing by zooming in to view more detail or zooming out to view a wider extent. Another important viewing operation in CAD is panning. To see another portion of the drawing without changing the display scale, a user pans to it by “moving” a rectangular display window until it's over the desired spot.


This is a list of the feature for the new kernel of PythonCAD I would like to have those features done for the end of 2010

PythonCAD Geometrical entity:

  • Segment
  • Arc/Circle
  • Polyline
  • Conic (Ellipse/Hyperbole..)
  • Polygon
  • Point
  • Nurbs (Not sure for R38)

PythonCAD Drawing Entity:

  • Dimension
  • Arrow
  • Label
  • Text
  • Titleblock

PythonCAD Entity Style:

  • color
  • linetype

PythonCAD Composed Entity:

  • Layer
  • Block(group)
  • Hatch

PythonCAD External Format:

  • Import\Export DWG using LibreDWG
  • Import\Export DXF file
  • Import\Export SVG file (Not sure for R38)
  • Integration with sympy object via python interactive

PythonCAD Other Feature:

  • Block repository
  • Api Interface for fast develop from external program
  • Easy extension mechanism for developing custom command

PythonCAD Interface R38 Road Map. General goal is to provide interface for every kernel object and to make the program as intuitive as possible:

PythonCAD window behavior

  • make the window remember position of toolbars when the worksession is ended
  • updating the statusbar so it will display coordinates and allow to set basic drawing tools (such snap,ortho and grid)

Drawing area. Selection (emulate standard CAD selection methods):

  • “click and drag” from left to right: draw a rectangle that select included entities
  • “click and drag” from right to left: draw a cross selection rectangle
  • alt+“click and drag” could draw a freehand line selecting crossed entities like the one inkscape have (maybe postdated)
  • shift+select add object to current selection set

User Keyboard Input:

  • allow entering absolute cartesian coordinates
  • allow entering relative cartesian coordinates from last point
  • allow entering absolute polar coordinates
  • allow entering relative polar coordinates
  • allow to directly type the distance of a segment (angle will be setted by mouse position)
  • using shortcuts to start commands

Make every object and command work with preview too

Implementing snap marks

Implementing tracking marks for ortho mode


  • creating a basic dialog for printing
  • allowing to set printing scale
  • creating basic support for ISO page layouts

User Preferences

  • units setup (for distances, but mainly for angles, so we don't have to type them in radians)
  • settings for main application behavior
  • settings for main application appearence
  • settings storage in local user directory