@ -179,4 +179,8 @@ class WebSocket:
|
|||||||
"""Receive data from the websocket."""
|
"""Receive data from the websocket."""
|
||||||
message = self.ws.recv()
|
message = self.ws.recv()
|
||||||
return {{response_type}}.from_dict(json.loads(message))
|
return {{response_type}}.from_dict(json.loads(message))
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""Close the websocket."""
|
||||||
|
self.ws.close()
|
||||||
{%endif%}
|
{%endif%}
|
||||||
|
@ -683,6 +683,11 @@ async def test_"""
|
|||||||
if len(endpoint_refs) == 0:
|
if len(endpoint_refs) == 0:
|
||||||
template_info["response_type"] = ""
|
template_info["response_type"] = ""
|
||||||
|
|
||||||
|
if "x-dropshot-websocket" in endpoint:
|
||||||
|
template_info["response_type"] = (
|
||||||
|
template_info["response_type"].replace("Optional[", "").replace("]", "")
|
||||||
|
)
|
||||||
|
|
||||||
if "description" in endpoint:
|
if "description" in endpoint:
|
||||||
template_info["docs"] = endpoint["description"]
|
template_info["docs"] = endpoint["description"]
|
||||||
|
|
||||||
@ -1195,20 +1200,52 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
|||||||
all_options.append(object_name)
|
all_options.append(object_name)
|
||||||
|
|
||||||
# Write the sum type.
|
# Write the sum type.
|
||||||
f.write("from typing import Union\n")
|
description = getAnyOfDescription(schema)
|
||||||
f.write(name + " = Union[")
|
content = generateUnionType(all_options, name, description)
|
||||||
|
f.write(content)
|
||||||
for num, option in enumerate(all_options, start=0):
|
|
||||||
if num == 0:
|
|
||||||
f.write(option)
|
|
||||||
else:
|
|
||||||
f.write(", " + option + "")
|
|
||||||
f.write("]\n")
|
|
||||||
|
|
||||||
# Close the file.
|
# Close the file.
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def getAnyOfDescription(schema: dict) -> str:
|
||||||
|
if "description" in schema:
|
||||||
|
return schema["description"]
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
def generateUnionType(types: List[str], name: str, description: str) -> str:
|
||||||
|
ArgType = TypedDict(
|
||||||
|
"ArgType",
|
||||||
|
{
|
||||||
|
"name": str,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
TemplateType = TypedDict(
|
||||||
|
"TemplateType",
|
||||||
|
{
|
||||||
|
"types": List[ArgType],
|
||||||
|
"description": str,
|
||||||
|
"name": str,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
template_info: TemplateType = {
|
||||||
|
"types": [],
|
||||||
|
"description": description,
|
||||||
|
"name": name,
|
||||||
|
}
|
||||||
|
for type in types:
|
||||||
|
template_info["types"].append({"name": type})
|
||||||
|
|
||||||
|
environment = jinja2.Environment(loader=jinja2.FileSystemLoader("generate/"))
|
||||||
|
template_file = "union-type.py.jinja2"
|
||||||
|
template = environment.get_template(template_file)
|
||||||
|
content = template.render(**template_info)
|
||||||
|
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
||||||
logging.info("generating type: ", name, " at: ", path)
|
logging.info("generating type: ", name, " at: ", path)
|
||||||
|
|
||||||
@ -1309,20 +1346,21 @@ def generateOneOfType(path: str, name: str, schema: dict, data: dict):
|
|||||||
f.write("from typing import Any\n")
|
f.write("from typing import Any\n")
|
||||||
f.write(name + " = Any")
|
f.write(name + " = Any")
|
||||||
else:
|
else:
|
||||||
f.write("from typing import Union\n")
|
description = getOneOfDescription(schema)
|
||||||
f.write(name + " = Union[")
|
content = generateUnionType(all_options, name, description)
|
||||||
|
f.write(content)
|
||||||
for num, option in enumerate(all_options, start=0):
|
|
||||||
if num == 0:
|
|
||||||
f.write(option)
|
|
||||||
else:
|
|
||||||
f.write(", " + option + "")
|
|
||||||
f.write("]\n")
|
|
||||||
|
|
||||||
# Close the file.
|
# Close the file.
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
def getOneOfDescription(schema: dict) -> str:
|
||||||
|
if "description" in schema:
|
||||||
|
return schema["description"]
|
||||||
|
else:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def generateObjectTypeCode(
|
def generateObjectTypeCode(
|
||||||
name: str, schema: dict, type_name: str, data: dict, tag: Optional[str]
|
name: str, schema: dict, type_name: str, data: dict, tag: Optional[str]
|
||||||
) -> str:
|
) -> str:
|
||||||
|
46
generate/union-type.py.jinja2
Normal file
46
generate/union-type.py.jinja2
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
from typing import Dict, Any, Union
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
|
class {{name}}:
|
||||||
|
{% if description %}
|
||||||
|
"""{{description}}"""
|
||||||
|
{% endif %}
|
||||||
|
type: Union[
|
||||||
|
{% for type in types %}
|
||||||
|
{{type.name}},
|
||||||
|
{% endfor %}
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(self,
|
||||||
|
type: Union[
|
||||||
|
{% for type in types %}
|
||||||
|
type({{type.name}}),
|
||||||
|
{% endfor %}
|
||||||
|
]):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
{% for type in types %}{% if loop.first %}
|
||||||
|
if isinstance(self.type, {{type.name}}):
|
||||||
|
n : {{type.name}} = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
{% else %}elif isinstance(self.type, {{type.name}}):
|
||||||
|
n : {{type.name}} = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
{% endif %}{% endfor %}
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
{% for type in types %}{% if loop.first %}
|
||||||
|
if d.get("type") == "{{type.name}}":
|
||||||
|
n : {{type.name}} = {{type.name}}()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
{% else %}elif d.get("type") == "{{type.name}}":
|
||||||
|
n : {{type.name}} = {{type.name}}()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
{% endif %}{% endfor %}
|
||||||
|
raise Exception("Unknown type")
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
from typing import Any, Dict, Optional
|
from typing import Any, Dict
|
||||||
|
|
||||||
import bson
|
import bson
|
||||||
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
|
from websockets.client import WebSocketClientProtocol, connect as ws_connect_async
|
||||||
@ -153,7 +153,11 @@ class WebSocket:
|
|||||||
"""Send data as bson to the websocket."""
|
"""Send data as bson to the websocket."""
|
||||||
self.ws.send(bson.BSON.encode(data.to_dict()))
|
self.ws.send(bson.BSON.encode(data.to_dict()))
|
||||||
|
|
||||||
def recv(self) -> Optional[WebSocketResponse]:
|
def recv(self) -> WebSocketResponse:
|
||||||
"""Receive data from the websocket."""
|
"""Receive data from the websocket."""
|
||||||
message = self.ws.recv()
|
message = self.ws.recv()
|
||||||
return Optional[WebSocketResponse].from_dict(json.loads(message))
|
return WebSocketResponse.from_dict(json.loads(message))
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""Close the websocket."""
|
||||||
|
self.ws.close()
|
||||||
|
@ -23,12 +23,14 @@ from .models import (
|
|||||||
FileImportFormat,
|
FileImportFormat,
|
||||||
FileMass,
|
FileMass,
|
||||||
FileVolume,
|
FileVolume,
|
||||||
|
ModelingCmd,
|
||||||
ModelingCmdId,
|
ModelingCmdId,
|
||||||
Pong,
|
Pong,
|
||||||
UnitDensity,
|
UnitDensity,
|
||||||
UnitMass,
|
UnitMass,
|
||||||
UnitVolume,
|
UnitVolume,
|
||||||
User,
|
User,
|
||||||
|
WebSocketRequest,
|
||||||
)
|
)
|
||||||
from .models.modeling_cmd import start_path
|
from .models.modeling_cmd import start_path
|
||||||
from .models.web_socket_request import modeling_cmd_req
|
from .models.web_socket_request import modeling_cmd_req
|
||||||
@ -307,7 +309,9 @@ def test_ws():
|
|||||||
|
|
||||||
# Send a message.
|
# Send a message.
|
||||||
id = uuid.uuid4()
|
id = uuid.uuid4()
|
||||||
req = modeling_cmd_req(cmd=start_path(), cmd_id=ModelingCmdId(id))
|
req = WebSocketRequest(
|
||||||
|
modeling_cmd_req(cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(id))
|
||||||
|
)
|
||||||
j = json.dumps(req.to_dict())
|
j = json.dumps(req.to_dict())
|
||||||
print(f"Sending: {j}")
|
print(f"Sending: {j}")
|
||||||
websocket.send(req)
|
websocket.send(req)
|
||||||
@ -318,3 +322,6 @@ def test_ws():
|
|||||||
message = websocket.recv()
|
message = websocket.recv()
|
||||||
print(json.dumps(message))
|
print(json.dumps(message))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
# Close the websocket.
|
||||||
|
websocket.close()
|
||||||
|
@ -3,6 +3,7 @@ from typing import Any, Dict, List, Type, TypeVar, Union
|
|||||||
|
|
||||||
import attr
|
import attr
|
||||||
from dateutil.parser import isoparse
|
from dateutil.parser import isoparse
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.ai_feedback import AiFeedback
|
from ..models.ai_feedback import AiFeedback
|
||||||
from ..models.api_call_status import ApiCallStatus
|
from ..models.api_call_status import ApiCallStatus
|
||||||
@ -1411,7 +1412,11 @@ class text_to_cad:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
AsyncApiCallOutput = Union[
|
class AsyncApiCallOutput:
|
||||||
|
|
||||||
|
"""The output from the async API call."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
file_conversion,
|
file_conversion,
|
||||||
file_center_of_mass,
|
file_center_of_mass,
|
||||||
file_mass,
|
file_mass,
|
||||||
@ -1419,4 +1424,82 @@ AsyncApiCallOutput = Union[
|
|||||||
file_density,
|
file_density,
|
||||||
file_surface_area,
|
file_surface_area,
|
||||||
text_to_cad,
|
text_to_cad,
|
||||||
]
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(file_conversion),
|
||||||
|
type(file_center_of_mass),
|
||||||
|
type(file_mass),
|
||||||
|
type(file_volume),
|
||||||
|
type(file_density),
|
||||||
|
type(file_surface_area),
|
||||||
|
type(text_to_cad),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, file_conversion):
|
||||||
|
n: file_conversion = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, file_center_of_mass):
|
||||||
|
n: file_center_of_mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, file_mass):
|
||||||
|
n: file_mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, file_volume):
|
||||||
|
n: file_volume = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, file_density):
|
||||||
|
n: file_density = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, file_surface_area):
|
||||||
|
n: file_surface_area = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, text_to_cad):
|
||||||
|
n: text_to_cad = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "file_conversion":
|
||||||
|
n: file_conversion = file_conversion()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "file_center_of_mass":
|
||||||
|
n: file_center_of_mass = file_center_of_mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "file_mass":
|
||||||
|
n: file_mass = file_mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "file_volume":
|
||||||
|
n: file_volume = file_volume()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "file_density":
|
||||||
|
n: file_density = file_density()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "file_surface_area":
|
||||||
|
n: file_surface_area = file_surface_area()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "text_to_cad":
|
||||||
|
n: text_to_cad = text_to_cad()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.system import System
|
from ..models.system import System
|
||||||
from ..models.unit_length import UnitLength
|
from ..models.unit_length import UnitLength
|
||||||
@ -434,4 +435,94 @@ class stl:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
InputFormat = Union[fbx, gltf, obj, ply, sldprt, step, stl]
|
class InputFormat:
|
||||||
|
|
||||||
|
"""Input format specifier."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
fbx,
|
||||||
|
gltf,
|
||||||
|
obj,
|
||||||
|
ply,
|
||||||
|
sldprt,
|
||||||
|
step,
|
||||||
|
stl,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(fbx),
|
||||||
|
type(gltf),
|
||||||
|
type(obj),
|
||||||
|
type(ply),
|
||||||
|
type(sldprt),
|
||||||
|
type(step),
|
||||||
|
type(stl),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, fbx):
|
||||||
|
n: fbx = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, gltf):
|
||||||
|
n: gltf = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, obj):
|
||||||
|
n: obj = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, ply):
|
||||||
|
n: ply = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, sldprt):
|
||||||
|
n: sldprt = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, step):
|
||||||
|
n: step = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, stl):
|
||||||
|
n: stl = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "fbx":
|
||||||
|
n: fbx = fbx()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "gltf":
|
||||||
|
n: gltf = gltf()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "obj":
|
||||||
|
n: obj = obj()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "ply":
|
||||||
|
n: ply = ply()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "sldprt":
|
||||||
|
n: sldprt = sldprt()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "step":
|
||||||
|
n: step = step()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "stl":
|
||||||
|
n: stl = stl()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.annotation_options import AnnotationOptions
|
from ..models.annotation_options import AnnotationOptions
|
||||||
from ..models.annotation_type import AnnotationType
|
from ..models.annotation_type import AnnotationType
|
||||||
@ -4877,7 +4878,11 @@ class curve_set_constraint:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
ModelingCmd = Union[
|
class ModelingCmd:
|
||||||
|
|
||||||
|
"""Commands that the KittyCAD engine can execute."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
start_path,
|
start_path,
|
||||||
move_path_pen,
|
move_path_pen,
|
||||||
extend_path,
|
extend_path,
|
||||||
@ -4949,4 +4954,658 @@ ModelingCmd = Union[
|
|||||||
surface_area,
|
surface_area,
|
||||||
get_sketch_mode_plane,
|
get_sketch_mode_plane,
|
||||||
curve_set_constraint,
|
curve_set_constraint,
|
||||||
]
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(start_path),
|
||||||
|
type(move_path_pen),
|
||||||
|
type(extend_path),
|
||||||
|
type(extrude),
|
||||||
|
type(close_path),
|
||||||
|
type(camera_drag_start),
|
||||||
|
type(camera_drag_move),
|
||||||
|
type(camera_drag_end),
|
||||||
|
type(default_camera_look_at),
|
||||||
|
type(default_camera_zoom),
|
||||||
|
type(default_camera_enable_sketch_mode),
|
||||||
|
type(default_camera_disable_sketch_mode),
|
||||||
|
type(default_camera_focus_on),
|
||||||
|
type(export),
|
||||||
|
type(entity_get_parent_id),
|
||||||
|
type(entity_get_num_children),
|
||||||
|
type(entity_get_child_uuid),
|
||||||
|
type(entity_get_all_child_uuids),
|
||||||
|
type(edit_mode_enter),
|
||||||
|
type(edit_mode_exit),
|
||||||
|
type(select_with_point),
|
||||||
|
type(select_clear),
|
||||||
|
type(select_add),
|
||||||
|
type(select_remove),
|
||||||
|
type(select_replace),
|
||||||
|
type(select_get),
|
||||||
|
type(highlight_set_entity),
|
||||||
|
type(highlight_set_entities),
|
||||||
|
type(new_annotation),
|
||||||
|
type(update_annotation),
|
||||||
|
type(object_visible),
|
||||||
|
type(object_bring_to_front),
|
||||||
|
type(get_entity_type),
|
||||||
|
type(solid2d_add_hole),
|
||||||
|
type(solid3d_get_all_edge_faces),
|
||||||
|
type(solid3d_get_all_opposite_edges),
|
||||||
|
type(solid3d_get_opposite_edge),
|
||||||
|
type(solid3d_get_next_adjacent_edge),
|
||||||
|
type(solid3d_get_prev_adjacent_edge),
|
||||||
|
type(send_object),
|
||||||
|
type(entity_set_opacity),
|
||||||
|
type(entity_fade),
|
||||||
|
type(make_plane),
|
||||||
|
type(plane_set_color),
|
||||||
|
type(set_tool),
|
||||||
|
type(mouse_move),
|
||||||
|
type(mouse_click),
|
||||||
|
type(sketch_mode_enable),
|
||||||
|
type(sketch_mode_disable),
|
||||||
|
type(curve_get_type),
|
||||||
|
type(curve_get_control_points),
|
||||||
|
type(take_snapshot),
|
||||||
|
type(make_axes_gizmo),
|
||||||
|
type(path_get_info),
|
||||||
|
type(path_get_curve_uuids_for_vertices),
|
||||||
|
type(path_get_vertex_uuids),
|
||||||
|
type(handle_mouse_drag_start),
|
||||||
|
type(handle_mouse_drag_move),
|
||||||
|
type(handle_mouse_drag_end),
|
||||||
|
type(remove_scene_objects),
|
||||||
|
type(plane_intersect_and_project),
|
||||||
|
type(curve_get_end_points),
|
||||||
|
type(reconfigure_stream),
|
||||||
|
type(import_files),
|
||||||
|
type(mass),
|
||||||
|
type(density),
|
||||||
|
type(volume),
|
||||||
|
type(center_of_mass),
|
||||||
|
type(surface_area),
|
||||||
|
type(get_sketch_mode_plane),
|
||||||
|
type(curve_set_constraint),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, start_path):
|
||||||
|
n: start_path = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, move_path_pen):
|
||||||
|
n: move_path_pen = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, extend_path):
|
||||||
|
n: extend_path = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, extrude):
|
||||||
|
n: extrude = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, close_path):
|
||||||
|
n: close_path = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, camera_drag_start):
|
||||||
|
n: camera_drag_start = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, camera_drag_move):
|
||||||
|
n: camera_drag_move = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, camera_drag_end):
|
||||||
|
n: camera_drag_end = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, default_camera_look_at):
|
||||||
|
n: default_camera_look_at = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, default_camera_zoom):
|
||||||
|
n: default_camera_zoom = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, default_camera_enable_sketch_mode):
|
||||||
|
n: default_camera_enable_sketch_mode = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, default_camera_disable_sketch_mode):
|
||||||
|
n: default_camera_disable_sketch_mode = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, default_camera_focus_on):
|
||||||
|
n: default_camera_focus_on = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, export):
|
||||||
|
n: export = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_parent_id):
|
||||||
|
n: entity_get_parent_id = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_num_children):
|
||||||
|
n: entity_get_num_children = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_child_uuid):
|
||||||
|
n: entity_get_child_uuid = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_all_child_uuids):
|
||||||
|
n: entity_get_all_child_uuids = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, edit_mode_enter):
|
||||||
|
n: edit_mode_enter = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, edit_mode_exit):
|
||||||
|
n: edit_mode_exit = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_with_point):
|
||||||
|
n: select_with_point = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_clear):
|
||||||
|
n: select_clear = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_add):
|
||||||
|
n: select_add = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_remove):
|
||||||
|
n: select_remove = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_replace):
|
||||||
|
n: select_replace = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_get):
|
||||||
|
n: select_get = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, highlight_set_entity):
|
||||||
|
n: highlight_set_entity = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, highlight_set_entities):
|
||||||
|
n: highlight_set_entities = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, new_annotation):
|
||||||
|
n: new_annotation = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, update_annotation):
|
||||||
|
n: update_annotation = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, object_visible):
|
||||||
|
n: object_visible = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, object_bring_to_front):
|
||||||
|
n: object_bring_to_front = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, get_entity_type):
|
||||||
|
n: get_entity_type = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid2d_add_hole):
|
||||||
|
n: solid2d_add_hole = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_all_edge_faces):
|
||||||
|
n: solid3d_get_all_edge_faces = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_all_opposite_edges):
|
||||||
|
n: solid3d_get_all_opposite_edges = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_opposite_edge):
|
||||||
|
n: solid3d_get_opposite_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_next_adjacent_edge):
|
||||||
|
n: solid3d_get_next_adjacent_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_prev_adjacent_edge):
|
||||||
|
n: solid3d_get_prev_adjacent_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, send_object):
|
||||||
|
n: send_object = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_set_opacity):
|
||||||
|
n: entity_set_opacity = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_fade):
|
||||||
|
n: entity_fade = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, make_plane):
|
||||||
|
n: make_plane = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, plane_set_color):
|
||||||
|
n: plane_set_color = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, set_tool):
|
||||||
|
n: set_tool = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mouse_move):
|
||||||
|
n: mouse_move = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mouse_click):
|
||||||
|
n: mouse_click = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, sketch_mode_enable):
|
||||||
|
n: sketch_mode_enable = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, sketch_mode_disable):
|
||||||
|
n: sketch_mode_disable = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_type):
|
||||||
|
n: curve_get_type = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_control_points):
|
||||||
|
n: curve_get_control_points = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, take_snapshot):
|
||||||
|
n: take_snapshot = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, make_axes_gizmo):
|
||||||
|
n: make_axes_gizmo = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_info):
|
||||||
|
n: path_get_info = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_curve_uuids_for_vertices):
|
||||||
|
n: path_get_curve_uuids_for_vertices = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_vertex_uuids):
|
||||||
|
n: path_get_vertex_uuids = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, handle_mouse_drag_start):
|
||||||
|
n: handle_mouse_drag_start = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, handle_mouse_drag_move):
|
||||||
|
n: handle_mouse_drag_move = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, handle_mouse_drag_end):
|
||||||
|
n: handle_mouse_drag_end = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, remove_scene_objects):
|
||||||
|
n: remove_scene_objects = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, plane_intersect_and_project):
|
||||||
|
n: plane_intersect_and_project = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_end_points):
|
||||||
|
n: curve_get_end_points = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, reconfigure_stream):
|
||||||
|
n: reconfigure_stream = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, import_files):
|
||||||
|
n: import_files = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mass):
|
||||||
|
n: mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, density):
|
||||||
|
n: density = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, volume):
|
||||||
|
n: volume = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, center_of_mass):
|
||||||
|
n: center_of_mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, surface_area):
|
||||||
|
n: surface_area = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, get_sketch_mode_plane):
|
||||||
|
n: get_sketch_mode_plane = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_set_constraint):
|
||||||
|
n: curve_set_constraint = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "start_path":
|
||||||
|
n: start_path = start_path()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "move_path_pen":
|
||||||
|
n: move_path_pen = move_path_pen()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "extend_path":
|
||||||
|
n: extend_path = extend_path()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "extrude":
|
||||||
|
n: extrude = extrude()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "close_path":
|
||||||
|
n: close_path = close_path()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "camera_drag_start":
|
||||||
|
n: camera_drag_start = camera_drag_start()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "camera_drag_move":
|
||||||
|
n: camera_drag_move = camera_drag_move()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "camera_drag_end":
|
||||||
|
n: camera_drag_end = camera_drag_end()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "default_camera_look_at":
|
||||||
|
n: default_camera_look_at = default_camera_look_at()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "default_camera_zoom":
|
||||||
|
n: default_camera_zoom = default_camera_zoom()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "default_camera_enable_sketch_mode":
|
||||||
|
n: default_camera_enable_sketch_mode = default_camera_enable_sketch_mode()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "default_camera_disable_sketch_mode":
|
||||||
|
n: default_camera_disable_sketch_mode = default_camera_disable_sketch_mode()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "default_camera_focus_on":
|
||||||
|
n: default_camera_focus_on = default_camera_focus_on()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "export":
|
||||||
|
n: export = export()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_parent_id":
|
||||||
|
n: entity_get_parent_id = entity_get_parent_id()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_num_children":
|
||||||
|
n: entity_get_num_children = entity_get_num_children()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_child_uuid":
|
||||||
|
n: entity_get_child_uuid = entity_get_child_uuid()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_all_child_uuids":
|
||||||
|
n: entity_get_all_child_uuids = entity_get_all_child_uuids()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "edit_mode_enter":
|
||||||
|
n: edit_mode_enter = edit_mode_enter()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "edit_mode_exit":
|
||||||
|
n: edit_mode_exit = edit_mode_exit()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_with_point":
|
||||||
|
n: select_with_point = select_with_point()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_clear":
|
||||||
|
n: select_clear = select_clear()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_add":
|
||||||
|
n: select_add = select_add()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_remove":
|
||||||
|
n: select_remove = select_remove()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_replace":
|
||||||
|
n: select_replace = select_replace()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_get":
|
||||||
|
n: select_get = select_get()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "highlight_set_entity":
|
||||||
|
n: highlight_set_entity = highlight_set_entity()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "highlight_set_entities":
|
||||||
|
n: highlight_set_entities = highlight_set_entities()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "new_annotation":
|
||||||
|
n: new_annotation = new_annotation()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "update_annotation":
|
||||||
|
n: update_annotation = update_annotation()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "object_visible":
|
||||||
|
n: object_visible = object_visible()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "object_bring_to_front":
|
||||||
|
n: object_bring_to_front = object_bring_to_front()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "get_entity_type":
|
||||||
|
n: get_entity_type = get_entity_type()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid2d_add_hole":
|
||||||
|
n: solid2d_add_hole = solid2d_add_hole()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_all_edge_faces":
|
||||||
|
n: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_all_opposite_edges":
|
||||||
|
n: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_opposite_edge":
|
||||||
|
n: solid3d_get_opposite_edge = solid3d_get_opposite_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_next_adjacent_edge":
|
||||||
|
n: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_prev_adjacent_edge":
|
||||||
|
n: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "send_object":
|
||||||
|
n: send_object = send_object()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_set_opacity":
|
||||||
|
n: entity_set_opacity = entity_set_opacity()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_fade":
|
||||||
|
n: entity_fade = entity_fade()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "make_plane":
|
||||||
|
n: make_plane = make_plane()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "plane_set_color":
|
||||||
|
n: plane_set_color = plane_set_color()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "set_tool":
|
||||||
|
n: set_tool = set_tool()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mouse_move":
|
||||||
|
n: mouse_move = mouse_move()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mouse_click":
|
||||||
|
n: mouse_click = mouse_click()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "sketch_mode_enable":
|
||||||
|
n: sketch_mode_enable = sketch_mode_enable()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "sketch_mode_disable":
|
||||||
|
n: sketch_mode_disable = sketch_mode_disable()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_type":
|
||||||
|
n: curve_get_type = curve_get_type()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_control_points":
|
||||||
|
n: curve_get_control_points = curve_get_control_points()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "take_snapshot":
|
||||||
|
n: take_snapshot = take_snapshot()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "make_axes_gizmo":
|
||||||
|
n: make_axes_gizmo = make_axes_gizmo()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_info":
|
||||||
|
n: path_get_info = path_get_info()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_curve_uuids_for_vertices":
|
||||||
|
n: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_vertex_uuids":
|
||||||
|
n: path_get_vertex_uuids = path_get_vertex_uuids()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "handle_mouse_drag_start":
|
||||||
|
n: handle_mouse_drag_start = handle_mouse_drag_start()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "handle_mouse_drag_move":
|
||||||
|
n: handle_mouse_drag_move = handle_mouse_drag_move()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "handle_mouse_drag_end":
|
||||||
|
n: handle_mouse_drag_end = handle_mouse_drag_end()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "remove_scene_objects":
|
||||||
|
n: remove_scene_objects = remove_scene_objects()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "plane_intersect_and_project":
|
||||||
|
n: plane_intersect_and_project = plane_intersect_and_project()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_end_points":
|
||||||
|
n: curve_get_end_points = curve_get_end_points()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "reconfigure_stream":
|
||||||
|
n: reconfigure_stream = reconfigure_stream()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "import_files":
|
||||||
|
n: import_files = import_files()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mass":
|
||||||
|
n: mass = mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "density":
|
||||||
|
n: density = density()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "volume":
|
||||||
|
n: volume = volume()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "center_of_mass":
|
||||||
|
n: center_of_mass = center_of_mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "surface_area":
|
||||||
|
n: surface_area = surface_area()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "get_sketch_mode_plane":
|
||||||
|
n: get_sketch_mode_plane = get_sketch_mode_plane()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_set_constraint":
|
||||||
|
n: curve_set_constraint = curve_set_constraint()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.center_of_mass import CenterOfMass
|
from ..models.center_of_mass import CenterOfMass
|
||||||
from ..models.curve_get_control_points import CurveGetControlPoints
|
from ..models.curve_get_control_points import CurveGetControlPoints
|
||||||
@ -1974,7 +1975,11 @@ class get_sketch_mode_plane:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
OkModelingCmdResponse = Union[
|
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,
|
empty,
|
||||||
export,
|
export,
|
||||||
select_with_point,
|
select_with_point,
|
||||||
@ -2006,4 +2011,298 @@ OkModelingCmdResponse = Union[
|
|||||||
surface_area,
|
surface_area,
|
||||||
center_of_mass,
|
center_of_mass,
|
||||||
get_sketch_mode_plane,
|
get_sketch_mode_plane,
|
||||||
]
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(empty),
|
||||||
|
type(export),
|
||||||
|
type(select_with_point),
|
||||||
|
type(highlight_set_entity),
|
||||||
|
type(entity_get_child_uuid),
|
||||||
|
type(entity_get_num_children),
|
||||||
|
type(entity_get_parent_id),
|
||||||
|
type(entity_get_all_child_uuids),
|
||||||
|
type(select_get),
|
||||||
|
type(get_entity_type),
|
||||||
|
type(solid3d_get_all_edge_faces),
|
||||||
|
type(solid3d_get_all_opposite_edges),
|
||||||
|
type(solid3d_get_opposite_edge),
|
||||||
|
type(solid3d_get_prev_adjacent_edge),
|
||||||
|
type(solid3d_get_next_adjacent_edge),
|
||||||
|
type(mouse_click),
|
||||||
|
type(curve_get_type),
|
||||||
|
type(curve_get_control_points),
|
||||||
|
type(take_snapshot),
|
||||||
|
type(path_get_info),
|
||||||
|
type(path_get_curve_uuids_for_vertices),
|
||||||
|
type(path_get_vertex_uuids),
|
||||||
|
type(plane_intersect_and_project),
|
||||||
|
type(curve_get_end_points),
|
||||||
|
type(import_files),
|
||||||
|
type(mass),
|
||||||
|
type(volume),
|
||||||
|
type(density),
|
||||||
|
type(surface_area),
|
||||||
|
type(center_of_mass),
|
||||||
|
type(get_sketch_mode_plane),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, empty):
|
||||||
|
n: empty = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, export):
|
||||||
|
n: export = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_with_point):
|
||||||
|
n: select_with_point = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, highlight_set_entity):
|
||||||
|
n: highlight_set_entity = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_child_uuid):
|
||||||
|
n: entity_get_child_uuid = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_num_children):
|
||||||
|
n: entity_get_num_children = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_parent_id):
|
||||||
|
n: entity_get_parent_id = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, entity_get_all_child_uuids):
|
||||||
|
n: entity_get_all_child_uuids = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, select_get):
|
||||||
|
n: select_get = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, get_entity_type):
|
||||||
|
n: get_entity_type = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_all_edge_faces):
|
||||||
|
n: solid3d_get_all_edge_faces = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_all_opposite_edges):
|
||||||
|
n: solid3d_get_all_opposite_edges = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_opposite_edge):
|
||||||
|
n: solid3d_get_opposite_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_prev_adjacent_edge):
|
||||||
|
n: solid3d_get_prev_adjacent_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, solid3d_get_next_adjacent_edge):
|
||||||
|
n: solid3d_get_next_adjacent_edge = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mouse_click):
|
||||||
|
n: mouse_click = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_type):
|
||||||
|
n: curve_get_type = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_control_points):
|
||||||
|
n: curve_get_control_points = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, take_snapshot):
|
||||||
|
n: take_snapshot = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_info):
|
||||||
|
n: path_get_info = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_curve_uuids_for_vertices):
|
||||||
|
n: path_get_curve_uuids_for_vertices = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, path_get_vertex_uuids):
|
||||||
|
n: path_get_vertex_uuids = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, plane_intersect_and_project):
|
||||||
|
n: plane_intersect_and_project = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, curve_get_end_points):
|
||||||
|
n: curve_get_end_points = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, import_files):
|
||||||
|
n: import_files = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mass):
|
||||||
|
n: mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, volume):
|
||||||
|
n: volume = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, density):
|
||||||
|
n: density = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, surface_area):
|
||||||
|
n: surface_area = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, center_of_mass):
|
||||||
|
n: center_of_mass = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, get_sketch_mode_plane):
|
||||||
|
n: get_sketch_mode_plane = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "empty":
|
||||||
|
n: empty = empty()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "export":
|
||||||
|
n: export = export()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_with_point":
|
||||||
|
n: select_with_point = select_with_point()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "highlight_set_entity":
|
||||||
|
n: highlight_set_entity = highlight_set_entity()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_child_uuid":
|
||||||
|
n: entity_get_child_uuid = entity_get_child_uuid()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_num_children":
|
||||||
|
n: entity_get_num_children = entity_get_num_children()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_parent_id":
|
||||||
|
n: entity_get_parent_id = entity_get_parent_id()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "entity_get_all_child_uuids":
|
||||||
|
n: entity_get_all_child_uuids = entity_get_all_child_uuids()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "select_get":
|
||||||
|
n: select_get = select_get()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "get_entity_type":
|
||||||
|
n: get_entity_type = get_entity_type()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_all_edge_faces":
|
||||||
|
n: solid3d_get_all_edge_faces = solid3d_get_all_edge_faces()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_all_opposite_edges":
|
||||||
|
n: solid3d_get_all_opposite_edges = solid3d_get_all_opposite_edges()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_opposite_edge":
|
||||||
|
n: solid3d_get_opposite_edge = solid3d_get_opposite_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_prev_adjacent_edge":
|
||||||
|
n: solid3d_get_prev_adjacent_edge = solid3d_get_prev_adjacent_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "solid3d_get_next_adjacent_edge":
|
||||||
|
n: solid3d_get_next_adjacent_edge = solid3d_get_next_adjacent_edge()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mouse_click":
|
||||||
|
n: mouse_click = mouse_click()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_type":
|
||||||
|
n: curve_get_type = curve_get_type()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_control_points":
|
||||||
|
n: curve_get_control_points = curve_get_control_points()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "take_snapshot":
|
||||||
|
n: take_snapshot = take_snapshot()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_info":
|
||||||
|
n: path_get_info = path_get_info()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_curve_uuids_for_vertices":
|
||||||
|
n: path_get_curve_uuids_for_vertices = path_get_curve_uuids_for_vertices()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "path_get_vertex_uuids":
|
||||||
|
n: path_get_vertex_uuids = path_get_vertex_uuids()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "plane_intersect_and_project":
|
||||||
|
n: plane_intersect_and_project = plane_intersect_and_project()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "curve_get_end_points":
|
||||||
|
n: curve_get_end_points = curve_get_end_points()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "import_files":
|
||||||
|
n: import_files = import_files()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mass":
|
||||||
|
n: mass = mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "volume":
|
||||||
|
n: volume = volume()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "density":
|
||||||
|
n: density = density()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "surface_area":
|
||||||
|
n: surface_area = surface_area()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "center_of_mass":
|
||||||
|
n: center_of_mass = center_of_mass()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "get_sketch_mode_plane":
|
||||||
|
n: get_sketch_mode_plane = get_sketch_mode_plane()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..types import UNSET, Unset
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
@ -340,6 +341,84 @@ class metrics_request:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
OkWebSocketResponseData = Union[
|
class OkWebSocketResponseData:
|
||||||
ice_server_info, trickle_ice, sdp_answer, modeling, export, metrics_request
|
|
||||||
]
|
"""The websocket messages this server sends."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
ice_server_info,
|
||||||
|
trickle_ice,
|
||||||
|
sdp_answer,
|
||||||
|
modeling,
|
||||||
|
export,
|
||||||
|
metrics_request,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(ice_server_info),
|
||||||
|
type(trickle_ice),
|
||||||
|
type(sdp_answer),
|
||||||
|
type(modeling),
|
||||||
|
type(export),
|
||||||
|
type(metrics_request),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, ice_server_info):
|
||||||
|
n: ice_server_info = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, trickle_ice):
|
||||||
|
n: trickle_ice = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, sdp_answer):
|
||||||
|
n: sdp_answer = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, modeling):
|
||||||
|
n: modeling = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, export):
|
||||||
|
n: export = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, metrics_request):
|
||||||
|
n: metrics_request = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "ice_server_info":
|
||||||
|
n: ice_server_info = ice_server_info()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "trickle_ice":
|
||||||
|
n: trickle_ice = trickle_ice()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "sdp_answer":
|
||||||
|
n: sdp_answer = sdp_answer()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "modeling":
|
||||||
|
n: modeling = modeling()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "export":
|
||||||
|
n: export = export()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "metrics_request":
|
||||||
|
n: metrics_request = metrics_request()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.fbx_storage import FbxStorage
|
from ..models.fbx_storage import FbxStorage
|
||||||
from ..models.gltf_presentation import GltfPresentation
|
from ..models.gltf_presentation import GltfPresentation
|
||||||
@ -494,4 +495,84 @@ class stl:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
OutputFormat = Union[fbx, gltf, obj, ply, step, stl]
|
class OutputFormat:
|
||||||
|
|
||||||
|
"""Output format specifier."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
fbx,
|
||||||
|
gltf,
|
||||||
|
obj,
|
||||||
|
ply,
|
||||||
|
step,
|
||||||
|
stl,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(fbx),
|
||||||
|
type(gltf),
|
||||||
|
type(obj),
|
||||||
|
type(ply),
|
||||||
|
type(step),
|
||||||
|
type(stl),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, fbx):
|
||||||
|
n: fbx = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, gltf):
|
||||||
|
n: gltf = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, obj):
|
||||||
|
n: obj = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, ply):
|
||||||
|
n: ply = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, step):
|
||||||
|
n: step = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, stl):
|
||||||
|
n: stl = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "fbx":
|
||||||
|
n: fbx = fbx()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "gltf":
|
||||||
|
n: gltf = gltf()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "obj":
|
||||||
|
n: obj = obj()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "ply":
|
||||||
|
n: ply = ply()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "step":
|
||||||
|
n: step = step()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "stl":
|
||||||
|
n: stl = stl()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.angle import Angle
|
from ..models.angle import Angle
|
||||||
from ..models.point2d import Point2d
|
from ..models.point2d import Point2d
|
||||||
@ -436,4 +437,74 @@ class tangential_arc_to:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
PathSegment = Union[line, arc, bezier, tangential_arc, tangential_arc_to]
|
class PathSegment:
|
||||||
|
|
||||||
|
"""A segment of a path. Paths are composed of many segments."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
line,
|
||||||
|
arc,
|
||||||
|
bezier,
|
||||||
|
tangential_arc,
|
||||||
|
tangential_arc_to,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(line),
|
||||||
|
type(arc),
|
||||||
|
type(bezier),
|
||||||
|
type(tangential_arc),
|
||||||
|
type(tangential_arc_to),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, line):
|
||||||
|
n: line = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, arc):
|
||||||
|
n: arc = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, bezier):
|
||||||
|
n: bezier = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, tangential_arc):
|
||||||
|
n: tangential_arc = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, tangential_arc_to):
|
||||||
|
n: tangential_arc_to = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "line":
|
||||||
|
n: line = line()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "arc":
|
||||||
|
n: arc = arc()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "bezier":
|
||||||
|
n: bezier = bezier()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "tangential_arc":
|
||||||
|
n: tangential_arc = tangential_arc()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "tangential_arc_to":
|
||||||
|
n: tangential_arc_to = tangential_arc_to()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..types import UNSET, Unset
|
from ..types import UNSET, Unset
|
||||||
|
|
||||||
@ -282,6 +283,74 @@ class mesh_by_name:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
Selection = Union[
|
class Selection:
|
||||||
default_scene, scene_by_index, scene_by_name, mesh_by_index, mesh_by_name
|
|
||||||
]
|
"""Data item selection."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
default_scene,
|
||||||
|
scene_by_index,
|
||||||
|
scene_by_name,
|
||||||
|
mesh_by_index,
|
||||||
|
mesh_by_name,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(default_scene),
|
||||||
|
type(scene_by_index),
|
||||||
|
type(scene_by_name),
|
||||||
|
type(mesh_by_index),
|
||||||
|
type(mesh_by_name),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, default_scene):
|
||||||
|
n: default_scene = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, scene_by_index):
|
||||||
|
n: scene_by_index = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, scene_by_name):
|
||||||
|
n: scene_by_name = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mesh_by_index):
|
||||||
|
n: mesh_by_index = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, mesh_by_name):
|
||||||
|
n: mesh_by_name = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "default_scene":
|
||||||
|
n: default_scene = default_scene()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "scene_by_index":
|
||||||
|
n: scene_by_index = scene_by_index()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "scene_by_name":
|
||||||
|
n: scene_by_name = scene_by_name()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mesh_by_index":
|
||||||
|
n: mesh_by_index = mesh_by_index()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "mesh_by_name":
|
||||||
|
n: mesh_by_name = mesh_by_name()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
from typing import Any, Dict, List, Type, TypeVar, Union, cast
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from ..models.client_metrics import ClientMetrics
|
from ..models.client_metrics import ClientMetrics
|
||||||
from ..models.modeling_cmd import ModelingCmd
|
from ..models.modeling_cmd import ModelingCmd
|
||||||
@ -389,11 +390,84 @@ class metrics_response:
|
|||||||
return key in self.additional_properties
|
return key in self.additional_properties
|
||||||
|
|
||||||
|
|
||||||
WebSocketRequest = Union[
|
class WebSocketRequest:
|
||||||
|
|
||||||
|
"""The websocket messages the server receives."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
trickle_ice,
|
trickle_ice,
|
||||||
sdp_offer,
|
sdp_offer,
|
||||||
modeling_cmd_req,
|
modeling_cmd_req,
|
||||||
modeling_cmd_batch_req,
|
modeling_cmd_batch_req,
|
||||||
ping,
|
ping,
|
||||||
metrics_response,
|
metrics_response,
|
||||||
]
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(trickle_ice),
|
||||||
|
type(sdp_offer),
|
||||||
|
type(modeling_cmd_req),
|
||||||
|
type(modeling_cmd_batch_req),
|
||||||
|
type(ping),
|
||||||
|
type(metrics_response),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, trickle_ice):
|
||||||
|
n: trickle_ice = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, sdp_offer):
|
||||||
|
n: sdp_offer = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, modeling_cmd_req):
|
||||||
|
n: modeling_cmd_req = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, modeling_cmd_batch_req):
|
||||||
|
n: modeling_cmd_batch_req = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, ping):
|
||||||
|
n: ping = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, metrics_response):
|
||||||
|
n: metrics_response = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "trickle_ice":
|
||||||
|
n: trickle_ice = trickle_ice()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "sdp_offer":
|
||||||
|
n: sdp_offer = sdp_offer()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "modeling_cmd_req":
|
||||||
|
n: modeling_cmd_req = modeling_cmd_req()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "modeling_cmd_batch_req":
|
||||||
|
n: modeling_cmd_batch_req = modeling_cmd_batch_req()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "ping":
|
||||||
|
n: ping = ping()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
elif d.get("type") == "metrics_response":
|
||||||
|
n: metrics_response = metrics_response()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
@ -1,6 +1,49 @@
|
|||||||
from typing import Union
|
from typing import Any, Dict, Union
|
||||||
|
|
||||||
|
from typing_extensions import Self
|
||||||
|
|
||||||
from .failure_web_socket_response import FailureWebSocketResponse
|
from .failure_web_socket_response import FailureWebSocketResponse
|
||||||
from .success_web_socket_response import SuccessWebSocketResponse
|
from .success_web_socket_response import SuccessWebSocketResponse
|
||||||
|
|
||||||
WebSocketResponse = Union[SuccessWebSocketResponse, FailureWebSocketResponse]
|
|
||||||
|
class WebSocketResponse:
|
||||||
|
|
||||||
|
"""Websocket responses can either be successful or unsuccessful. Slightly different schemas in either case."""
|
||||||
|
|
||||||
|
type: Union[
|
||||||
|
SuccessWebSocketResponse,
|
||||||
|
FailureWebSocketResponse,
|
||||||
|
] = None
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
type: Union[
|
||||||
|
type(SuccessWebSocketResponse),
|
||||||
|
type(FailureWebSocketResponse),
|
||||||
|
],
|
||||||
|
):
|
||||||
|
self.type = type
|
||||||
|
|
||||||
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
|
if isinstance(self.type, SuccessWebSocketResponse):
|
||||||
|
n: SuccessWebSocketResponse = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
elif isinstance(self.type, FailureWebSocketResponse):
|
||||||
|
n: FailureWebSocketResponse = self.type
|
||||||
|
return n.to_dict()
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
|
||||||
|
def from_dict(self, d) -> Self:
|
||||||
|
if d.get("type") == "SuccessWebSocketResponse":
|
||||||
|
n: SuccessWebSocketResponse = SuccessWebSocketResponse()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return Self
|
||||||
|
elif d.get("type") == "FailureWebSocketResponse":
|
||||||
|
n: FailureWebSocketResponse = FailureWebSocketResponse()
|
||||||
|
n.from_dict(d)
|
||||||
|
self.type = n
|
||||||
|
return self
|
||||||
|
|
||||||
|
raise Exception("Unknown type")
|
||||||
|
Reference in New Issue
Block a user