2024-07-28 15:21:51 -07:00
from typing import Literal , Union
2023-07-07 19:22:51 -07:00
2024-07-28 15:21:51 -07:00
from pydantic import BaseModel , ConfigDict , Field , RootModel
2023-11-29 10:32:31 -08:00
from typing_extensions import Annotated
2023-07-07 19:22:51 -07:00
2023-08-30 15:59:51 -07:00
from . . models . fbx_storage import FbxStorage
from . . models . gltf_presentation import GltfPresentation
from . . models . gltf_storage import GltfStorage
from . . models . ply_storage import PlyStorage
2023-11-27 16:01:20 -08:00
from . . models . selection import Selection
2023-08-30 15:59:51 -07:00
from . . models . stl_storage import StlStorage
2023-07-07 19:22:51 -07:00
from . . models . system import System
2023-09-29 15:51:03 -07:00
from . . models . unit_length import UnitLength
2023-07-07 19:22:51 -07:00
2023-11-27 16:01:20 -08:00
2024-09-10 15:24:19 -07:00
class OptionFbx ( BaseModel ) :
2023-11-28 23:50:50 -08:00
""" Autodesk Filmbox (FBX) format. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
storage : FbxStorage
2023-08-30 15:59:51 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " fbx " ] = " fbx "
2023-08-30 15:59:51 -07:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-08-30 15:59:51 -07:00
2024-09-10 15:24:19 -07:00
class OptionGltf ( BaseModel ) :
2023-12-21 08:14:08 -08:00
""" glTF 2.0. We refer to this as glTF since that is how our customers refer to it, although by default it will be in binary format and thus technically (glb). If you prefer ASCII output, you can set that option for the export. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
presentation : GltfPresentation
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
storage : GltfStorage
2023-08-30 15:59:51 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " gltf " ] = " gltf "
2023-07-07 19:22:51 -07:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-07-07 19:22:51 -07:00
2024-09-10 15:24:19 -07:00
class OptionObj ( BaseModel ) :
2023-11-28 23:50:50 -08:00
""" Wavefront OBJ format. """
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
coords : System
2023-07-07 19:22:51 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " obj " ] = " obj "
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
units : UnitLength
2023-07-07 19:22:51 -07:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-07-07 19:22:51 -07:00
2024-09-10 15:24:19 -07:00
class OptionPly ( BaseModel ) :
2023-11-28 23:50:50 -08:00
""" The PLY Polygon File Format. """
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
coords : System
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
selection : Selection
2023-07-31 12:50:30 -07:00
2023-11-28 23:50:50 -08:00
storage : PlyStorage
2023-07-31 12:50:30 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " ply " ] = " ply "
2023-11-27 16:01:20 -08:00
2023-11-28 23:50:50 -08:00
units : UnitLength
2023-11-27 16:01:20 -08:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-11-27 16:01:20 -08:00
2024-09-10 15:24:19 -07:00
class OptionStep ( BaseModel ) :
2023-11-28 23:50:50 -08:00
""" ISO 10303-21 (STEP) format. """
2023-11-27 16:01:20 -08:00
2023-11-28 23:50:50 -08:00
coords : System
2023-07-31 12:50:30 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " step " ] = " step "
2023-07-07 19:22:51 -07:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-07-07 19:22:51 -07:00
2024-09-10 15:24:19 -07:00
class OptionStl ( BaseModel ) :
2023-11-28 23:50:50 -08:00
""" *ST**ereo**L**ithography format. """
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
coords : System
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
selection : Selection
2023-07-07 19:22:51 -07:00
2023-11-28 23:50:50 -08:00
storage : StlStorage
2023-07-07 19:22:51 -07:00
2023-11-29 10:32:31 -08:00
type : Literal [ " stl " ] = " stl "
2023-11-27 16:01:20 -08:00
2023-11-28 23:50:50 -08:00
units : UnitLength
2023-11-27 16:01:20 -08:00
2024-01-06 18:32:21 -08:00
model_config = ConfigDict ( protected_namespaces = ( ) )
2023-07-07 19:22:51 -07:00
2023-11-29 00:39:14 -08:00
OutputFormat = RootModel [
2023-11-29 10:32:31 -08:00
Annotated [
Union [
2024-09-10 15:24:19 -07:00
OptionFbx ,
OptionGltf ,
OptionObj ,
OptionPly ,
OptionStep ,
OptionStl ,
2023-11-29 10:32:31 -08:00
] ,
Field ( discriminator = " type " ) ,
2023-11-28 14:29:16 -08:00
]
2023-11-29 00:39:14 -08:00
]