Skip to main content

Semester project for OOP course

Project description


Semester project for OOP course

The goal of this project is to create a simple version of a CAD application inspired by the early versions of Autocad.


To install Caddy, simply use pip:

$ pip install caddy

and run with following command:

$ caddy


The following software and libraries are required to run Caddy:

  • Tkinter

Project assignment

The application allows one to draw the following shapes:

  • polylines (a line containing multiple segments)
  • rectangles
  • circles
  • optional any other objects you might want to add

Next to drawing shapes, the application provide additional actions:

  • save shapes into a file
  • load shapes from a file
  • remove a shape
  • move a shape
  • remove all shapes upon getting a confirmation from a user
  • list drawn shapes
  • quit the application asking to save any changes
  • optional undo the last action
  • optional redo the last action
  • optional export as SVG file
  • optional zoom in / out the canvas
  • optional pan the canvas

The drawing can be done by either typing commands into the command panel or by using mouse.

Command-line interface

At the bottom of the application, there is a command panel. It contains a command input area where a user can type commands corresponding to the above actions. Above the input, it shows a history of executed commands with any additional command output or error messages in case there was a problem.

Mouse interface

All the actions are also to be invoked using mouse by selecting an appropriate menu item or a toolbar icon. Some actions need additional parameters:

  • points are selected by clicking in the canvas (optional changing the mouse cursor to crosshair).
  • shapes are selected by clicking in the canvas (optional changing the mouse cursor to select).
  • filenames are represented by appropriate file selection dialogs


The following is the grammar of the command language in BNF format with regex definition for STRING, NAT and INT:

STRING ::= "\w+"
NAT ::= \d+
INT ::= [+-]\d+ 

  | <RECT> 
  | <CIRCLE> 
  | <SAVE> 
  | <LOAD> 
  | <REMOVE> 
  | <MOVE> 
  | <CLEAR> 
  | <LS> 
  | <QUIT>

LINE ::= line <POINT> <POINTS>

RECT ::= rect <POINT> <POINT>
  | rect <POINT> <NAT> <NAT>

CIRCLE ::= circle <POINT> <NAT>
  | circle <POINT> <POINT> 

SAVE ::= save <STRING>

LOAD ::= load <STRING>

REMOVE ::= remove <POINT>

MOVE ::= move <POINT> <POINT>

CLEAR ::= clear

LS ::= ls
  | ls <POINT>

QUIT ::= quit


The language contains 5 data types: a stringm a natural number, an integer, a point and a relative point. The difference between a point (eg. 10,20) and a relative point (e.g. +10,-20) is that relative point is always calculated from the coordinates of its predecessor or from 0,0 if it does not have any preceding point.


Draw a line connecting all given points.


Draw a rectangle. It accepts two forms:

  • rect <POINT> <POINT> where the first point is top-left corner and the second is bottom-right corner.
  • rect <POINT> <NAT> <NAT> where point is the top-left corner and the two natural numbers indicate width and height.


Draw a circle. It accepts two forms:

  • circle <POINT> <NAT> where point is the center and the natural number indicates radius.
  • circle <POINT> <POINT> where the first point is left-most point of the circle and the second is the right-most point.

Save, Load

Save or load shapes to or from a given filename. The representation is simply a sequence of commands the shapes.


Remove all the shapes that intersects with the given point.


Move all the shapes that intersects with the given point to a new point.


Ask for a conformation and if accepted, removes all the shapes.


List all the shapes or the shapes intersecting the given point in the form of an action that could be used to draw them.


Ask for a confirmation and if accepted, quits the application.

Implementation Details

  • Most GUI frameworks define 0,0 origin in the top left corner and the width,height in the bottom right corner.
  • In technical drawing, however, it it usually the bottom left corner that defines origin 0,0 going to top right corner for width,height.
  • This application will honor the technical drawing. The conversion is done using affine transformation.
  • For simplicity make the window non-resizeable and only use the available canvas size. For the ones who want to challenge themselves, feel free to implement panning (scrolling the canvas) and different zoom levels.
  • You need Java 11. If you see any problems with running maven, make use maven uses the right Java.

Implementation Rules

  • The requirements marked as optional will earn you extra points. They are also fun to implement.
  • Feel free to use the provided skeleton and change whatever needs to be changed.
  • You will be judged by the quality of the final application and proper use of object-oriented design.
  • Do not copy from other teams, plagiarism is illegal and all concerning teams will be punished.
  • Do not use any additional library except for testing. The point is that you, yourself try to implement some of the basic concepts.
  • We provide a few basic icons, feel free to replace them with a better alternatives.
  • If something is not clear, just raise an issue in the repo so everyone can see it.
  • If you get stack, contact one of the teaching assistant.
  • Good luck!

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

caddy-1.3.2.tar.gz (37.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page