Sourceforge Project Page -

Quick Tutorial on How to Use This Program:

Pick a picture to edit and select it with submit.
Left click a point or square on the picture, coordinate should show up on the GUI.
If you Left Click again the first coordinate will become the second coordinate, and the new click will become the first coordinate.
In the object box, click on Curve.
In the direction box, click on LU for left-up.
In the length box, click on 3.
Click on submit (on Konqueror browser you will have to refresh the screen).
The object should have appeared on the screen.
To learn each objects parameters, click on object, then help, then submit. Help will show up at bottom.

There are 2 types of functions used in the program, those that must be entered with a text editor and those which you can use with the phpcad gui editor. To save time many objects/functions require a text editor. These objects are usually only required once or twice in a scene. To add text editor objects open "anyscript.tob", and edit using phpcad gui as a guide to locate points. It is almost easier to do it this way. There will eventually be 4 types of functions 2 dimension, standard; 2 dimensions, plus time; 3 dimensions, povray; and 3 dimensions in povray, plus time.


You need to have a webserver, php, and the GD library installed. I have never tested it on Windows. To use the generated povray file, p.pov, you need the Persistence of Vision, Povray 3.5, installed. The GD graphics library, by Boutell, is the key to this program support them if possible. PHP, Linux, Freetype Lib, and Apache are also key. Just unpack the program into a server directory, chmod all to 777 (chmod -R 777 phpcad) and in your web browser try to access index.php or "localhost/phpcad". For linux, put all files in the apache /var/www/html/phpcad or /var/www/phpcad (debian).

Special thanks to those that developed the following povray objects which are located in the povray directory: (C) Nathan G B O'Brien 1997 for the five columns of architecture 13_col.col, Auth: Josh English for, grass.html, and, unknown author for the water cooler, Auth: James R. Wilson for the light and light fixture object, By Kurt Bangert for the palm tree include file, and Luis Valoyes - Bogota - Colombia for the toilet object. If you run povray from the phpcad directory you need not move these to the povray inclde directory. Special thanks to all the font developers and read the text files in the ttf directory if you plan to use the fonts for commercial purposes.

Pitch and Potential:

I would like to design your CAD program to do specific projects. Almost anything that can be done on paper, film, or your imagination. For one example, I could make resistors with the correct color coding and put them on a circuit board that is scalable. Viewable on both sides of the board with soldering. Automatically generate parts list, work order, barcode, cost list, traveller, work-in-progress system.

From that I could also make a perfect 3D image of the circuit board in POV Ray automatically with the values of components etched on them. The picture would be as good as a photograph. Also drill holes in a circuit board to match the drawing automatically. You could develop, tweak, build, and track in different parts of the world very quickly. All it takes is time to develop it, and not that much time at that. My address is


I designed this program not to need any help however, if you are lost, try this below. This program is mainly used off the web as an application to design 2D and 3D stuff. As is, it can design 3D houses very well. Also it has a movie mode to make .mngs, animated .gifs, and .mpgs.

Every time you place an object using phpcad it is automatically saved and automatically layered. The object contains a start point, possibly a secondary point, and attributes such as time, color, curvature, length, end location, or shape. The attributes depend on the function.

PovRay (persistence of Vision) is an impressive free ray tracer for 3D graphics. Lets say you want to draw a wall in 3-D, you can do this by drawing a 2-D wall. Then make a p.pov. Then run ./p on the command line in the phpcad directory to generate the picture.

You can use the program to make movies (mainly credits), simple animations, 3-D drawings, cad drawings, online cad programs, graphs, charts, image maps, and web and advertising graphics. It can be used as a precursor to other program like gimp, that can be used to fill areas with color textures. Ultimately, pictures will be use as stamps to be put in any position on the picture. The program is SCALABLE! You can work on a picture in 850x1100, and can resize the picture to 5500 x 6600 for clearer printing or scale the same picture down for icons. If the objects used are scalable.

If you run this program on a server be careful of the server CPU usage since you are generating these images. The program was tested under under Konqueror, Mozilla, and Explorer (remotely), but only on apache/linux server.

A 5 kilobyte 640x480 .png is a common picture size generated by this program! However, since I began using gd 2.0.1 I have not been careful with use of colors.

