2023-11-28 23:50:50 -08:00
from typing import Any , Dict , Type , TypeVar , Union
2023-08-16 16:31:50 -07:00
import attr
2023-11-28 23:50:50 -08:00
from pydantic import BaseModel , GetCoreSchemaHandler
from pydantic_core import CoreSchema , core_schema
2023-08-16 16:31:50 -07:00
2023-09-29 15:51:03 -07:00
from . . models . center_of_mass import CenterOfMass
2023-08-30 15:59:51 -07:00
from . . models . curve_get_control_points import CurveGetControlPoints
2023-09-29 15:51:03 -07:00
from . . models . curve_get_end_points import CurveGetEndPoints
2023-08-30 15:59:51 -07:00
from . . models . curve_get_type import CurveGetType
2023-09-29 15:51:03 -07:00
from . . models . density import Density
2023-08-30 15:59:51 -07:00
from . . models . entity_get_all_child_uuids import EntityGetAllChildUuids
from . . models . entity_get_child_uuid import EntityGetChildUuid
from . . models . entity_get_num_children import EntityGetNumChildren
from . . models . entity_get_parent_id import EntityGetParentId
from . . models . export import Export
from . . models . get_entity_type import GetEntityType
2023-10-12 09:02:59 -07:00
from . . models . get_sketch_mode_plane import GetSketchModePlane
2023-08-30 15:59:51 -07:00
from . . models . highlight_set_entity import HighlightSetEntity
2023-09-29 15:51:03 -07:00
from . . models . import_files import ImportFiles
from . . models . mass import Mass
2023-08-30 15:59:51 -07:00
from . . models . mouse_click import MouseClick
2023-09-29 15:51:03 -07:00
from . . models . path_get_curve_uuids_for_vertices import PathGetCurveUuidsForVertices
2023-08-30 15:59:51 -07:00
from . . models . path_get_info import PathGetInfo
2023-10-17 15:35:56 -07:00
from . . models . path_get_vertex_uuids import PathGetVertexUuids
2023-09-29 15:51:03 -07:00
from . . models . plane_intersect_and_project import PlaneIntersectAndProject
2023-08-30 15:59:51 -07:00
from . . models . select_get import SelectGet
from . . models . select_with_point import SelectWithPoint
from . . models . solid3d_get_all_edge_faces import Solid3dGetAllEdgeFaces
from . . models . solid3d_get_all_opposite_edges import Solid3dGetAllOppositeEdges
from . . models . solid3d_get_next_adjacent_edge import Solid3dGetNextAdjacentEdge
from . . models . solid3d_get_opposite_edge import Solid3dGetOppositeEdge
from . . models . solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
2023-09-29 15:51:03 -07:00
from . . models . surface_area import SurfaceArea
2023-08-30 15:59:51 -07:00
from . . models . take_snapshot import TakeSnapshot
2023-09-29 15:51:03 -07:00
from . . models . volume import Volume
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
2023-11-28 23:50:50 -08:00
class empty ( BaseModel ) :
""" An empty response, used for any command that does not explicitly have a response defined here. """
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " empty "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class export ( BaseModel ) :
""" The response from the `Export` command. When this is being performed over a websocket, this is sent as binary not JSON. The binary data can be deserialized as `bincode` into a `Vec<ExportFile>`. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Export
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " export "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class select_with_point ( BaseModel ) :
""" The response from the `SelectWithPoint` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : SelectWithPoint
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " select_with_point "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class highlight_set_entity ( BaseModel ) :
""" The response from the `HighlightSetEntity` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : HighlightSetEntity
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " highlight_set_entity "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class entity_get_child_uuid ( BaseModel ) :
""" The response from the `EntityGetChildUuid` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : EntityGetChildUuid
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " entity_get_child_uuid "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class entity_get_num_children ( BaseModel ) :
""" The response from the `EntityGetNumChildren` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : EntityGetNumChildren
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " entity_get_num_children "
2023-08-16 16:31:50 -07:00
2023-09-29 16:05:40 -07:00
2023-11-28 23:50:50 -08:00
class entity_get_parent_id ( BaseModel ) :
""" The response from the `EntityGetParentId` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : EntityGetParentId
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " entity_get_parent_id "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class entity_get_all_child_uuids ( BaseModel ) :
""" The response from the `EntityGetAllChildUuids` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : EntityGetAllChildUuids
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " entity_get_all_child_uuids "
2023-08-16 16:31:50 -07:00
2023-09-29 16:05:40 -07:00
2023-11-28 23:50:50 -08:00
class select_get ( BaseModel ) :
""" The response from the `SelectGet` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : SelectGet
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " select_get "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class get_entity_type ( BaseModel ) :
""" The response from the `GetEntityType` command. """
2023-09-29 16:05:40 -07:00
2023-11-28 23:50:50 -08:00
data : GetEntityType
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " get_entity_type "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class solid3d_get_all_edge_faces ( BaseModel ) :
""" The response from the `Solid3dGetAllEdgeFaces` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Solid3dGetAllEdgeFaces
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " solid3d_get_all_edge_faces "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class solid3d_get_all_opposite_edges ( BaseModel ) :
""" The response from the `Solid3dGetAllOppositeEdges` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Solid3dGetAllOppositeEdges
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " solid3d_get_all_opposite_edges "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class solid3d_get_opposite_edge ( BaseModel ) :
""" The response from the `Solid3dGetOppositeEdge` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Solid3dGetOppositeEdge
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " solid3d_get_opposite_edge "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class solid3d_get_prev_adjacent_edge ( BaseModel ) :
""" The response from the `Solid3dGetPrevAdjacentEdge` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Solid3dGetPrevAdjacentEdge
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " solid3d_get_prev_adjacent_edge "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class solid3d_get_next_adjacent_edge ( BaseModel ) :
""" The response from the `Solid3dGetNextAdjacentEdge` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : Solid3dGetNextAdjacentEdge
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " solid3d_get_next_adjacent_edge "
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
class mouse_click ( BaseModel ) :
""" The response from the `MouseClick` command. """
2023-08-16 16:31:50 -07:00
2023-11-28 23:50:50 -08:00
data : MouseClick
2023-08-16 16:31:50 -07:00
2023-11-27 16:01:20 -08:00
type : str = " mouse_click "
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
class curve_get_type ( BaseModel ) :
""" The response from the `CurveGetType` command. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
data : CurveGetType
2023-08-30 15:59:51 -07:00
2023-11-27 16:01:20 -08:00
type : str = " curve_get_type "
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
class curve_get_control_points ( BaseModel ) :
""" The response from the `CurveGetControlPoints` command. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
data : CurveGetControlPoints
2023-08-30 15:59:51 -07:00
2023-11-27 16:01:20 -08:00
type : str = " curve_get_control_points "
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
class take_snapshot ( BaseModel ) :
""" The response from the `Take Snapshot` command. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
data : TakeSnapshot
2023-08-30 15:59:51 -07:00
2023-11-27 16:01:20 -08:00
type : str = " take_snapshot "
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
class path_get_info ( BaseModel ) :
""" The response from the `Path Get Info` command. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
data : PathGetInfo
2023-08-30 15:59:51 -07:00
2023-11-27 16:01:20 -08:00
type : str = " path_get_info "
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
class path_get_curve_uuids_for_vertices ( BaseModel ) :
""" The response from the `Path Get Curve UUIDs for Vertices` command. """
2023-08-30 15:59:51 -07:00
2023-11-28 23:50:50 -08:00
data : PathGetCurveUuidsForVertices
2023-08-30 15:59:51 -07:00
2023-11-27 16:01:20 -08:00
type : str = " path_get_curve_uuids_for_vertices "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class path_get_vertex_uuids ( BaseModel ) :
""" The response from the `Path Get Vertex UUIDs` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : PathGetVertexUuids
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " path_get_vertex_uuids "
2023-10-17 15:35:56 -07:00
2023-11-28 23:50:50 -08:00
class plane_intersect_and_project ( BaseModel ) :
""" The response from the `PlaneIntersectAndProject` command. """
2023-10-17 15:35:56 -07:00
2023-11-28 23:50:50 -08:00
data : PlaneIntersectAndProject
2023-10-17 15:35:56 -07:00
2023-11-27 16:01:20 -08:00
type : str = " plane_intersect_and_project "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class curve_get_end_points ( BaseModel ) :
""" The response from the `CurveGetEndPoints` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : CurveGetEndPoints
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " curve_get_end_points "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class import_files ( BaseModel ) :
""" The response from the `ImportFiles` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : ImportFiles
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " import_files "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class mass ( BaseModel ) :
""" The response from the `Mass` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : Mass
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " mass "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class volume ( BaseModel ) :
""" The response from the `Volume` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : Volume
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " volume "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class density ( BaseModel ) :
""" The response from the `Density` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : Density
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " density "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class surface_area ( BaseModel ) :
""" The response from the `SurfaceArea` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : SurfaceArea
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " surface_area "
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
class center_of_mass ( BaseModel ) :
""" The response from the `CenterOfMass` command. """
2023-09-29 15:51:03 -07:00
2023-11-28 23:50:50 -08:00
data : CenterOfMass
2023-09-29 15:51:03 -07:00
2023-11-27 16:01:20 -08:00
type : str = " center_of_mass "
2023-09-29 16:05:40 -07:00
2023-11-28 23:50:50 -08:00
class get_sketch_mode_plane ( BaseModel ) :
""" The response from the `GetSketchModePlane` command. """
2023-10-12 09:02:59 -07:00
2023-11-28 23:50:50 -08:00
data : GetSketchModePlane
2023-10-12 09:02:59 -07:00
2023-11-27 16:01:20 -08:00
type : str = " get_sketch_mode_plane "
2023-11-28 14:29:16 -08:00
GY = TypeVar ( " GY " , bound = " OkModelingCmdResponse " )
@attr.s ( auto_attribs = True )
2023-11-28 14:16:05 -08:00
class OkModelingCmdResponse :
""" A successful response from a modeling command. This can be one of several types of responses, depending on the command. """
type : Union [
empty ,
export ,
select_with_point ,
highlight_set_entity ,
entity_get_child_uuid ,
entity_get_num_children ,
entity_get_parent_id ,
entity_get_all_child_uuids ,
select_get ,
get_entity_type ,
solid3d_get_all_edge_faces ,
solid3d_get_all_opposite_edges ,
solid3d_get_opposite_edge ,
solid3d_get_prev_adjacent_edge ,
solid3d_get_next_adjacent_edge ,
mouse_click ,
curve_get_type ,
curve_get_control_points ,
take_snapshot ,
path_get_info ,
path_get_curve_uuids_for_vertices ,
path_get_vertex_uuids ,
plane_intersect_and_project ,
curve_get_end_points ,
import_files ,
mass ,
volume ,
density ,
surface_area ,
center_of_mass ,
get_sketch_mode_plane ,
2023-11-28 14:29:16 -08:00
]
2023-11-28 14:16:05 -08:00
def __init__ (
self ,
type : Union [
2023-11-28 14:29:16 -08:00
empty ,
export ,
select_with_point ,
highlight_set_entity ,
entity_get_child_uuid ,
entity_get_num_children ,
entity_get_parent_id ,
entity_get_all_child_uuids ,
select_get ,
get_entity_type ,
solid3d_get_all_edge_faces ,
solid3d_get_all_opposite_edges ,
solid3d_get_opposite_edge ,
solid3d_get_prev_adjacent_edge ,
solid3d_get_next_adjacent_edge ,
mouse_click ,
curve_get_type ,
curve_get_control_points ,
take_snapshot ,
path_get_info ,
path_get_curve_uuids_for_vertices ,
path_get_vertex_uuids ,
plane_intersect_and_project ,
curve_get_end_points ,
import_files ,
mass ,
volume ,
density ,
surface_area ,
center_of_mass ,
get_sketch_mode_plane ,
2023-11-28 14:16:05 -08:00
] ,
) :
self . type = type
2023-11-28 23:50:50 -08:00
def model_dump ( self ) - > Dict [ str , Any ] :
2023-11-28 14:16:05 -08:00
if isinstance ( self . type , empty ) :
2023-11-28 23:50:50 -08:00
TZ : empty = self . type
return TZ . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , export ) :
2023-11-28 23:50:50 -08:00
RQ : export = self . type
return RQ . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , select_with_point ) :
2023-11-28 23:50:50 -08:00
CM : select_with_point = self . type
return CM . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , highlight_set_entity ) :
2023-11-28 23:50:50 -08:00
WP : highlight_set_entity = self . type
return WP . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , entity_get_child_uuid ) :
2023-11-28 23:50:50 -08:00
LN : entity_get_child_uuid = self . type
return LN . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , entity_get_num_children ) :
2023-11-28 23:50:50 -08:00
MG : entity_get_num_children = self . type
return MG . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , entity_get_parent_id ) :
2023-11-28 23:50:50 -08:00
BF : entity_get_parent_id = self . type
return BF . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , entity_get_all_child_uuids ) :
2023-11-28 23:50:50 -08:00
MB : entity_get_all_child_uuids = self . type
return MB . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , select_get ) :
2023-11-28 23:50:50 -08:00
FJ : select_get = self . type
return FJ . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , get_entity_type ) :
2023-11-28 23:50:50 -08:00
SF : get_entity_type = self . type
return SF . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , solid3d_get_all_edge_faces ) :
2023-11-28 23:50:50 -08:00
BM : solid3d_get_all_edge_faces = self . type
return BM . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , solid3d_get_all_opposite_edges ) :
2023-11-28 23:50:50 -08:00
NC : solid3d_get_all_opposite_edges = self . type
return NC . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , solid3d_get_opposite_edge ) :
2023-11-28 23:50:50 -08:00
FF : solid3d_get_opposite_edge = self . type
return FF . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , solid3d_get_prev_adjacent_edge ) :
2023-11-28 23:50:50 -08:00
FS : solid3d_get_prev_adjacent_edge = self . type
return FS . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , solid3d_get_next_adjacent_edge ) :
2023-11-28 23:50:50 -08:00
EQ : solid3d_get_next_adjacent_edge = self . type
return EQ . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , mouse_click ) :
2023-11-28 23:50:50 -08:00
MD : mouse_click = self . type
return MD . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , curve_get_type ) :
2023-11-28 23:50:50 -08:00
UJ : curve_get_type = self . type
return UJ . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , curve_get_control_points ) :
2023-11-28 23:50:50 -08:00
DL : curve_get_control_points = self . type
return DL . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , take_snapshot ) :
2023-11-28 23:50:50 -08:00
PT : take_snapshot = self . type
return PT . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , path_get_info ) :
2023-11-28 23:50:50 -08:00
VF : path_get_info = self . type
return VF . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , path_get_curve_uuids_for_vertices ) :
2023-11-28 23:50:50 -08:00
WH : path_get_curve_uuids_for_vertices = self . type
return WH . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , path_get_vertex_uuids ) :
2023-11-28 23:50:50 -08:00
UY : path_get_vertex_uuids = self . type
return UY . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , plane_intersect_and_project ) :
2023-11-28 23:50:50 -08:00
SM : plane_intersect_and_project = self . type
return SM . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , curve_get_end_points ) :
2023-11-28 23:50:50 -08:00
CG : curve_get_end_points = self . type
return CG . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , import_files ) :
2023-11-28 23:50:50 -08:00
ZB : import_files = self . type
return ZB . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , mass ) :
2023-11-28 23:50:50 -08:00
FX : mass = self . type
return FX . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , volume ) :
2023-11-28 23:50:50 -08:00
KU : volume = self . type
return KU . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , density ) :
2023-11-28 23:50:50 -08:00
FA : density = self . type
return FA . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , surface_area ) :
2023-11-28 23:50:50 -08:00
JG : surface_area = self . type
return JG . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , center_of_mass ) :
2023-11-28 23:50:50 -08:00
RY : center_of_mass = self . type
return RY . model_dump ( )
2023-11-28 14:16:05 -08:00
elif isinstance ( self . type , get_sketch_mode_plane ) :
2023-11-28 23:50:50 -08:00
AD : get_sketch_mode_plane = self . type
return AD . model_dump ( )
2023-11-28 14:16:05 -08:00
raise Exception ( " Unknown type " )
2023-11-28 14:29:16 -08:00
@classmethod
def from_dict ( cls : Type [ GY ] , d : Dict [ str , Any ] ) - > GY :
2023-11-28 14:16:05 -08:00
if d . get ( " type " ) == " empty " :
2023-11-28 23:50:50 -08:00
AX : empty = empty ( * * d )
return cls ( type = AX )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " export " :
2023-11-28 23:50:50 -08:00
ZL : export = export ( * * d )
return cls ( type = ZL )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " select_with_point " :
2023-11-28 23:50:50 -08:00
OS : select_with_point = select_with_point ( * * d )
return cls ( type = OS )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " highlight_set_entity " :
2023-11-28 23:50:50 -08:00
XO : highlight_set_entity = highlight_set_entity ( * * d )
return cls ( type = XO )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " entity_get_child_uuid " :
2023-11-28 23:50:50 -08:00
KR : entity_get_child_uuid = entity_get_child_uuid ( * * d )
return cls ( type = KR )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " entity_get_num_children " :
2023-11-28 23:50:50 -08:00
UE : entity_get_num_children = entity_get_num_children ( * * d )
return cls ( type = UE )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " entity_get_parent_id " :
2023-11-28 23:50:50 -08:00
UU : entity_get_parent_id = entity_get_parent_id ( * * d )
return cls ( type = UU )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " entity_get_all_child_uuids " :
2023-11-28 23:50:50 -08:00
TB : entity_get_all_child_uuids = entity_get_all_child_uuids ( * * d )
return cls ( type = TB )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " select_get " :
2023-11-28 23:50:50 -08:00
HB : select_get = select_get ( * * d )
return cls ( type = HB )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " get_entity_type " :
2023-11-28 23:50:50 -08:00
DU : get_entity_type = get_entity_type ( * * d )
return cls ( type = DU )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " solid3d_get_all_edge_faces " :
2023-11-28 23:50:50 -08:00
TY : solid3d_get_all_edge_faces = solid3d_get_all_edge_faces ( * * d )
return cls ( type = TY )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " solid3d_get_all_opposite_edges " :
2023-11-28 23:50:50 -08:00
GP : solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges ( * * d )
return cls ( type = GP )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " solid3d_get_opposite_edge " :
2023-11-28 23:50:50 -08:00
YO : solid3d_get_opposite_edge = solid3d_get_opposite_edge ( * * d )
return cls ( type = YO )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " solid3d_get_prev_adjacent_edge " :
2023-11-28 23:50:50 -08:00
WN : solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge ( * * d )
return cls ( type = WN )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " solid3d_get_next_adjacent_edge " :
2023-11-28 23:50:50 -08:00
UW : solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge ( * * d )
return cls ( type = UW )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " mouse_click " :
2023-11-28 23:50:50 -08:00
HD : mouse_click = mouse_click ( * * d )
return cls ( type = HD )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " curve_get_type " :
2023-11-28 23:50:50 -08:00
RU : curve_get_type = curve_get_type ( * * d )
return cls ( type = RU )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " curve_get_control_points " :
2023-11-28 23:50:50 -08:00
QT : curve_get_control_points = curve_get_control_points ( * * d )
return cls ( type = QT )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " take_snapshot " :
2023-11-28 23:50:50 -08:00
HR : take_snapshot = take_snapshot ( * * d )
return cls ( type = HR )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " path_get_info " :
2023-11-28 23:50:50 -08:00
VM : path_get_info = path_get_info ( * * d )
return cls ( type = VM )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " path_get_curve_uuids_for_vertices " :
2023-11-28 23:50:50 -08:00
DQ : path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices (
* * d
)
return cls ( type = DQ )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " path_get_vertex_uuids " :
2023-11-28 23:50:50 -08:00
PD : path_get_vertex_uuids = path_get_vertex_uuids ( * * d )
return cls ( type = PD )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " plane_intersect_and_project " :
2023-11-28 23:50:50 -08:00
JL : plane_intersect_and_project = plane_intersect_and_project ( * * d )
return cls ( type = JL )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " curve_get_end_points " :
2023-11-28 23:50:50 -08:00
QA : curve_get_end_points = curve_get_end_points ( * * d )
return cls ( type = QA )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " import_files " :
2023-11-28 23:50:50 -08:00
AU : import_files = import_files ( * * d )
return cls ( type = AU )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " mass " :
2023-11-28 23:50:50 -08:00
BL : mass = mass ( * * d )
return cls ( type = BL )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " volume " :
2023-11-28 23:50:50 -08:00
PZ : volume = volume ( * * d )
return cls ( type = PZ )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " density " :
2023-11-28 23:50:50 -08:00
GE : density = density ( * * d )
return cls ( type = GE )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " surface_area " :
2023-11-28 23:50:50 -08:00
HH : surface_area = surface_area ( * * d )
return cls ( type = HH )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " center_of_mass " :
2023-11-28 23:50:50 -08:00
AE : center_of_mass = center_of_mass ( * * d )
return cls ( type = AE )
2023-11-28 14:16:05 -08:00
elif d . get ( " type " ) == " get_sketch_mode_plane " :
2023-11-28 23:50:50 -08:00
AB : get_sketch_mode_plane = get_sketch_mode_plane ( * * d )
return cls ( type = AB )
2023-11-28 14:16:05 -08:00
raise Exception ( " Unknown type " )
2023-11-28 23:50:50 -08:00
@classmethod
def __get_pydantic_core_schema__ (
cls , source_type : Any , handler : GetCoreSchemaHandler
) - > CoreSchema :
return core_schema . no_info_after_validator_function (
cls ,
handler (
Union [
empty ,
export ,
select_with_point ,
highlight_set_entity ,
entity_get_child_uuid ,
entity_get_num_children ,
entity_get_parent_id ,
entity_get_all_child_uuids ,
select_get ,
get_entity_type ,
solid3d_get_all_edge_faces ,
solid3d_get_all_opposite_edges ,
solid3d_get_opposite_edge ,
solid3d_get_prev_adjacent_edge ,
solid3d_get_next_adjacent_edge ,
mouse_click ,
curve_get_type ,
curve_get_control_points ,
take_snapshot ,
path_get_info ,
path_get_curve_uuids_for_vertices ,
path_get_vertex_uuids ,
plane_intersect_and_project ,
curve_get_end_points ,
import_files ,
mass ,
volume ,
density ,
surface_area ,
center_of_mass ,
get_sketch_mode_plane ,
]
) ,
)