Location: PHPKode > projects > PHP Cad and Drawing Program > phpcad/functions/wall.inc
AAAAAAAAAAAAAAAAAAAAAAAAA
//
//    Draws a straight padobe wall 1 foot thick.
//    Padobe is a specialized material made out of paper.
//    Can be used for cobbed walls of any material.
//    4' width is standard plywood form size.
//
//    $direction = <u>"R"</u> for right, <u>"D"</u> for down
//    $length = <u>"1-12"</u> in 4' sections.
//
function wall($image, $length, $direction, $scale, $x, $y)
{
    $edge=ImageColorAllocate($image,160,160,150);
    $padobe=ImageColorAllocate($image,100,100,100);
    $x=$x*$scale;
    $y=$y*$scale;
    for($i=0; $i<$length; ++$i) {
        if ($direction == "R") {
            ImageFilledRectangle($image,$x+($i*4*$scale),$y,
            $x+(4*$scale)+($i*4*$scale),$y+$scale,$padobe);
            ImageRectangle($image,$x+($i*4*$scale),$y,
            $x+(4*$scale)+($i*4*$scale),$y+$scale,$edge);
        } else {
            ImageFilledrectangle($image,$x,$y+($i*4*$scale),
            $x+$scale,$y+(4*$scale)+($i*4*$scale),$padobe);
            ImageRectangle($image,$x,$y+($i*4*$scale),
            $x+$scale,$y+(4*$scale)+($i*4*$scale),$edge);
        }
    }
}
BBBBBBBBBBBBBBBBBBBBBBBBBBBB
if ($PObj=="wall") {
    $a=fopen("./files/$pfilez", "a");
    if ($PDir == "D") $PDir = "D";
    if ($PDir == "R") $PDir = "R";
    $xp= "<?php " . $PObj . "($" . "image,";
    $xp .=  $PLen . ',"' . $PDir . '",';
    $xp .= '$scale,';
    $xp .=  $xx . "," . $yy . "); ?>\n";
    fwrite($a, $xp);
    fclose($a);
}
CCCCCCCCCCCCCCCCCCCCCCCC
function wall($image,$length,$direction,$scale,$x,$y)
{
global $floor;
global $twall;
global $tfoundation;
global $zz;
if ($direction == "R") {
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length*4;
    $a .= "," . ($floor+9) . ",";
    $a .= $y+1;
    $a .= "> $twall}\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . ($floor) . ",";
    $a .= $y  . "><";
    $a .= $x+$length*4;
    $a .= "," . ($floor+1) . ",";
    $a .= $y+1;
    $a .= "> $tfoundation }\n\n";
    fwrite($zz,$a);
} else {
    $a = "box{<";
    $a .= $x . "," . $floor . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . ($floor+1) . ",";
    $a .= $y+$length*4;
    $a .= "> $tfoundation }\n";
    fwrite($zz,$a);
    $a = "box{<";
    $a .= $x . "," . (1+$floor) . ",";
    $a .= $y  . "><";
    $a .= $x+1;
    $a .= "," . (9+$floor) . ",";
    $a .= $y+$length*4;
    $a .= "> $twall}\n\n";
    fwrite($zz,$a);
}
}
DDDDDDDDDDDDDDDDDDDDDDDD
$inthemenu = "yes";
$dirlist= array("D","R");
$lenlist= array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15");
$txtitem="";
EEEEEEEEEEEEEEEEEEEEEEEEEEEEE
Return current item: PHP Cad and Drawing Program