Location: PHPKode > projects > PHP Cad and Drawing Program > overview.htm
<html>
<head>
<title>PHPCAD Drawing Program</title>
<style>
a:link          { text-decoration: none; color: #0000CC; }
a:visited       { text-decoration: none; color: #0000CC; }
a:hover         { text-decoration: none; color: #00ccCC; }
</style></head>

<body bgcolor="cccccc" marginheight="0"
marginwidth="0" leftmargin="0" topmargin="0">

<p>
<a href="http://www.sourceforge.net/projects/phpcad">
Sourceforge Project Page - http://www.sourceforge.net/projects/phpcad</a>
</p>

<table cellpadding=10><tr><td>

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

<p>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.
</p>

<b>Installation:</b>
<p> You need to have a
webserver, php, and the GD library installed.
<b>I have never tested it on Windows.</b>  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).
</p>

<p>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 Grasspatch.inc, grass.html,
and bezier.inc, unknown author for the water cooler, Auth: James R. Wilson
hide@address.com for the light and light fixture object, By Kurt Bangert
for the palm tree include file palms.inc, 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.</p>

<b>Pitch and Potential:</b>
<p>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.</p>

<p>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 hide@address.com</p>

<b>Documentation:</b>

<p>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.</p>

<p>Everytime 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.</p>

<p>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 commandline in the
phpcad directory to generate the picture.</p>

<p>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 scaleable.</p>

<p>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.</p>

<p>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.</p>

<p>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.</p>

<b>Notable Program Commands:</b>

<ol>
<li>View POV- Converts .tob to p.pov file and then displayed.  Goes to pov.php.</li>
<li>View .setup -  View picture .setup file (scaling, grid on-off, ...).</li>
<li>View .tob - View picture .tob file.</li>
<li>Edit .setup-  Sets files picture properties. Goes to setup.php (text editor is better).</li>
<li>New  - Create a new picture picture1.tob, picture2.tob, in order.
It does not create a .setup file. </li>
<li>Delete - Delete the .tob file.</li>
<li>1st Drop Box  - Select the object to add or delete.</li>
<li>2nd Drop Box - Generally text directional
attributes for the object.</li>
<li>3rd Drop Box - Numerical dimensional attributes for the object.</li>
<li>Text Box - Place for various inputs for complex objects, see the objects "help".</li>
</ol>


<b>Program INC, TOB, and SETUP Files:</b>
<ol>
<li>.inc - include files, are php functions you must collect or write.
THE PROGRAM IS NOW COMPLETELY PLUGGABLE WITH ONE .INC FILE.
See pixel.inc in directory functions.
The objects in this program are for specific purpose.  To build
houses out of papercrete (see www.padobe.com).
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.
</li>

<li>.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).
</li>

<li>.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.</li>
</ol>

<b>Program PHP Files:</b>
<ol>
<li>index.php - the viewer and editor.
<li>scriptmaker.php - writes objects to .tob files, view picture to save.</li>
<li>drawimage.php -  puts the the image into a .jpg ot .gif.
It contains and controls the ".inc", ".tob", and ".setup" files.</li>
<li>pov.php - the .tob to .pov convertor.</li>
<li>second.php - controls the javascript second form.</li>
<li>setup.php - edits the .setup files.</li>
<li>movies.php - make animated .gifs, .mngs, and .mpgs</li>
</ol>

<b>Time Based Pictures/Movies:</b>

<p>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.</p>

<p>To edit external movies, usually requires several
programs. You divide the
movie into scenes.  Then you probably de-multiplex 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.
This will be a easy way to add a little pizazz to home movies.
mencoder is another option.</p>

<b>Tips, Tricks, Comments:</b>

<p>To get reduce size the of size of .pngs try:</p>
<ul>
 <li>convert -colors 256 aaa.png zzz.png</li>
 <li>pngcrush -brute zzz.png bbb.png</li>
</ul>

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

<p>To convert .pngs in the /time directory to .jpgs use.</p>
<ul>
<li>for file in *.png; do convert $file ${file/.png/.jpg}; done</li>
</ul>

<p>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.</p>

<b>License (based upon zlib,libpng license):</b>

<p>Copyright (c) 2002-2003 William L. Berggren</p>

<p>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.</p>

<p>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:</p>

<ol>
<li>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++ , acknowledgement is required.</li><br>

<li>Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
</li>
</ol>

</tr></td></table>
</body></html>
Return current item: PHP Cad and Drawing Program