# QSCad

# Home Page

## Introduction

QSCad started as an academic exercise to see if TCL/Tk was up to the job of a real application, At the time I wanted to replace PadsPCB as there was no Linux version of it. I looked at packages such as gEDA but found that they were took up large amounts of disk space, and depended on libaries that had to be installed independantly.

## Purpose

The purpose of this project is to provide a repository for the source code as it stands and to see if there is enough interest in the application to develop it futher.

## Overview

The software provides the basic editing for decals, schematic diagrams, flow charts, part editing, and PCB layout.

You can see some screen shots here.

It is not designed for production environments. It should suffice for the hobbiest.

## Download

Source is available as well as binaries with TCL built into an executable that automatically runs QSCad. There have been made with FreeWrap and are available for Windows and Linux for people that do not have TCL installed. The scripts have been designed for TCL 8.0 but will run under all recent versions up to 8.4.

The scripts have not been built into the binaries so that people can still make modifications without having to ask me to do it for them.

The files are located here.

## Technical Details

### Platform

Runs on all platforms where TCL is supported.

Tcl version 8.0 to 8.4.

Package Tk required for the GUI.

Only printing code is OS specific.

### Code Size

Less than 5000 source lines.

Approximately 150K source size.

### Features

1. Rubber banding.

2. Multiple gates per part.

3. Alternate decals per gate.

4. Multiple layers.

### Missing Features.

1. Undo.

2. Autorouting.

3. Autopart create.

4. Groundplaning.

5. Thermals.

6. Design rule checking.

7. Gerber file output.

8. Drill file output.

## Technical Critique

When this application was written , my understanding of TCL was at a novice level. As a seasoned programmer I could grasp most of the tenents of the language but looking back this is how I see the code now.

### Suitability

TCL/TK was highly suited to this application, due to the high level of functionality provided by the canvas widget Tcl's associative arrays and lists was well suited to the storage of information needed to maintain a drawing.

What makes the whole project freasable is the canvas's ability to attach data to each object. This means that the object on the screen hold all the data needed for the schematic and PCB editors to work. Also the use of floating point numbers for the object coorinates means that the canvas can be scaled on screen without having to use a backup array to hold the real world coordinate values.

### Inefficencies

The handling of Tags. The canvas is limited when it comes to searching with complex tag criteria. Also tags cannot always be used for group operations (such as changing the width of all lines an a part) as the canvas functions will throw an error in an attribute is not supported for a specific item included in a group. This means that all canvas items must be processed infividually with checking which is grossly inefficent.

### Brick Walls

One of the holes in TK is the integration with the OS when it comes to printing. If you don't have a postscript compatible printer then printing under Windows is cumbersome to say the least.

### Capability

I would rate TK's capability as 80%. Unfortunately the extra 20% comes at considerable effort. The inability to handle fractional point sizes requires some work if scaling of fonts is desired.

A 5% improvement in code size could be made in recoding some routines an removing the use of return. Another 5% improvement in code speed could be made by using tk8.3 ability to take coordinates as a list.

### Improvements

1. Under TCL 8.3 canvas items can take the coordinates as a list. This would reduce the use of eval considerably.

2. Change some of the base routines to use associative arrays rather than lists. Restructure the code to dealing with lists to return values that the application wants to reduce the number of conversions.

3. Remove the use of Return statements and use the value of the last operand which in most cases is the same as the return value.

4. Change the use of Scan to ForEach syntax as it is significantly faster.

5. Create Application Fonts using TK's font command and use these as the font name in canvas items. This would allow scaling to be done in a reasonably efficient way.

6. Look at changing the base tag handling. See if a better coding can be found that suits the limited tag handling ability.