<?php
header('Content-Type: application/x-ruby');
header('Content-Disposition: attachment; filename="tisch.rb"');
if (isset($_POST['hoehe']) &&
isset($_POST['laenge']) &&
isset($_POST['breite']) &&
isset($_POST['b_laenge']) &&
isset($_POST['b_durchmesser']) &&
isset($_POST['vorschau']))
{
$hoehe = intval($_POST['hoehe']);
$laenge = intval($_POST['laenge']);
$breite = intval($_POST['breite']);
$b_laenge = intval($_POST['b_laenge']);
$b_durchmesser = intval($_POST['b_durchmesser']);
}
$text = "
require 'sketchup.rb'
def createFace (points,height)
base = Sketchup.active_model.active_entities.add_face points
base.pushpull 0 - height
end
def createtable
# ********** Variablen ********** #
# Folgende Variabeln editieren!
# X = breite, Y = tiefe, Z = höhe
breite = <?php echo $breite; ?>.mm
tiefe = <?php echo $laenge; ?>.mm
hoehe = <?php echo $hoehe; ?>.mm
staerke = 40.mm
tischbeinhoehe = <?php echo $b_laenge; ?>.mm
durchmesser = <?php echo $b_durchmesser; ?>.mm
abstand = 150.mm
#Ab hier keine Code Veränderungen
null = 0.mm
tischbeinkanten = 200
radius = (durchmesser / 2)
beinhoehe = (hoehe - staerke)
tischbein1 = [abstand,abstand,null]
tischbein2 = [(breite - abstand),abstand,null]
tischbein3 = [(breite - abstand),(tiefe - abstand),null]
tischbein4 = [abstand,(tiefe - abstand),null]
# ********** Platte ********** #
model = Sketchup.active_model
entities = model.active_entities
group = entities.add_group
entities = group.entities
pts = [[null,null,tischbeinhoehe], [breite,null,tischbeinhoehe], [breite,iefe,tischbeinhoehe], [null,tiefe,tischbeinhoehe]]
table = entities.add_face pts
table.pushpull tischstaerke
# ********** Beine ********** #
# 1. Bein #
model = Sketchup.active_model
entities = model.active_entities
group = entities.add_group
entities = group.entities
beinkreis1 = entities.add_circle tischbein1, Z_AXIS, radius, tischbeinkanten
tischbein1 = entities.add_face beinkreis1
tischbein1.pushpull -tischbeinhoehe
# 2. Bein #
model = Sketchup.active_model
entities = model.active_entities
group = entities.add_group
entities = group.entities
beinkreis2 = entities.add_circle tischbein2, Z_AXIS, nradius, tischbeinkanten
tischbein2 = entities.add_face beinkreis2
tischbein2.pushpull -tischbeinhoehe
# 3. Bein #
model = Sketchup.active_model
entities = model.active_entities
group = entities.add_group
entities = group.entities
beinkreis3 = entities.add_circle tischbein3, Z_AXIS, radius, tischbeinkanten
tischbein3 = entities.add_face beinkreis3
tischbein3.pushpull -tischbeinhoehe
# 4. Bein #
model = Sketchup.active_model
entities = model.active_entities
group = entities.add_group
entities = group.entities
type = m.materialType
if (type)
UI.messagebox type
else
UI.messagebox "Failure"
beinkreis4 = entities.add_circle tischbein4, Z_AXIS, radius, tischbeinkanten
tischbein4 = entities.add_face beinkreis4
tischbein4.pushpull -tischbeinhoehe
end
createtable
# ********** EOF ********** #
";
$datei = $text;
readfile($datei);
?>