|
class_05
|
|
-
Here is the basic template for a procedure
global proc string myModel ( float $width, float $height, float $depth ) {
$myModelItems = `group -em`;
// create some item
$myItem = `nurbsCube -p 0 .5 0`;
// Transfrom the item
move 0 .5 0;
scale $width $height $depth;
// parent
parent $myItem[0] $myModelItems;
return $myModelItems;
}
In this class session: make a table that is parametric and modifies
itself according to it's overall size
Parameters: height, width, length
Variables: thickness of table top, thickness of legs, number of legs, profile shapes
global proc string table ( float $width, float $height, float $depth) {
$tableItems = `group -em`;
// Initializing Variable -- Making Assumptions -- Designing
$topThickness = .1;
$legThickness = $width * .1;
$flushToLegDimension = $width+$legThickness;
$overhang = 2 * $topThickness;
// create the table top
$tableTop = `nurbsCube -p 0 .5 0`;
// Transfrom the item
move 0 $height 0;
scale ($flushToLegDimension + $overhang) $topThickness ($flushToLegDimension+$overhang);
// parent
parent $tableTop[0] $tableItems;
// create a leg1
$leg1 = tableLeg( $legThickness, $height, $legThickness);
move ($width/2) 0 ($depth/2);
parent $leg1 $tableItems;
// create a leg2
$leg = tableLeg( $legThickness, $height, $legThickness);
move (-1*$width/2) 0 ($depth/2);
parent $leg $tableItems;
// create a leg3
$leg = tableLeg( $legThickness, $height, $legThickness);
move ($width/2) 0 (-1*$depth/2);
parent $leg $tableItems;
// create a leg4
$leg = tableLeg( $legThickness, $height, $legThickness);
move (-1*$width/2) 0 (-1*$depth/2);
parent $leg $tableItems;
return $tableItems;
}
global proc string tableLeg ( float $width, float $height, float $depth ) {
$myModelItems = `group -em`;
// create some item
$legItem = `nurbsCube -p 0 .5 0`;
// Transfrom the item
scale $width $height $depth;
// parent
parent $legItem[0] $myModelItems;
return $myModelItems;
}
|
class_05
|