####################################################################################################
#
# Invoking X3D model self-test:
#
#   $ python l_inferior_nasal_conchae.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.
#
# Project home page:    # X3D Python Scene Access Interface Library (X3DPSAIL)
#                       # https://www.web3d.org/x3d/stylesheets/python/python.html
# Conversion generator: # https://www.web3d.org/x3d/stylesheets/X3dToPython.xslt
#
####################################################################################################

from x3d import *

newModel=X3D(profile='Interactive',version='4.0',
  head=head(
    children=[
    meta(content='l_inferior_nasal_conchae.x3d',name='title'),
    meta(content='inferior nasal concha (inferior turbinated bone or inferior turbinal/turbinate) is one of the three paired nasal conchae in the nose, LOA-5 part of skull LOA-1',name='description'),
    meta(content='Don Brutzman, Joe Williams, John Carlson, Damon Hernandez',name='creator'),
    meta(content='Don Brutzman',name='translator'),
    meta(content='5 December 2013',name='created'),
    meta(content='5 March 2026',name='translated'),
    meta(content='23 April 2026',name='modified'),
    meta(content='originals/inconl.x3d',name='reference'),
    meta(content='https://en.wikipedia.org/wiki/Inferior_nasal_concha',name='reference'),
    meta(content='https://en.wikipedia.org/wiki/List_of_bones_of_the_human_skeleton',name='reference'),
    meta(content='usage examples https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Medical',name='reference'),
    meta(content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit',name='generator'),
    meta(content='X3D Tidy, https://www.web3d.org/x3d/stylesheets/X3dTidy.html',name='generator'),
    meta(content='https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Bones/l_inferior_nasal_conchae.x3d',name='identifier'),
    meta(content='../license.html',name='license')]),
  Scene=Scene(
    children=[
    WorldInfo(title='l_inferior_nasal_conchae.x3d'),
    Background(skyColor=[(0.858824,1,0.94902)]),
    Comment('user hover lights bone and reveals description, user selection/deselection temporarily binds/unbinds close-up hidden viewpoint'),
    TouchSensor(DEF='UserTouchSensor',description='bone l_inferior_nasal_conchae, LOA-5 part of skull LOA-1'),
    Transform(DEF='l_inferior_nasal_conchae',translation=(0.0117,1.6309,0.0624),
      children=[
      BooleanToggle(DEF='UserTouchState'),
      ROUTE(fromField='isActive',fromNode='UserTouchSensor',toField='set_boolean',toNode='UserTouchState'),
      Viewpoint(DEF='HiddenViewpoint',nearDistance=0.001,position=(0,0,0.2),retainUserOffsets=True,
        navigationInfo=NavigationInfo(transitionType=["ANIMATE"],type=["EXAMINE"])),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='set_bind',toNode='HiddenViewpoint'),
      DirectionalLight(DEF='HiddenLight',ambientIntensity=1,color=(0.1,0.1,1),on=False),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='on',toNode='HiddenLight'),
      Transform(DEF='CenterOfRotationForJoint',visible=False,
        children=[
        Comment('insert computations for joint center of rotation here'),
        Inline(DEF='AxesDisplay',description='RGB display axes showing XYZ direction in local coordinate system',url=["AxesDisplay.x3d"],visible=False)]),
      ROUTE(fromField='toggle',fromNode='UserTouchState',toField='visible',toNode='CenterOfRotationForJoint'),
      Shape(
        appearance=Appearance(
          material=Material(DEF='BoneMaterial',ambientIntensity=0.965,diffuseColor=(1,0.9765,0.8667),shininess=0.05,specularColor=(0.349,0.349,0.349))),
        geometry=IndexedFaceSet(DEF='l_inferior_nasal_conchae_geometry',coordIndex=[0,1,2,-1,1,3,4,-1,5,6,7,-1,8,9,10,-1,11,5,7,-1,12,10,13,-1,10,7,13,-1,14,15,16,-1,17,18,19,-1,20,21,22,-1,23,24,25,-1,26,27,28,-1,29,14,30,-1,31,32,33,-1,34,35,4,-1,4,36,34,-1,37,31,38,-1,39,40,41,-1,42,43,44,-1,45,46,47,-1,48,49,50,-1,51,52,53,-1,54,55,56,-1,16,57,58,-1,59,57,2,-1,60,61,62,-1,63,28,64,-1,65,66,40,-1,6,33,67,-1,27,68,69,-1,70,29,71,-1,72,36,4,-1,73,65,40,-1,64,74,75,-1,76,77,78,-1,44,45,79,-1,80,81,82,-1,63,83,26,-1,84,85,86,-1,87,46,88,-1,42,88,43,-1,87,49,48,-1,18,89,90,-1,91,92,81,-1,48,47,87,-1,71,51,53,-1,26,50,93,-1,79,94,63,-1,39,95,78,-1,74,96,75,-1,97,62,98,-1,99,100,93,-1,71,101,102,-1,103,104,70,-1,28,27,76,-1,2,32,59,-1,105,106,72,-1,6,5,31,-1,107,72,108,-1,66,41,40,-1,31,59,32,-1,109,15,110,-1,56,75,96,-1,111,112,113,-1,50,49,114,-1,48,83,94,-1,115,37,38,-1,116,97,117,-1,34,36,118,-1,78,77,58,-1,119,57,59,-1,120,87,121,-1,116,122,123,-1,110,14,124,-1,12,13,35,-1,9,11,10,-1,7,6,125,-1,0,109,126,-1,62,127,98,-1,41,66,37,-1,3,1,0,-1,62,128,127,-1,125,13,7,-1,34,8,12,-1,12,35,34,-1,110,15,14,-1,129,69,68,-1,130,56,55,-1,119,65,57,-1,58,73,78,-1,8,34,118,-1,117,131,116,-1,31,66,119,-1,94,47,48,-1,50,114,132,-1,111,113,51,-1,55,54,80,-1,110,126,109,-1,133,4,67,-1,31,119,59,-1,107,108,61,-1,6,31,33,-1,72,107,105,-1,115,41,37,-1,2,133,32,-1,27,69,76,-1,103,134,104,-1,71,29,101,-1,99,135,100,-1,128,62,108,-1,74,41,96,-1,79,45,94,-1,26,83,50,-1,71,53,70,-1,46,43,88,-1,91,81,136,-1,18,137,89,-1,17,137,18,-1,138,139,140,-1,87,120,49,-1,42,141,88,-1,87,47,46,-1,63,94,83,-1,80,82,55,-1,107,140,136,-1,136,105,107,-1,75,44,79,-1,78,95,76,-1,75,79,64,-1,4,3,72,-1,70,104,29,-1,27,100,68,-1,67,125,6,-1,65,119,66,-1,79,63,64,-1,56,130,75,-1,61,108,62,-1,57,109,2,-1,3,108,72,-1,58,142,16,-1,56,96,54,-1,51,113,52,-1,83,48,50,-1,45,47,94,-1,143,42,44,-1,41,74,39,-1,52,89,53,-1,37,66,31,-1,30,101,29,-1,28,63,26,-1,23,25,144,-1,90,20,22,-1,17,19,131,-1,97,60,62,-1,16,30,14,-1,7,10,11,-1,8,10,12,-1,125,35,13,-1,108,3,0,-1,2,109,0,-1,145,146,147,-1,145,92,146,-1,129,148,142,-1,129,68,148,-1,120,149,150,-1,120,121,149,-1,124,134,151,-1,104,134,124,-1,31,11,38,-1,5,11,31,-1,86,17,84,-1,137,17,86,-1,64,39,74,-1,64,95,39,-1,111,114,112,-1,132,114,111,-1,33,133,67,-1,33,32,133,-1,80,106,105,-1,106,80,152,-1,152,38,153,-1,38,152,115,-1,154,97,98,-1,154,117,97,-1,60,138,61,-1,60,123,138,-1,143,75,130,-1,143,44,75,-1,71,111,51,-1,102,111,71,-1,92,82,81,-1,145,82,92,-1,146,144,25,-1,144,146,155,-1,23,52,113,-1,23,20,52,-1,123,156,138,-1,123,122,156,-1,116,19,122,-1,116,131,19,-1,52,90,89,-1,90,52,20,-1,24,113,112,-1,113,24,23,-1,145,141,42,-1,141,145,147,-1,141,87,88,-1,141,121,87,-1,111,99,132,-1,99,111,102,-1,80,136,81,-1,105,136,80,-1,123,97,116,-1,123,60,97,-1,15,57,16,-1,109,57,15,-1,106,153,118,-1,106,152,153,-1,45,43,46,-1,44,43,45,-1,41,54,96,-1,41,115,54,-1,122,22,156,-1,19,22,122,-1,11,153,38,-1,11,9,153,-1,101,148,135,-1,30,148,101,-1,134,154,151,-1,154,134,85,-1,144,20,23,-1,20,144,21,-1,30,142,148,-1,16,142,30,-1,138,157,139,-1,138,156,157,-1,4,2,1,-1,4,133,2,-1,155,92,91,-1,92,155,146,-1,151,98,127,-1,98,151,154,-1,19,90,22,-1,18,90,19,-1,24,149,25,-1,24,150,149,-1,100,26,93,-1,100,27,26,-1,104,14,29,-1,124,14,104,-1,84,131,117,-1,84,17,131,-1,76,64,28,-1,64,76,95,-1,145,143,82,-1,145,42,143,-1,80,115,152,-1,80,54,115,-1,142,77,129,-1,142,58,77,-1,129,76,69,-1,77,76,129,-1,140,61,138,-1,61,140,107,-1,130,82,143,-1,55,82,130,-1,86,134,103,-1,86,85,134,-1,150,49,120,-1,114,49,150,-1,147,25,149,-1,146,25,147,-1,157,144,155,-1,157,21,144,-1,156,21,157,-1,21,156,22,-1,140,91,136,-1,140,139,91,-1,150,112,114,-1,150,24,112,-1,141,149,121,-1,149,141,147,-1,70,89,103,-1,70,53,89,-1,93,132,99,-1,93,50,132,-1,39,73,40,-1,39,78,73,-1,110,128,126,-1,110,127,128,-1,135,102,101,-1,102,135,99,-1,36,106,118,-1,36,72,106,-1,137,103,89,-1,86,103,137,-1,85,117,154,-1,117,85,84,-1,118,9,8,-1,9,118,153,-1,57,73,58,-1,65,73,57,-1,100,148,68,-1,100,135,148,-1,35,67,4,-1,35,125,67,-1,151,110,124,-1,127,110,151,-1,139,155,91,-1,139,157,155,-1,126,108,0,-1,108,126,128,-1],creaseAngle=1.571,
          coord=Coordinate(DEF='l_inferior_nasal_conchae_coordinate',point=[(0.0006,0.0029,-0.0077),(0.0021,0.0018,-0.0058),(0.0026,-0.0007,-0.0030),(0.0012,0.0046,-0.0081),(0.0038,-0.0003,-0.0064),(0.0040,0.0001,0.0050),(0.0044,-0.0009,0.0025),(0.0046,-0.0017,0.0024),(0.0052,-0.0035,-0.0046),(0.0050,-0.0010,0.0020),(0.0050,-0.0018,0.0021),(0.0043,0.0003,0.0050),(0.0048,-0.0042,-0.0040),(0.0045,-0.0041,-0.0038),(-0.0020,-0.0027,-0.0012),(0.0001,-0.0013,-0.0020),(-0.0019,-0.0012,0.0038),(-0.0020,-0.0035,-0.0219),(-0.0026,-0.0029,-0.0184),(-0.0023,-0.0020,-0.0188),(-0.0039,-0.0026,-0.0086),(-0.0035,-0.0008,-0.0089),(-0.0029,-0.0013,-0.0143),(-0.0044,-0.0034,-0.0032),(-0.0045,-0.0043,0.0018),(-0.0045,-0.0017,0.0010),(-0.0044,-0.0056,0.0203),(-0.0041,-0.0046,0.0192),(-0.0036,-0.0012,0.0215),(-0.0030,-0.0048,-0.0013),(-0.0030,-0.0036,0.0038),(0.0033,0.0028,0.0069),(0.0037,0.0001,0.0028),(0.0040,-0.0002,0.0028),(0.0049,-0.0038,-0.0077),(0.0046,-0.0038,-0.0076),(0.0040,0.0003,-0.0060),(0.0018,0.0076,0.0111),(0.0034,0.0030,0.0071),(-0.0003,0.0065,0.0165),(0.0015,0.0074,0.0115),(0.0017,0.0079,0.0113),(-0.0014,0.0056,0.0096),(-0.0028,0.0053,0.0166),(-0.0025,0.0068,0.0166),(-0.0030,0.0037,0.0189),(-0.0030,0.0035,0.0183),(-0.0045,-0.0020,0.0213),(-0.0053,-0.0048,0.0197),(-0.0048,-0.0071,0.0134),(-0.0048,-0.0082,0.0142),(-0.0036,-0.0061,-0.0018),(-0.0038,-0.0036,-0.0083),(-0.0038,-0.0042,-0.0082),(0.0012,0.0071,0.0072),(0.0009,0.0070,0.0071),(0.0010,0.0082,0.0115),(-0.0002,0.0008,0.0037),(-0.0018,0.0009,0.0106),(0.0008,0.0010,0.0037),(0.0001,0.0008,-0.0184),(0.0001,0.0032,-0.0135),(0.0002,0.0001,-0.0183),(-0.0041,-0.0018,0.0222),(-0.0024,0.0042,0.0207),(0.0004,0.0044,0.0077),(0.0017,0.0074,0.0113),(0.0046,-0.0027,-0.0040),(-0.0038,-0.0037,0.0154),(-0.0037,-0.0031,0.0178),(-0.0034,-0.0043,-0.0081),(-0.0031,-0.0061,-0.0016),(0.0011,0.0054,-0.0084),(-0.0002,0.0043,0.0111),(-0.0005,0.0070,0.0166),(-0.0015,0.0074,0.0169),(-0.0031,-0.0008,0.0209),(-0.0028,-0.0002,0.0174),(-0.0014,0.0041,0.0163),(-0.0028,0.0041,0.0208),(0.0017,0.0072,0.0021),(0.0008,0.0067,0.0019),(-0.0001,0.0062,0.0062),(-0.0048,-0.0054,0.0202),(-0.0017,-0.0035,-0.0220),(-0.0023,-0.0030,-0.0173),(-0.0024,-0.0039,-0.0177),(-0.0046,-0.0025,0.0193),(-0.0031,0.0039,0.0171),(-0.0034,-0.0040,-0.0137),(-0.0034,-0.0027,-0.0140),(-0.0001,0.0054,-0.0030),(-0.0005,0.0052,0.0014),(-0.0044,-0.0082,0.0145),(-0.0045,-0.0019,0.0217),(-0.0021,0.0040,0.0203),(0.0012,0.0083,0.0115),(-0.0010,-0.0026,-0.0221),(-0.0009,-0.0009,-0.0178),(-0.0039,-0.0083,0.0106),(-0.0041,-0.0067,0.0149),(-0.0034,-0.0060,0.0035),(-0.0032,-0.0078,0.0030),(-0.0029,-0.0042,-0.0135),(-0.0029,-0.0030,-0.0077),(0.0016,0.0073,-0.0026),(0.0024,0.0068,-0.0026),(0.0009,0.0059,-0.0084),(0.0003,0.0025,-0.0134),(0.0014,0.0001,-0.0028),(-0.0011,0.0001,-0.0076),(-0.0037,-0.0078,0.0030),(-0.0042,-0.0062,0.0023),(-0.0042,-0.0049,-0.0023),(-0.0047,-0.0071,0.0092),(0.0015,0.0069,0.0076),(-0.0014,-0.0026,-0.0221),(-0.0014,-0.0032,-0.0222),(0.0053,-0.0002,-0.0042),(0.0011,0.0040,0.0076),(-0.0049,-0.0045,0.0122),(-0.0047,-0.0025,0.0111),(-0.0015,-0.0004,-0.0186),(-0.0004,0.0008,-0.0184),(-0.0022,-0.0017,-0.0077),(0.0046,-0.0034,-0.0038),(-0.0003,0.0015,-0.0077),(-0.0012,0.0000,-0.0133),(-0.0004,0.0013,-0.0135),(-0.0036,-0.0026,0.0161),(0.0002,0.0070,0.0106),(-0.0018,-0.0032,-0.0221),(-0.0045,-0.0083,0.0101),(0.0043,-0.0025,-0.0038),(-0.0026,-0.0027,-0.0133),(-0.0039,-0.0068,0.0102),(0.0010,0.0069,-0.0028),(-0.0028,-0.0037,-0.0180),(-0.0003,0.0032,-0.0139),(-0.0003,0.0045,-0.0086),(0.0005,0.0058,-0.0084),(-0.0030,0.0030,0.0098),(-0.0028,-0.0015,0.0102),(-0.0008,0.0062,0.0097),(-0.0038,-0.0008,-0.0037),(-0.0011,0.0053,0.0058),(-0.0024,0.0030,0.0014),(-0.0029,0.0030,0.0055),(-0.0037,-0.0041,0.0101),(-0.0047,-0.0022,0.0062),(-0.0050,-0.0051,0.0077),(-0.0021,-0.0015,-0.0131),(0.0024,0.0068,0.0023),(0.0049,0.0014,0.0020),(-0.0018,-0.0021,-0.0174),(-0.0018,0.0031,-0.0034),(-0.0017,0.0012,-0.0143),(-0.0020,0.0025,-0.0089)])))])])
)

### X3D model conversion complete ###

####################################################################################################
# Self-test diagnostics
####################################################################################################

print('Self-test diagnostics for l_inferior_nasal_conchae.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 l_inferior_nasal_conchae.py load and self-test diagnostics complete.")
