#################################################################################################### # # Invoking X3D model self-test: # # $ python CanopyPrototype.py # # Python package x3d.py package is available on PyPI for import. # This approach simplifies Python X3D deployment and use. # https://pypi.org/project/x3d # # Installation: # pip install x3d # or # python -m pip install x3d # # Developer options for loading x3d package in other Python programs: # # from x3d import * # preferred approach, terser source that avoids x3d.* class prefixes # # or # import x3d # traditional way to subclass x3d package, all classes require x3d.* prefix, # # but python source is very verbose, for example x3d.Material x3d.Shape etc. # # X3dToPython.xslt stylesheet insertPackagePrefix=true supports this option. # #################################################################################################### from x3d import * newModel=X3D(profile='Immersive',version='3.0', head=head( children=[ meta(content='CanopyPrototype.x3d',name='title'), meta(content='This prototype performs canopy opening and closing.',name='description'), meta(content='Etsuko Lippi',name='creator'), meta(content='18 October 2001',name='created'), meta(content='28 November 2019',name='modified'), meta(content='https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/BlueAngelCanopy.jpg',name='reference'), meta(content='http://www.military.com/Content/MoreContent1?file=aboutba',name='reference'), meta(content='https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyPrototype.x3d',name='identifier'), meta(content='X3D-Edit 3.2, https://savage.nps.edu/X3D-Edit',name='generator'), meta(content='canopy opening and closing, Prototype',name='subject'), meta(content='../../license.html',name='license')]), Scene=Scene( children=[ WorldInfo(title='CanopyPrototype.x3d'), ProtoDeclare(name='Canopy', ProtoInterface=ProtoInterface( field=[ field(accessType='inputOnly',appinfo='boolean eventIn: true = canopy open false = canopy close.',name='canopyOpen',type='SFBool'), field(accessType='inputOnly',name='animationStartTime',type='SFTime'), field(accessType='outputOnly',name='canopyOut',type='SFBool'), field(accessType='initializeOnly',name='traceEnabled',type='SFBool',value=False)]), ProtoBody=ProtoBody( children=[ Transform(scale=(1.4,1,1), children=[ Viewpoint(description='Canopy (click back to open, click front to close)',orientation=(0,1,0,-1.57),position=(0,0,-4)), Transform(DEF='CockpitFront',translation=(3,0,0), children=[ Shape( appearance=Appearance(DEF='CanopyColor', material=Material(diffuseColor=(0.3,0.4,0.8),transparency=0.85)), geometry=IndexedFaceSet(coordIndex=[9,300,10,-1,10,300,301,-1,301,306,10,-1,2,308,309,-1],creaseAngle=1.8,solid=False, coord=Coordinate(point=[(-0.35,-0.32,-6.71),(-0.44,-0.17,-5.91),(0,0.25,-5.9),(0,0,-6.7),(-0.35,-0.5,-6.7),(-0.45,-0.5,-5.9),(-0.44,-0.17,-5.91),(-0.35,-0.32,-6.71),(-0.44,0.11,-5.01),(-0.32,0.23,-5),(0,0.25,-5.9),(-0.45,-0.5,-5),(-0.45,-0.5,-4.55),(-0.44,0.25,-4.56),(-0.45,-0.5,-3.93),(-0.44,0.31,-4.05),(-0.34,0.36,-4.55),(-0.26,0.57,-3.55),(0.6,0.54,0.65),(0.62,0.53,1.09),(0.7,0.5,2.05),(4.62,0.05,2.42),(4.62,0.08,1.58),(3.79,0.18,0.71),(0.69,0.59,-0.95),(0.64,0.57,-0.27),(0.64,0.57,0),(2.78,0.32,0),(1.45,0.49,-0.92),(0.19,0.79,4.91),(0,0.85,6.5),(0.11,0.79,6.5),(-0.33,-0.54,-6.7),(-0.34,-0.68,-5.9),(0,-0.7,-6.7),(0,-0.85,-5.9),(-0.3,-0.8,-5),(0,-0.95,-5),(-0.3,-0.8,-4.55),(0,-0.95,-4.55),(-0.3,-0.8,-3.9),(0,-0.95,-3.55),(-0.3,-0.8,-3.55),(0,-0.43,-7.22),(0,-0.43,-7.22),(0,-0.7,-6.7),(-0.33,-0.54,-6.7),(-0.69,0.28,-4.03),(-0.83,0.5,-3.58),(-0.89,-0.64,-3.91),(-0.93,-0.63,-3.54),(-1.1,0,-3.55),(-1,-0.25,-3.95),(0.75,0.6,-1.6),(-0.65,-0.7,-2.6),(0,-0.95,-1.8),(-1.13,-0.35,-2.63),(-1.13,0.25,-2.62),(-1.13,-0.35,-2.63),(-1.15,-0.35,-1.6),(-1.15,0.25,-1.6),(-1.13,0.25,-2.62),(-0.96,0.25,-3.57),(-0.8,0.6,-2.6),(-0.8,0.25,-1.6),(-0.8,0.6,-2.6),(-0.85,0.25,-0.95),(-0.85,-0.35,-0.95),(-0.9,-0.35,0.65),(-0.9,0.25,0.65),(-0.87,0.25,0),(0.03,0.45,7.14),(0.22,0.57,7.14),(0.22,0.68,7.14),(0.03,0.8,7.14),(-0.65,-0.35,0.65),(-0.65,-0.35,1.1),(-0.46,-0.85,-1.8),(-0.5,-0.85,-1.6),(-0.8,-0.35,-1.6),(-0.75,-0.35,-1.8),(0,-0.95,-1.6),(-0.55,-0.84,-0.95),(-0.85,-0.35,-0.95),(0,-0.95,-0.95),(-0.33,-0.88,0.65),(-0.65,-0.35,0.65),(0,-0.95,0.65),(-0.33,-0.88,1.1),(-0.65,-0.35,1.1),(0,-0.95,1.1),(-0.69,0.68,-2.61),(-0.41,0.84,-1.6),(0,0.95,-1.6),(0,0.85,-2.65),(-0.75,0.6,-1.6),(-0.41,0.84,-1.6),(-0.69,0.68,-2.61),(-0.36,0.86,-0.95),(0,0.95,-0.95),(-0.75,0.6,-1.6),(-0.67,0.64,-0.95),(-0.34,0.85,0),(0,0.92,0),(-0.55,0.7,0),(-0.31,0.78,2.05),(0,0.85,2.05),(0,0.85,-3.55),(-0.26,0.74,-3.55),(0,0.85,-2.65),(0,0.4,6.87),(0.25,0.55,6.87),(-0.26,0.74,-3.55),(-0.69,0.59,-0.95),(-0.67,0.64,-0.95),(-0.64,0.57,-0.27),(-0.55,0.7,0),(-0.65,0.35,3.45),(-0.55,0.35,4),(-0.4,0.74,4.01),(-0.49,0.72,3.51),(-0.2,0.8,4),(-0.2,0.8,4.55),(-0.19,0.79,4.91),(0,0.85,4.9),(0,0.85,4),(-0.35,0.35,4.9),(-0.19,0.79,4.91),(-0.53,-0.23,3.52),(-0.45,-0.18,4.02),(0,-0.6,3.55),(0,-0.5,4),(-0.45,-0.18,4.02),(-0.53,-0.23,3.52),(-0.26,-0.16,4.92),(0,-0.35,4.9),(-0.26,-0.16,4.92),(0,0.4,6.5),(-0.35,0.35,4.9),(0,0,6.4),(-0.25,0.7,6.5),(-0.25,0.55,6.5),(0,0.4,6.5),(-0.11,0.79,6.5),(-0.65,0.25,1.1),(-0.65,0.25,0.65),(-0.66,0.54,0.48),(-0.6,0.54,0.65),(-0.59,0.64,0.65),(0,-0.6,3.55),(-0.65,0.25,1.1),(0,0.85,3.55),(-0.49,0.72,3.51),(0,0.85,3.55),(-0.31,0.78,2.05),(-0.7,0.5,2.05),(-0.7,0.5,2.05),(-0.62,0.6,1.09),(-0.62,0.53,1.09),(0,0.85,6.5),(-0.25,0.7,6.87),(0,0.85,6.87),(-0.25,0.55,6.87),(-0.22,0.68,7.14),(-0.03,0.8,7.14),(-0.22,0.57,7.14),(-0.03,0.45,7.14),(-1.45,0.49,-0.92),(-0.11,0.79,6.5),(-0.64,0.57,0),(-2.78,0.32,0),(-4.62,0.05,2.42),(-4.62,0.08,1.58),(-3.79,0.18,0.71),(0,0,-6.7),(0.44,-0.17,-5.91),(0.35,-0.32,-6.71),(0.45,-0.5,-5.9),(0.35,-0.5,-6.7),(0.32,0.23,-5),(0.44,0.11,-5.01),(0.45,-0.5,-5),(0.44,0.25,-4.56),(0.45,-0.5,-4.55),(0.44,0.31,-4.05),(0.45,-0.5,-3.93),(0.34,0.36,-4.55),(0.26,0.57,-3.55),(0.22,0.68,7.14),(0.22,0.57,7.14),(0.25,0.55,6.87),(0.25,0.7,6.87),(0.25,0.7,6.87),(0,0.4,6.87),(0.25,0.55,6.5),(0.25,0.55,6.5),(0.25,0.7,6.5),(0.11,0.79,6.5),(0.65,0.35,3.45),(0.65,0.25,1.1),(0.7,0.5,2.05),(0.34,-0.68,-5.9),(0.33,-0.54,-6.7),(0.3,-0.8,-5),(0.3,-0.8,-4.55),(0.3,-0.8,-3.9),(0.3,-0.8,-3.55),(0.35,-0.32,-6.71),(0.35,-0.5,-6.7),(0.33,-0.54,-6.7),(0.83,0.5,-3.58),(0.69,0.28,-4.03),(1,-0.25,-3.95),(1.1,0,-3.55),(0.93,-0.63,-3.54),(0.89,-0.64,-3.91),(0.65,0.25,1.1),(0.62,0.6,1.09),(0.65,-0.7,-2.6),(1.13,-0.35,-2.63),(1.15,0.25,-1.6),(1.15,-0.35,-1.6),(1.13,-0.35,-2.63),(1.13,0.25,-2.62),(1.13,0.25,-2.62),(0.96,0.25,-3.57),(0.8,0.25,-1.6),(0.8,0.6,-2.6),(0.8,0.6,-2.6),(0.49,0.72,3.51),(0.85,0.25,-0.95),(0.87,0.25,0),(0.9,0.25,0.65),(0.9,-0.35,0.65),(0.85,-0.35,-0.95),(0.31,0.78,2.05),(0.9,-0.35,0.65),(0.65,-0.35,1.1),(0.65,-0.35,0.65),(0.85,-0.35,-0.95),(0.75,-0.35,-1.8),(0.8,-0.35,-1.6),(0.5,-0.85,-1.6),(0.46,-0.85,-1.8),(0.55,-0.84,-0.95),(0.33,-0.88,0.65),(0.33,-0.88,1.1),(0.41,0.84,-1.6),(0.69,0.68,-2.61),(0.69,0.68,-2.61),(0.41,0.84,-1.6),(0.36,0.86,-0.95),(0.67,0.64,-0.95),(0.75,0.6,-1.6),(0.34,0.85,0),(0.55,0.7,0),(0.26,0.74,-3.55),(0.26,0.74,-3.55),(0.67,0.64,-0.95),(0.55,0.7,0),(0.59,0.64,0.65),(0.66,0.54,0.48),(0.4,0.74,4.01),(0.55,0.35,4),(0.2,0.8,4.55),(0.2,0.8,4),(0.19,0.79,4.91),(0.35,0.35,4.9),(0.45,-0.18,4.02),(0.53,-0.23,3.52),(0,-0.5,4),(0.55,0.35,4),(0.35,0.35,4.9),(0.26,-0.16,4.92),(0.45,-0.18,4.02),(0.65,0.25,0.65),(0.33,-0.88,1.1),(0.65,-0.35,1.1),(0,-0.6,5.95),(0,-0.45,6.2),(0.2,0.8,4),(0.34,0.85,0),(0.31,0.78,2.05),(0.8,-0.35,-1.6),(0.75,-0.35,-1.8),(2.2,0.15,6.7),(2.2,0.15,6.35),(0.2,0.8,4.55),(0,1.7,4.9),(0,2.4,5.65),(0,2.75,6.15),(0,2.85,6.7),(0,0.95,4),(0,0.95,3.55),(-0.8,-0.35,-1.6),(-0.75,-0.35,-1.8),(-0.34,0.85,0),(-0.4,0.74,4.01),(-2.2,0.15,6.7),(-2.2,0.15,6.35),(-0.33,0.52,-5),(0,0.85,-4.85),(-0.34,0.68,-4.55),(0,0.91,-3.44),(0,0.98,-4.4),(0.34,0.68,-4.55),(0.33,0.52,-5),(0,0.91,-3.44),(0.33,0.52,-5),(0.32,0.23,-5),(0,0.25,5.9)])))]), Group( children=[ Transform(DEF='CanopyTransform',center=(0,0,-3.5), children=[ Transform(translation=(3,0,0), children=[ Shape( appearance=Appearance(USE='CanopyColor'), geometry=IndexedFaceSet(coordIndex=[16,17,112,302,-1,301,304,305,306,-1,306,305,186,179,-1,304,307,257,305,-1,305,257,187,186,-1,302,112,307,304,-1,9,16,302,300,-1,300,302,304,301,-1,17,112,310,-1,112,307,310,-1,307,257,310,-1,257,187,310,-1],creaseAngle=1.8,solid=False, coord=Coordinate(point=[(-0.35,-0.32,-6.71),(-0.44,-0.17,-5.91),(0,0.25,-5.9),(0,0,-6.7),(-0.35,-0.5,-6.7),(-0.45,-0.5,-5.9),(-0.44,-0.17,-5.91),(-0.35,-0.32,-6.71),(-0.44,0.11,-5.01),(-0.32,0.23,-5),(0,0.25,-5.9),(-0.45,-0.5,-5),(-0.45,-0.5,-4.55),(-0.44,0.25,-4.56),(-0.45,-0.5,-3.93),(-0.44,0.31,-4.05),(-0.34,0.36,-4.55),(-0.26,0.57,-3.55),(0.6,0.54,0.65),(0.62,0.53,1.09),(0.7,0.5,2.05),(4.62,0.05,2.42),(4.62,0.08,1.58),(3.79,0.18,0.71),(0.69,0.59,-0.95),(0.64,0.57,-0.27),(0.64,0.57,0),(2.78,0.32,0),(1.45,0.49,-0.92),(0.19,0.79,4.91),(0,0.85,6.5),(0.11,0.79,6.5),(-0.33,-0.54,-6.7),(-0.34,-0.68,-5.9),(0,-0.7,-6.7),(0,-0.85,-5.9),(-0.3,-0.8,-5),(0,-0.95,-5),(-0.3,-0.8,-4.55),(0,-0.95,-4.55),(-0.3,-0.8,-3.9),(0,-0.95,-3.55),(-0.3,-0.8,-3.55),(0,-0.43,-7.22),(0,-0.43,-7.22),(0,-0.7,-6.7),(-0.33,-0.54,-6.7),(-0.69,0.28,-4.03),(-0.83,0.5,-3.58),(-0.89,-0.64,-3.91),(-0.93,-0.63,-3.54),(-1.1,0,-3.55),(-1,-0.25,-3.95),(0.75,0.6,-1.6),(-0.65,-0.7,-2.6),(0,-0.95,-1.8),(-1.13,-0.35,-2.63),(-1.13,0.25,-2.62),(-1.13,-0.35,-2.63),(-1.15,-0.35,-1.6),(-1.15,0.25,-1.6),(-1.13,0.25,-2.62),(-0.96,0.25,-3.57),(-0.8,0.6,-2.6),(-0.8,0.25,-1.6),(-0.8,0.6,-2.6),(-0.85,0.25,-0.95),(-0.85,-0.35,-0.95),(-0.9,-0.35,0.65),(-0.9,0.25,0.65),(-0.87,0.25,0),(0.03,0.45,7.14),(0.22,0.57,7.14),(0.22,0.68,7.14),(0.03,0.8,7.14),(-0.65,-0.35,0.65),(-0.65,-0.35,1.1),(-0.46,-0.85,-1.8),(-0.5,-0.85,-1.6),(-0.8,-0.35,-1.6),(-0.75,-0.35,-1.8),(0,-0.95,-1.6),(-0.55,-0.84,-0.95),(-0.85,-0.35,-0.95),(0,-0.95,-0.95),(-0.33,-0.88,0.65),(-0.65,-0.35,0.65),(0,-0.95,0.65),(-0.33,-0.88,1.1),(-0.65,-0.35,1.1),(0,-0.95,1.1),(-0.69,0.68,-2.61),(-0.41,0.84,-1.6),(0,0.95,-1.6),(0,0.85,-2.65),(-0.75,0.6,-1.6),(-0.41,0.84,-1.6),(-0.69,0.68,-2.61),(-0.36,0.86,-0.95),(0,0.95,-0.95),(-0.75,0.6,-1.6),(-0.67,0.64,-0.95),(-0.34,0.85,0),(0,0.92,0),(-0.55,0.7,0),(-0.31,0.78,2.05),(0,0.85,2.05),(0,0.85,-3.55),(-0.26,0.74,-3.55),(0,0.85,-2.65),(0,0.4,6.87),(0.25,0.55,6.87),(-0.26,0.74,-3.55),(-0.69,0.59,-0.95),(-0.67,0.64,-0.95),(-0.64,0.57,-0.27),(-0.55,0.7,0),(-0.65,0.35,3.45),(-0.55,0.35,4),(-0.4,0.74,4.01),(-0.49,0.72,3.51),(-0.2,0.8,4),(-0.2,0.8,4.55),(-0.19,0.79,4.91),(0,0.85,4.9),(0,0.85,4),(-0.35,0.35,4.9),(-0.19,0.79,4.91),(-0.53,-0.23,3.52),(-0.45,-0.18,4.02),(0,-0.6,3.55),(0,-0.5,4),(-0.45,-0.18,4.02),(-0.53,-0.23,3.52),(-0.26,-0.16,4.92),(0,-0.35,4.9),(-0.26,-0.16,4.92),(0,0.4,6.5),(-0.35,0.35,4.9),(0,0,6.4),(-0.25,0.7,6.5),(-0.25,0.55,6.5),(0,0.4,6.5),(-0.11,0.79,6.5),(-0.65,0.25,1.1),(-0.65,0.25,0.65),(-0.66,0.54,0.48),(-0.6,0.54,0.65),(-0.59,0.64,0.65),(0,-0.6,3.55),(-0.65,0.25,1.1),(0,0.85,3.55),(-0.49,0.72,3.51),(0,0.85,3.55),(-0.31,0.78,2.05),(-0.7,0.5,2.05),(-0.7,0.5,2.05),(-0.62,0.6,1.09),(-0.62,0.53,1.09),(0,0.85,6.5),(-0.25,0.7,6.87),(0,0.85,6.87),(-0.25,0.55,6.87),(-0.22,0.68,7.14),(-0.03,0.8,7.14),(-0.22,0.57,7.14),(-0.03,0.45,7.14),(-1.45,0.49,-0.92),(-0.11,0.79,6.5),(-0.64,0.57,0),(-2.78,0.32,0),(-4.62,0.05,2.42),(-4.62,0.08,1.58),(-3.79,0.18,0.71),(0,0,-6.7),(0.44,-0.17,-5.91),(0.35,-0.32,-6.71),(0.45,-0.5,-5.9),(0.35,-0.5,-6.7),(0.32,0.23,-5),(0.44,0.11,-5.01),(0.45,-0.5,-5),(0.44,0.25,-4.56),(0.45,-0.5,-4.55),(0.44,0.31,-4.05),(0.45,-0.5,-3.93),(0.34,0.36,-4.55),(0.26,0.57,-3.55),(0.22,0.68,7.14),(0.22,0.57,7.14),(0.25,0.55,6.87),(0.25,0.7,6.87),(0.25,0.7,6.87),(0,0.4,6.87),(0.25,0.55,6.5),(0.25,0.55,6.5),(0.25,0.7,6.5),(0.11,0.79,6.5),(0.65,0.35,3.45),(0.65,0.25,1.1),(0.7,0.5,2.05),(0.34,-0.68,-5.9),(0.33,-0.54,-6.7),(0.3,-0.8,-5),(0.3,-0.8,-4.55),(0.3,-0.8,-3.9),(0.3,-0.8,-3.55),(0.35,-0.32,-6.71),(0.35,-0.5,-6.7),(0.33,-0.54,-6.7),(0.83,0.5,-3.58),(0.69,0.28,-4.03),(1,-0.25,-3.95),(1.1,0,-3.55),(0.93,-0.63,-3.54),(0.89,-0.64,-3.91),(0.65,0.25,1.1),(0.62,0.6,1.09),(0.65,-0.7,-2.6),(1.13,-0.35,-2.63),(1.15,0.25,-1.6),(1.15,-0.35,-1.6),(1.13,-0.35,-2.63),(1.13,0.25,-2.62),(1.13,0.25,-2.62),(0.96,0.25,-3.57),(0.8,0.25,-1.6),(0.8,0.6,-2.6),(0.8,0.6,-2.6),(0.49,0.72,3.51),(0.85,0.25,-0.95),(0.87,0.25,0),(0.9,0.25,0.65),(0.9,-0.35,0.65),(0.85,-0.35,-0.95),(0.31,0.78,2.05),(0.9,-0.35,0.65),(0.65,-0.35,1.1),(0.65,-0.35,0.65),(0.85,-0.35,-0.95),(0.75,-0.35,-1.8),(0.8,-0.35,-1.6),(0.5,-0.85,-1.6),(0.46,-0.85,-1.8),(0.55,-0.84,-0.95),(0.33,-0.88,0.65),(0.33,-0.88,1.1),(0.41,0.84,-1.6),(0.69,0.68,-2.61),(0.69,0.68,-2.61),(0.41,0.84,-1.6),(0.36,0.86,-0.95),(0.67,0.64,-0.95),(0.75,0.6,-1.6),(0.34,0.85,0),(0.55,0.7,0),(0.26,0.74,-3.55),(0.26,0.74,-3.55),(0.67,0.64,-0.95),(0.55,0.7,0),(0.59,0.64,0.65),(0.66,0.54,0.48),(0.4,0.74,4.01),(0.55,0.35,4),(0.2,0.8,4.55),(0.2,0.8,4),(0.19,0.79,4.91),(0.35,0.35,4.9),(0.45,-0.18,4.02),(0.53,-0.23,3.52),(0,-0.5,4),(0.55,0.35,4),(0.35,0.35,4.9),(0.26,-0.16,4.92),(0.45,-0.18,4.02),(0.65,0.25,0.65),(0.33,-0.88,1.1),(0.65,-0.35,1.1),(0,-0.6,5.95),(0,-0.45,6.2),(0.2,0.8,4),(0.34,0.85,0),(0.31,0.78,2.05),(0.8,-0.35,-1.6),(0.75,-0.35,-1.8),(2.2,0.15,6.7),(2.2,0.15,6.35),(0.2,0.8,4.55),(0,1.7,4.9),(0,2.4,5.65),(0,2.75,6.15),(0,2.85,6.7),(0,0.95,4),(0,0.95,3.55),(-0.8,-0.35,-1.6),(-0.75,-0.35,-1.8),(-0.34,0.85,0),(-0.4,0.74,4.01),(-2.2,0.15,6.7),(-2.2,0.15,6.35),(-0.33,0.52,-5),(0,0.85,-4.85),(-0.34,0.68,-4.55),(0,0.91,-3.44),(0,0.98,-4.4),(0.34,0.68,-4.55),(0.33,0.52,-5),(0,0.91,-3.44),(0.33,0.52,-5),(0.32,0.23,-5),(0,0.57,-2.5)])))])]), Script(DEF='CanopyScript', field=[ field(accessType='inputOnly',appinfo='eventIn: boolean true: canopy open false: canopy close',name='canopyOpen',type='SFBool'), field(accessType='outputOnly',name='canopyOut',type='SFBool'), field(accessType='outputOnly',name='keyValue',type='MFRotation'), field(accessType='initializeOnly',name='kV1',type='SFRotation',value=(0,1,0,0)), field(accessType='initializeOnly',name='kV2',type='SFRotation',value=(0,1,0,0)), field(accessType='initializeOnly',name='kV3',type='SFRotation',value=(0,1,0,0)), field(accessType='inputOnly',name='set_fraction',type='SFFloat'), field(accessType='inputOnly',name='animationStartTime',type='SFTime'), field(accessType='outputOnly',name='clockStartTime',type='SFTime'), field(accessType='initializeOnly',name='traceEnabled',type='SFBool')], IS=IS( connect=[ connect(nodeField='canopyOpen',protoField='canopyOpen'), connect(nodeField='animationStartTime',protoField='animationStartTime'), connect(nodeField='canopyOut',protoField='canopyOut'), connect(nodeField='traceEnabled',protoField='traceEnabled')]), sourceCode=""" ecmascript: function canopyOpen(value, timeStamp) { if (value == true) //Canopy Open { tracePrint ('[Canopy Open] ' ); tracePrint ('value = ' + value); canapyOut = true; kV1 = new SFRotation (new SFVec3f (1, 0, 0), 0.0); kV2 = new SFRotation (new SFVec3f (1, 0, 0), 0.52); kV3 = new SFRotation(new SFVec3f (1, 0, 0), 0.79); keyValue = new MFRotation(kV1, kV2, kV3); //tracePrint ('[keyValue = ]' + keyValue); } else //Canopy Close { tracePrint ('[Canopy Close] ' ); tracePrint ('value = ' + value); canopyOut = true; keyValue = new MFRotation(kV3, kV2, kV1); //tracePrint ('[keyValue = ]' + keyValue); } } function set_fraction (value, timeStamp) { //tracePrint('time fraction = ' + value); } function animationStartTime(value, timeStamp) { tracePrint('The Start Time is: ' + value); clockStartTime = value; } function tracePrint (outputString) { if (traceEnabled) Browser.println ('[CanopyPrototype] ' + outputString); } """), OrientationInterpolator(DEF='CanopyInterpolator',key=[0,0.5,1.0],keyValue=[(1,0,0,0.0),(1,0,0,0.52),(1,0,0,0.79)]), TimeSensor(DEF='Clock',cycleInterval=4), ROUTE(fromField='clockStartTime',fromNode='CanopyScript',toField='set_startTime',toNode='Clock'), ROUTE(fromField='canopyOut',fromNode='CanopyScript',toField='set_enabled',toNode='Clock'), ROUTE(fromField='keyValue',fromNode='CanopyScript',toField='set_keyValue',toNode='CanopyInterpolator'), ROUTE(fromField='fraction_changed',fromNode='Clock',toField='set_fraction',toNode='CanopyInterpolator'), ROUTE(fromField='fraction_changed',fromNode='Clock',toField='set_fraction',toNode='CanopyScript'), ROUTE(fromField='value_changed',fromNode='CanopyInterpolator',toField='set_rotation',toNode='CanopyTransform')])])])), Background(skyColor=[(0.6,0.6,0.6)]), Anchor(description='Canopy Example',parameter=["target=_blank"],url=["CanopyExample.wrl","../../AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.wrl","https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.wrl","CanopyExample.x3d","../../AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.x3d","https://savage.nps.edu/Savage/AircraftFixedWing/F18BlueAngelUnitedStates/CanopyExample.x3d"], children=[ Shape( geometry=Text(string=["CanopyPrototype","is a prototype definition file","","To see an example scene","click on this text and view","CanopyExample"], fontStyle=FontStyle(justify=["MIDDLE","MIDDLE"])), appearance=Appearance(),)])]) ) # X3D model complete #################################################################################################### # Self-test diagnostics #################################################################################################### print('Self-test diagnostics for CanopyPrototype.py:') if metaDiagnostics(newModel): # built-in utility method in X3D class print(metaDiagnostics(newModel)) # display meta info, hint, warning, error, TODO values in this model # print('check newModel.XML() serialization...') newModelXML= newModel.XML() # test export method XML() for exceptions during export newModel.XMLvalidate() # print(newModelXML) # diagnostic try: # print('check newModel.VRML() serialization...') newModelVRML=newModel.VRML() # test export method VRML() for exceptions during export # print(prependLineNumbers(newModelVRML)) # debug print("Python-to-VRML export of VRML output successful", flush=True) except Exception as err: # usually BaseException # https://stackoverflow.com/questions/18176602/how-to-get-the-name-of-an-exception-that-was-caught-in-python print("*** Python-to-VRML export of VRML output failed:", type(err).__name__, err) if newModelVRML: # may have failed to generate print(prependLineNumbers(newModelVRML, err.lineno)) try: # print('check newModel.JSON() serialization...') newModelJSON=newModel.JSON() # test export method JSON() for exceptions during export # print(prependLineNumbers(newModelJSON)) # debug print("Python-to-JSON export of JSON output successful (under development)") except Exception as err: # usually SyntaxError print("*** Python-to-JSON export of JSON output failed:", type(err).__name__, err) if newModelJSON: # may have failed to generate print(prependLineNumbers(newModelJSON,err.lineno)) print("python CanopyPrototype.py load and self-test diagnostics complete.")