To make graphs on the fly the .tob, .setup, and drawimage.php define the image. So you can use something like: img src=="drawimage.php?a=5&b=6&c=10&d=12". Where $a,$b,$c, and $d are variables in the .tob. You can put the .tob and .setup files in drawimage to increase speed slightly. If you want to have 10 different icon pictures for your website, but only 1 file, you could incorporate them into drawimage, and use a call like, img src=="drawimage.php?picture=star" to access a star icon.

Notable Program Commands:
  1. View POV- Converts .tob to p.pov file and then displayed. Goes to pov.php.
  2. View .setup - View picture .setup file (scaling, grid on-off, ...).
  3. View .tob - View picture .tob (all the walls, curves, ...) file.
  4. Edit .setup- Sets files picture properties. Goes to setup.php (text editor is better).
  5. New - Create a new picture picture1.tob, picture2.tob, in order. It does not create a .setup file.
  6. Delete - Delete the .tob file.
  7. 1st Drop Box - Select the object to add or delete.
  8. 2nd Drop Box - Generally text directional attributes for the object.
  9. 3rd Drop Box - Numerical dimensional attributes for the object.
  10. Text Box - Place for various inputs for complex objects, see the objects "help".
Program INC, TOB, and SETUP Files:
  1. .inc - include files, are php functions you must collect or write. THE PROGRAM IS NOW COMPLETELY PLUGGABLE WITH ONE .INC FILE. See in directory functions. The objects in this program are for specific purpose. To build houses out of papercrete (see These define how the object appears on the screen. You make your own functions based upon the business you are working on. For example, if your field is wastewater engineering, you make your own objects to fit your needs, clarifiers, rotating screen filters, primary sedimentation tanks, pipes, and pumps. If it is electronics you might design objects for circuit boards. These functions are not too difficult to make and is programming GD and PHP.
  2. .tob - text object file. A script of function calls. This file defines the entire picture except background (which is defined in .setup and can be overwritten).
  3. .setup - setup file, defines the background color, picture size, grid on-off, and scaling. Eventually it might contain anything else. The .setup file is "picture.setup" by default.
Program PHP Files:
  1. index.php - the viewer and editor.
  2. scriptmaker.php - writes objects to .tob files, view picture to save.
  3. drawimage.php - puts the the image into a .jpg ot .gif. It contains and controls the ".inc", ".tob", and ".setup" files.
  4. pov.php - the .tob to .pov convertor.
  5. second.php - controls the javascript second form.
  6. setup.php - edits the .setup files.
  7. movies.php - make animated .gifs, .mngs, and .mpgs
Time Based Pictures/Movies:

I am slowly developing the movie portion of this program. Basically each line of .tob code is given a dimension of time. Look at the demos to learn how to do it.

To edit external movies, usually requires several programs. You divide the movie into scenes. Then you probably demultiplex sound and video. Then break the scene into frames which is usually 720 x 480 pixels and 29.97 or 23.97 frames per second for DVD. For 60 seconds of film you will get 1800 frames. After editing them you put them back into a .mpg (.avi can be tough), multiplex the sound, recombine the scenes, and then convert to the resolution you want or convert back to DVD. It is rather quick once you get the hang of it. For HDTV I think the resolution is 1080x760. VCD is an excellent format and usually, 352 x 240 x 29.97 (23.97) and can be played on most DVD players and computers. For computer use only consider DIVX Mpeg-4 for size. You convert sizes with a program like Flask or TMPGEnc. TMPGEnc will allow you to multiplex and demultiplex .mpg, mpv, mpa, files very easily; or convert to another format. TMPGEnc seems to produce the best quality of any encoder too and works with wine. TMPGEnc has also been rated #1 out of 50 windows encoders too. mencoder, yuv2lav, mpegtools are another options, probably better.

Tips, Tricks, Comments:

To get reduce size the of size of .pngs try:

  • convert -colors 256 aaa.png zzz.png
  • pngcrush -brute zzz.png bbb.png

Doing that seems to often reduce .png size over 60 percent. Also, the colors will still look good.

To convert .pngs in the /time directory to .jpgs use.

  • for file in *.png; do convert $file ${file/.png/.jpg}; done

You can make Konqueror look exactly like a windows or x program, by editing the profile and disabling all the menu and location bars. Both Mozilla and Konqueror have full-screen options.

License (based upon zlib,libpng license):

Copyright (c) 2002-2003 William L. Berggren

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Even the implied risk that it is useful. If you make improvements to the core, I hope you will contribute back.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a commercial product, an acknowledgment in the product documentation is required. If you rewrite the concept of this program in another language or OS such as C++ , reference is required.

  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.