<
head>
</
head>
<!--
Index for DEF nodes:
BlackText,
ControlPanel,
DarkBlueGreyMetal,
Display,
DisplayField,
Fan,
FanBlade,
FanClock,
FanHub,
FanHubMiddle,
FanHubTop,
FanPath,
GreenStatus,
GtoRColorInerp,
LeftFanBlade,
LightGreyMetal,
MaterialGroup,
MotorAmp,
MotorButtonActionOff,
MotorButtonActionOn,
MotorClockOff,
MotorClockOn,
MotorDisplayMaterial,
MotorHousingGroup,
MotorStatus,
OffButton,
OffButtonDownPath,
OffButtonUpPath,
OnButton,
OnButtonDownPath,
OnButtonUpPath,
RedStatus,
RemoteControl,
RightFanBlade,
RotatingFanGroup,
RtoGColorInerp,
SensorOffButton,
SensorOnButton,
SpeedDisplay,
StatusDisplay,
SwitchBack,
SwitchGroup,
SwitchNob,
SwitchPlaneSensor,
SwitchTouchSensor,
SwitchTransform
Index for Viewpoint images:
Viewpoint_1,
Viewpoint_2,
Viewpoint_3,
Viewpoint_4
-->
<
Scene>
<
Viewpoint description='
Fan'
position='
1 0 10'/>
<
Viewpoint description='
Control Panel'
position='
-1 0 5'/>
<
Viewpoint description='
Watch Fan Spin'
orientation='
0 1 0 1.571'
position='
10 0 0'/>
<
Viewpoint description='
Remote Control'
orientation='
1 0 0 -1.571'
position='
0 3 20'/>
<
Background groundColor='
.3 .6 .4'
skyColor='
.6 .6 .9'/>
<!-- Rotating Fan -->
<
Group DEF='
MaterialGroup'>
<
Shape>
<
Sphere radius='
.001'/>
<
Appearance DEF='
DarkBlueGreyMetal'>
<Material diffuseColor='0.4 0.4 0.4' specularColor='0.4 0.4 0.6'/>
</
Appearance>
</
Shape>
<
Shape>
<
Sphere radius='
.001'/>
<
Appearance DEF='
LightGreyMetal'>
<Material diffuseColor='0.7 0.7 0.7' shininess='0.1' specularColor='0.9 0.9 0.9'/>
</
Appearance>
</
Shape>
</
Group>
<
Transform rotation='
0 0 -1 1.571'
translation='
2 0 0'>
<
Group DEF='
RotatingFanGroup'>
</
Group>
</
Transform>
<!-- This is where the motor goes. -->
<
Transform>
<
Group DEF='
MotorHousingGroup'>
<
Transform>
<
Shape>
<
Box size='
3.65 3.65 3.65'/>
<
Appearance>
<Material/>
</
Appearance>
</
Shape>
</
Transform>
</
Group>
</
Transform>
<!-- -->
<
Group DEF='
ControlPanel'>
<!-- This switch is used to control the fan -->
<
Transform scale='
.2 .2 .2'
translation='
-1 -.3 1.825'>
<
Group DEF='
SwitchGroup'>
<
Transform rotation='
0 0 1 1.571'>
<
Transform rotation='
1 0 0 1.571'>
<
Shape>
<
Appearance USE='
DarkBlueGreyMetal'/>
<
Extrusion crossSection='
0 1.2 0 1.0 -2 1.0 -2 -1.0 2 -1.0 2 1.0 0 1.0 0 1.2 2.2 1.2 2.2 -1.2 -2.2 -1.2 -2.2 1.2 0 1.2'
spine='
0 0 0 0 .5 0'/>
</
Shape>
</
Transform>
</
Transform>
<
Transform translation='
0 -1.5 .251'>
</
Transform>
<
Transform translation='
0 0 .1'>
<
Shape DEF='
SwitchBack'>
</
Shape>
</
Transform>
</
Group>
</
Transform>
<!-- Fan Status Display -->
<
Transform translation='
.5 -.5 1.83'>
<
Group DEF='
Display'>
<
Transform translation='
0 0 .01'>
<
Shape>
<!--
SpeedDisplay ROUTE:
[
from MotorAmp.displayFanSpeed to set_string
]
-->
<
Text DEF='
SpeedDisplay'
string='
OFF'
solid='
true'>
<FontStyle justify='"MIDDLE" "MIDDLE"' size='0.5'/>
</
Text>
<
Appearance DEF='
BlackText'>
<Material diffuseColor='0 0 0'/>
</
Appearance>
</
Shape>
</
Transform>
<
Shape DEF='
DisplayField'>
<
Appearance>
<Material emissiveColor='0 1 1' transparency='.7'/>
</
Appearance>
<
Box size='
2 .6 .01'/>
</
Shape>
<
Transform translation='
0 .5 .01'>
<
Shape>
<
Text string='
Fan Status:'
solid='
true'>
<FontStyle justify='"MIDDLE" "MIDDLE"' size='0.5'/>
</
Text>
<
Appearance USE='
BlackText'/>
</
Shape>
</
Transform>
</
Group>
</
Transform>
<!--
MotorAmp ROUTEs:
[
from SwitchPlaneSensor.translation_changed to switchPosition
]
[
from fanCycleTime to FanClock.set_cycleInterval
]
[
from displayFanSpeed to SpeedDisplay.set_string
]
-->
<
Script DEF='
MotorAmp'>
<field name='switchPosition' type='SFVec3f' accessType='inputOnly'/>
<field name='fanCycleTime' type='MFFloat' accessType='outputOnly'/>
<field name='displayFanSpeed' type='MFString' accessType='outputOnly'/>
<![CDATA[
ecmascript:
function switchPosition(pos)
{
if (switchPosition.pos.y == 0){
fanCycleTime[0] = switchPosition.pos.y;
displayFanSpeed[0] ='OFF';
}
else{if (switchPosition.pos.y == 3){
fanCycleTime[0] = .01;
displayFanSpeed[0] ='MAX';
}
else {
fanCycleTime[0] = (6 - (switchPosition.pos.y*2));
displayFanSpeed[0] = (Math.round((1/fanCycleTime[0])*6000)/100) + ' RPM';
}}
}
]]>
</
Script>
<!-- Motor On/Off Buttons -->
<
Transform translation='
-1 1 1.6'>
<
Transform rotation='
1 0 0 1.571'>
</
Transform>
</
Transform>
<!-- Motor Status Display -->
<
Transform translation='
.5 .8 1.83'>
<
Group DEF='
MotorStatus'>
<
Transform translation='
0 .5 .01'>
<
Shape>
<
Text string='
Motor Status:'
solid='
true'>
<FontStyle justify='"MIDDLE" "MIDDLE"' size='0.5'/>
</
Text>
<
Appearance USE='
BlackText'/>
</
Shape>
</
Transform>
<
Transform translation='
0 0 .01'>
</
Transform>
<
Shape USE='
DisplayField'/>
</
Group>
</
Transform>
<!--
MotorButtonActionOn ROUTEs:
[
from SensorOnButton.isActive to onButtonAction
]
[
from displayMotorStatus to StatusDisplay.set_string
]
[
from fanOnButtonAction to FanClock.set_cycleInterval
]
-->
<
Script DEF='
MotorButtonActionOn'>
<field name='onButtonAction' type='SFBool' accessType='inputOnly'/>
<field name='displayMotorStatus' type='MFString' accessType='outputOnly'/>
<field name='fanOnButtonAction' type='SFInt32' accessType='outputOnly'/>
<![CDATA[
ecmascript:
function onButtonAction(bool)
{
if (onButtonAction.bool == true)
{
displayMotorStatus[0] ='ON';
fanOnButtonAction = 1;
}
}
]]>
<![CDATA[
ecmascript:
function offButtonAction(bool)
{
if (offButtonAction.bool == true)
{
displayMotorStatus[0] ='OFF';
}
}
]]>
</
Scene>
</