Jump to content

john7911

New Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About john7911

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling
  1. cyberRobot, benanamen, BarandThank you very much for your help and advises. i will try in some test file. 😉
  2. Thank you very much Barand for your help 😉 I will print the code and study it because i'm not a programmer. hahaha no it's not a laser rifle , it's to help pipefitter and piping designer to calculate the length of pipe they need and the angle.
  3. Hi 🙂 I wrote a PHP code but I think i can simplify more specially in the switch part , as you can see in the code. can you please give me some advise. <form method="post" action="<?=$_SERVER['PHP_SELF'];?>"> <fieldset> X: <input type="text" name="x" value="" /> <br/> Y: <input type="text" name="y" value="" /> <br/> <select name="diametre"> <option value=" "> </option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="6">6</option> <option value="8">8</option> <option value="10">10</option> <option value="12">12</option> <option value="14">14</option> <option value="16">16</option> <option value="18">18</option> <option value="20">20</option> <option value="22">22</option> <option value="24">24</option> <option value="26">26</option> </select> <input type="submit" value = "Calculer" /> </fieldset> </form> <?php if (isset($_POST["x"]) && isset($_POST["y"]) && isset($_POST["diametre"]) ){ $x = $_POST["x"]; $y = $_POST["y"]; $diametre = $_POST["diametre"]; } switch ($diametre) { case "2": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . " mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . " mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "3": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "4": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "6": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "8": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "10": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "12": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "14": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "16": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "18": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "20": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "22": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "24": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; case "26": $rayon = $diametre * 38.1; $dc = $x/2; $ad = ($y/2)-$rayon; $ac = sqrt(pow($ad,2) + pow($dc,2)); $ec = sqrt(pow($ac,2) - pow($rayon,2)); $LongueurBayonette = $ec*2; $alpha = asin($dc/$ac); $alpha = $alpha*180/M_PI; $beta = acos($rayon/$ac); $beta = $beta*180/M_PI; $angle = 180-$alpha-$beta; echo "X = " . $x . "mm" . "<br/>"; echo "Y = " . $y . "mm" . "<br/>"; echo "Longueur = " . number_format($LongueurBayonette,1) . "mm" . "<br/>"; echo "ꞵ = " . number_format($angle,1) . "°" . "<br/>"; echo "Rayon = " . $rayon . "mm" . "<br/>"; echo "⌀ = " . $diametre . '"' . "<br/>"; break; default: echo " "; } ?> The result is this page: http://cadtuts.eu/bayonette-test.php Thank you 😉
  4. Thank you @requinix for your reply 🙂 some columns I don't need at the moment as shown in the screen shot , and there are 3 column that i can calculate as you can see.
  5. Hi I need help to create a DB, I have a piping table and am wondering if I can create one table only or is suitable to create more than one, as you can see in the picture. What i want to do is in the second picture. http://oi66.tinypic.com/11746x5.jpg Thank you 😉
  6. Thank you very much for your help 😉
  7. Hi :-) How can I align digit as you can see in the screen shot. <?php function MaFonction($x){ for ($i=0 ; $i<=360 ; $i+=$x){ echo $i . " ==> " . deg2rad($i) . "<br />"; } } ?> <?php MaFonction(15 ); ?> Thank you ;-)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.