Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
24171eea43 | |||
a008a9d1aa | |||
5011954847 | |||
2c7445c5a6 | |||
bf5e3e1839 | |||
f80767454a | |||
bfb243c233 | |||
e0209e29d6 | |||
213c4d681c | |||
60c42befdf | |||
d31d9507d2 | |||
ca84069e9a | |||
dd2e3848cc | |||
8c56b88113 | |||
cc0bb86a53 | |||
b3eeaef41d | |||
0ac4e4c9c0 | |||
35bbe91eb4 | |||
b4ce8e9642 | |||
479cf6a937 | |||
acea57bcba | |||
64e8aa2816 | |||
38801b52a7 | |||
e73f39cfa9 | |||
7536ca8683 |
3
.github/workflows/update-spec-for-docs.yml
vendored
3
.github/workflows/update-spec-for-docs.yml
vendored
@ -67,6 +67,9 @@ jobs:
|
||||
gh pr create --title "Update lang spec docs for python" \
|
||||
--body "Updating the generated docs for python" \
|
||||
--head "$NEW_BRANCH" \
|
||||
--reviewer jessfraz \
|
||||
--reviewer irev-dev \
|
||||
--reviewer franknoirot \
|
||||
--base main || true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
|
@ -1270,7 +1270,7 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write("from ." + camel_to_snake(ref_name) + " import " + ref_name + "\n")
|
||||
all_options.append(ref_name)
|
||||
|
||||
if isNestedObjectOneOf(schema):
|
||||
if isNestedObjectAnyOf(schema):
|
||||
# We want to write each of the nested objects.
|
||||
for any_of in schema["anyOf"]:
|
||||
# Get the nested object.
|
||||
@ -1326,6 +1326,47 @@ def generateAnyOfType(path: str, name: str, schema: dict, data: dict):
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(object_name)
|
||||
else:
|
||||
# We want to write each of the nested objects.
|
||||
for any_of in schema["anyOf"]:
|
||||
# Get the nested object.
|
||||
if "properties" in any_of:
|
||||
for prop_name in any_of["properties"]:
|
||||
nested_object = any_of["properties"][prop_name]
|
||||
if nested_object == {}:
|
||||
f.write("from typing import Any\n")
|
||||
f.write(prop_name + " = Any\n")
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
elif "$ref" in nested_object:
|
||||
ref = nested_object["$ref"]
|
||||
ref_name = ref[ref.rfind("/") + 1 :]
|
||||
f.write(
|
||||
"from ."
|
||||
+ camel_to_snake(ref_name)
|
||||
+ " import "
|
||||
+ ref_name
|
||||
+ "\n"
|
||||
)
|
||||
f.write("\n")
|
||||
if prop_name != ref_name:
|
||||
f.write(prop_name + " = " + ref_name + "\n")
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
else:
|
||||
object_code = generateObjectTypeCode(
|
||||
prop_name, nested_object, "object", data, None, None
|
||||
)
|
||||
f.write(object_code)
|
||||
f.write("\n")
|
||||
all_options.append(prop_name)
|
||||
elif "type" in any_of and any_of["type"] == "string":
|
||||
enum_code = generateEnumTypeCode(
|
||||
any_of["enum"][0], any_of, "string", []
|
||||
)
|
||||
f.write(enum_code)
|
||||
f.write("\n")
|
||||
all_options.append(any_of["enum"][0])
|
||||
|
||||
# Write the sum type.
|
||||
description = getAnyOfDescription(schema)
|
||||
@ -1953,6 +1994,40 @@ def getOneOfRefType(schema: dict) -> str:
|
||||
raise Exception("Cannot get oneOf ref type for schema: ", schema)
|
||||
|
||||
|
||||
def isNestedObjectAnyOf(schema: dict) -> bool:
|
||||
if "anyOf" not in schema:
|
||||
return False
|
||||
|
||||
is_nested_object = False
|
||||
for any_of in schema["anyOf"]:
|
||||
# Check if each are an object w 1 property in it.
|
||||
if (
|
||||
"type" in any_of
|
||||
and any_of["type"] == "object"
|
||||
and "properties" in any_of
|
||||
and len(any_of["properties"]) == 1
|
||||
):
|
||||
for prop_name in any_of["properties"]:
|
||||
nested_object = any_of["properties"][prop_name]
|
||||
if "type" in nested_object and nested_object["type"] == "object":
|
||||
is_nested_object = True
|
||||
else:
|
||||
is_nested_object = False
|
||||
break
|
||||
elif (
|
||||
"type" in any_of
|
||||
and any_of["type"] == "string"
|
||||
and "enum" in any_of
|
||||
and len(any_of["enum"]) == 1
|
||||
):
|
||||
is_nested_object = True
|
||||
else:
|
||||
is_nested_object = False
|
||||
break
|
||||
|
||||
return is_nested_object
|
||||
|
||||
|
||||
def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
if "oneOf" not in schema:
|
||||
return False
|
||||
@ -1961,7 +2036,8 @@ def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
for one_of in schema["oneOf"]:
|
||||
# Check if each are an object w 1 property in it.
|
||||
if (
|
||||
one_of["type"] == "object"
|
||||
"type" in one_of
|
||||
and one_of["type"] == "object"
|
||||
and "properties" in one_of
|
||||
and len(one_of["properties"]) == 1
|
||||
):
|
||||
@ -1973,7 +2049,10 @@ def isNestedObjectOneOf(schema: dict) -> bool:
|
||||
is_nested_object = False
|
||||
break
|
||||
elif (
|
||||
one_of["type"] == "string" and "enum" in one_of and len(one_of["enum"]) == 1
|
||||
"type" in one_of
|
||||
and one_of["type"] == "string"
|
||||
and "enum" in one_of
|
||||
and len(one_of["enum"]) == 1
|
||||
):
|
||||
is_nested_object = True
|
||||
else:
|
||||
|
@ -20,7 +20,7 @@ poetry run python generate/generate.py
|
||||
|
||||
# Format and lint.
|
||||
poetry run isort .
|
||||
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py
|
||||
poetry run black . generate/generate.py docs/conf.py kittycad/client_test.py kittycad/examples_test.py kittycad/models/*.py kittycad/api/*.py kittycad/api/*/*.py
|
||||
poetry run ruff check --fix .
|
||||
poetry run mypy . || true
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ from ...models.web_socket_response import WebSocketResponse
|
||||
def _get_kwargs(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
@ -45,6 +46,13 @@ def _get_kwargs(
|
||||
else:
|
||||
url = url + "?post_effect=" + str(post_effect)
|
||||
|
||||
if show_grid is not None:
|
||||
|
||||
if "?" in url:
|
||||
url = url + "&show_grid=" + str(show_grid).lower()
|
||||
else:
|
||||
url = url + "?show_grid=" + str(show_grid).lower()
|
||||
|
||||
if unlocked_framerate is not None:
|
||||
|
||||
if "?" in url:
|
||||
@ -87,6 +95,7 @@ def _get_kwargs(
|
||||
def sync(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
@ -101,6 +110,7 @@ def sync(
|
||||
fps=fps,
|
||||
pool=pool,
|
||||
post_effect=post_effect,
|
||||
show_grid=show_grid,
|
||||
unlocked_framerate=unlocked_framerate,
|
||||
video_res_height=video_res_height,
|
||||
video_res_width=video_res_width,
|
||||
@ -114,6 +124,7 @@ def sync(
|
||||
async def asyncio(
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
@ -128,6 +139,7 @@ async def asyncio(
|
||||
fps=fps,
|
||||
pool=pool,
|
||||
post_effect=post_effect,
|
||||
show_grid=show_grid,
|
||||
unlocked_framerate=unlocked_framerate,
|
||||
video_res_height=video_res_height,
|
||||
video_res_width=video_res_width,
|
||||
@ -152,6 +164,7 @@ class WebSocket:
|
||||
self,
|
||||
fps: int,
|
||||
post_effect: PostEffectType,
|
||||
show_grid: bool,
|
||||
unlocked_framerate: bool,
|
||||
video_res_height: int,
|
||||
video_res_width: int,
|
||||
@ -162,6 +175,7 @@ class WebSocket:
|
||||
self.ws = sync(
|
||||
fps,
|
||||
post_effect,
|
||||
show_grid,
|
||||
unlocked_framerate,
|
||||
video_res_height,
|
||||
video_res_width,
|
||||
|
@ -357,6 +357,7 @@ def test_ws_simple():
|
||||
with modeling_commands_ws.WebSocket(
|
||||
client=client,
|
||||
fps=30,
|
||||
show_grid=False,
|
||||
post_effect=PostEffectType.NOEFFECT,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=360,
|
||||
@ -386,6 +387,7 @@ def test_ws_import():
|
||||
client=client,
|
||||
fps=30,
|
||||
post_effect=PostEffectType.NOEFFECT,
|
||||
show_grid=False,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=360,
|
||||
video_res_width=480,
|
||||
|
@ -6808,6 +6808,7 @@ def test_modeling_commands_ws():
|
||||
client=client,
|
||||
fps=10,
|
||||
post_effect=PostEffectType.PHOSPHOR,
|
||||
show_grid=False,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=10,
|
||||
video_res_width=10,
|
||||
@ -6844,6 +6845,7 @@ async def test_modeling_commands_ws_async():
|
||||
client=client,
|
||||
fps=10,
|
||||
post_effect=PostEffectType.PHOSPHOR,
|
||||
show_grid=False,
|
||||
unlocked_framerate=False,
|
||||
video_res_height=10,
|
||||
video_res_width=10,
|
||||
|
@ -31,6 +31,7 @@ from .async_api_call_type import AsyncApiCallType
|
||||
from .auth_callback import AuthCallback
|
||||
from .axis import Axis
|
||||
from .axis_direction_pair import AxisDirectionPair
|
||||
from .batch_response import BatchResponse
|
||||
from .billing_info import BillingInfo
|
||||
from .block_reason import BlockReason
|
||||
from .cache_metadata import CacheMetadata
|
||||
@ -41,6 +42,7 @@ from .camera_settings import CameraSettings
|
||||
from .card_details import CardDetails
|
||||
from .center_of_mass import CenterOfMass
|
||||
from .client_metrics import ClientMetrics
|
||||
from .close_path import ClosePath
|
||||
from .cluster import Cluster
|
||||
from .code_language import CodeLanguage
|
||||
from .code_output import CodeOutput
|
||||
@ -56,6 +58,7 @@ from .curve_get_type import CurveGetType
|
||||
from .curve_type import CurveType
|
||||
from .customer import Customer
|
||||
from .customer_balance import CustomerBalance
|
||||
from .cut_type import CutType
|
||||
from .default_camera_focus_on import DefaultCameraFocusOn
|
||||
from .default_camera_get_settings import DefaultCameraGetSettings
|
||||
from .default_camera_zoom import DefaultCameraZoom
|
||||
@ -77,6 +80,7 @@ from .entity_get_distance import EntityGetDistance
|
||||
from .entity_get_num_children import EntityGetNumChildren
|
||||
from .entity_get_parent_id import EntityGetParentId
|
||||
from .entity_linear_pattern import EntityLinearPattern
|
||||
from .entity_linear_pattern_transform import EntityLinearPatternTransform
|
||||
from .entity_type import EntityType
|
||||
from .environment import Environment
|
||||
from .error import Error
|
||||
@ -88,6 +92,7 @@ from .extended_user import ExtendedUser
|
||||
from .extended_user_results_page import ExtendedUserResultsPage
|
||||
from .extrusion_face_cap_type import ExtrusionFaceCapType
|
||||
from .extrusion_face_info import ExtrusionFaceInfo
|
||||
from .face_get_center import FaceGetCenter
|
||||
from .face_get_gradient import FaceGetGradient
|
||||
from .face_get_position import FaceGetPosition
|
||||
from .face_is_planar import FaceIsPlanar
|
||||
@ -130,6 +135,7 @@ from .kcl_code_completion_request import KclCodeCompletionRequest
|
||||
from .kcl_code_completion_response import KclCodeCompletionResponse
|
||||
from .leaf_node import LeafNode
|
||||
from .length_unit import LengthUnit
|
||||
from .linear_transform import LinearTransform
|
||||
from .mass import Mass
|
||||
from .meta_cluster_info import MetaClusterInfo
|
||||
from .metadata import Metadata
|
||||
@ -178,6 +184,7 @@ from .plane_intersect_and_project import PlaneIntersectAndProject
|
||||
from .ply_storage import PlyStorage
|
||||
from .point2d import Point2d
|
||||
from .point3d import Point3d
|
||||
from .point4d import Point4d
|
||||
from .pong import Pong
|
||||
from .post_effect_type import PostEffectType
|
||||
from .privacy_settings import PrivacySettings
|
||||
@ -251,6 +258,7 @@ from .user_org_role import UserOrgRole
|
||||
from .user_results_page import UserResultsPage
|
||||
from .uuid import Uuid
|
||||
from .verification_token_response import VerificationTokenResponse
|
||||
from .view_isometric import ViewIsometric
|
||||
from .volume import Volume
|
||||
from .web_socket_request import WebSocketRequest
|
||||
from .web_socket_response import WebSocketResponse
|
||||
@ -259,3 +267,4 @@ from .zoo_product_subscriptions import ZooProductSubscriptions
|
||||
from .zoo_product_subscriptions_org_request import ZooProductSubscriptionsOrgRequest
|
||||
from .zoo_product_subscriptions_user_request import ZooProductSubscriptionsUserRequest
|
||||
from .zoo_tool import ZooTool
|
||||
from .zoom_to_fit import ZoomToFit
|
||||
|
24
kittycad/models/batch_response.py
Normal file
24
kittycad/models/batch_response.py
Normal file
@ -0,0 +1,24 @@
|
||||
from typing import Union
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, RootModel
|
||||
|
||||
|
||||
|
||||
class response(BaseModel):
|
||||
"""Response to the modeling command."""
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class errors(BaseModel):
|
||||
"""Errors that occurred during the modeling command."""
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
BatchResponse = RootModel[
|
||||
Union[
|
||||
response,
|
||||
errors,
|
||||
]
|
||||
]
|
@ -3,6 +3,7 @@ from typing import Optional
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
from ..models.point4d import Point4d
|
||||
|
||||
|
||||
class CameraSettings(BaseModel):
|
||||
@ -12,6 +13,8 @@ class CameraSettings(BaseModel):
|
||||
|
||||
fov_y: Optional[float] = None
|
||||
|
||||
orientation: Point4d
|
||||
|
||||
ortho: bool
|
||||
|
||||
ortho_scale: Optional[float] = None
|
||||
|
11
kittycad/models/close_path.py
Normal file
11
kittycad/models/close_path.py
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
class ClosePath(BaseModel):
|
||||
"""The response from the `ClosePath` command."""
|
||||
|
||||
face_id: str
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
13
kittycad/models/cut_type.py
Normal file
13
kittycad/models/cut_type.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class CutType(str, Enum):
|
||||
"""What kind of cut to do""" # noqa: E501
|
||||
|
||||
"""# Round off an edge. """ # noqa: E501
|
||||
FILLET = "fillet"
|
||||
"""# Cut away an edge. """ # noqa: E501
|
||||
CHAMFER = "chamfer"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
12
kittycad/models/entity_linear_pattern_transform.py
Normal file
12
kittycad/models/entity_linear_pattern_transform.py
Normal file
@ -0,0 +1,12 @@
|
||||
from typing import List
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
class EntityLinearPatternTransform(BaseModel):
|
||||
"""The response from the `EntityLinearPatternTransform` command."""
|
||||
|
||||
entity_ids: List[str]
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -10,6 +10,10 @@ class ErrorCode(str, Enum):
|
||||
INTERNAL_API = "internal_api"
|
||||
"""# User requested something geometrically or graphically impossible. Don't retry this request, as it's inherently impossible. Instead, read the error message and change your request. """ # noqa: E501
|
||||
BAD_REQUEST = "bad_request"
|
||||
"""# Auth token is missing from the request """ # noqa: E501
|
||||
AUTH_TOKEN_MISSING = "auth_token_missing"
|
||||
"""# Auth token is invalid in some way (expired, incorrect format, etc) """ # noqa: E501
|
||||
AUTH_TOKEN_INVALID = "auth_token_invalid"
|
||||
"""# Client sent invalid JSON. """ # noqa: E501
|
||||
INVALID_JSON = "invalid_json"
|
||||
"""# Client sent invalid BSON. """ # noqa: E501
|
||||
|
12
kittycad/models/face_get_center.py
Normal file
12
kittycad/models/face_get_center.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
|
||||
|
||||
class FaceGetCenter(BaseModel):
|
||||
"""The 3D center of mass on the surface"""
|
||||
|
||||
pos: Point3d
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -7,6 +7,8 @@ from ..models.point3d import Point3d
|
||||
class GetSketchModePlane(BaseModel):
|
||||
"""The plane for sketch mode."""
|
||||
|
||||
origin: Point3d
|
||||
|
||||
x_axis: Point3d
|
||||
|
||||
y_axis: Point3d
|
||||
|
17
kittycad/models/linear_transform.py
Normal file
17
kittycad/models/linear_transform.py
Normal file
@ -0,0 +1,17 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.point3d import Point3d
|
||||
|
||||
|
||||
class LinearTransform(BaseModel):
|
||||
"""Ways to transform each solid being replicated in a repeating pattern."""
|
||||
|
||||
replicate: Optional[bool] = None
|
||||
|
||||
scale: Optional[Point3d] = None
|
||||
|
||||
translate: Optional[Point3d] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -8,12 +8,14 @@ from ..models.annotation_options import AnnotationOptions
|
||||
from ..models.annotation_type import AnnotationType
|
||||
from ..models.camera_drag_interaction_type import CameraDragInteractionType
|
||||
from ..models.color import Color
|
||||
from ..models.cut_type import CutType
|
||||
from ..models.distance_type import DistanceType
|
||||
from ..models.entity_type import EntityType
|
||||
from ..models.image_format import ImageFormat
|
||||
from ..models.import_file import ImportFile
|
||||
from ..models.input_format import InputFormat
|
||||
from ..models.length_unit import LengthUnit
|
||||
from ..models.linear_transform import LinearTransform
|
||||
from ..models.modeling_cmd_id import ModelingCmdId
|
||||
from ..models.output_format import OutputFormat
|
||||
from ..models.path_component_constraint_bound import PathComponentConstraintBound
|
||||
@ -97,6 +99,20 @@ class revolve(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class solid3d_shell_face(BaseModel):
|
||||
"""Command for revolving a solid 2d."""
|
||||
|
||||
face_ids: List[str]
|
||||
|
||||
object_id: str
|
||||
|
||||
shell_thickness: LengthUnit
|
||||
|
||||
type: Literal["solid3d_shell_face"] = "solid3d_shell_face"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class revolve_about_edge(BaseModel):
|
||||
"""Command for revolving a solid 2d about a brep edge"""
|
||||
|
||||
@ -190,7 +206,7 @@ class default_camera_perspective_settings(BaseModel):
|
||||
|
||||
center: Point3d
|
||||
|
||||
fov_y: float
|
||||
fov_y: Optional[float] = None
|
||||
|
||||
sequence: Optional[int] = None
|
||||
|
||||
@ -202,9 +218,9 @@ class default_camera_perspective_settings(BaseModel):
|
||||
|
||||
vantage: Point3d
|
||||
|
||||
z_far: float
|
||||
z_far: Optional[float] = None
|
||||
|
||||
z_near: float
|
||||
z_near: Optional[float] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
@ -219,38 +235,6 @@ class default_camera_zoom(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class default_camera_enable_sketch_mode(BaseModel):
|
||||
"""Enable sketch mode, where users can sketch 2D geometry. Users choose a plane to sketch on."""
|
||||
|
||||
animated: bool
|
||||
|
||||
distance_to_plane: float
|
||||
|
||||
origin: Point3d
|
||||
|
||||
ortho: bool
|
||||
|
||||
type: Literal["default_camera_enable_sketch_mode"] = (
|
||||
"default_camera_enable_sketch_mode"
|
||||
)
|
||||
|
||||
x_axis: Point3d
|
||||
|
||||
y_axis: Point3d
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class default_camera_disable_sketch_mode(BaseModel):
|
||||
"""Disable sketch mode, from the default camera."""
|
||||
|
||||
type: Literal["default_camera_disable_sketch_mode"] = (
|
||||
"default_camera_disable_sketch_mode"
|
||||
)
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class export(BaseModel):
|
||||
"""Export the scene to a file."""
|
||||
|
||||
@ -319,6 +303,18 @@ class entity_get_distance(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class entity_linear_pattern_transform(BaseModel):
|
||||
"""Create a linear pattern using this entity."""
|
||||
|
||||
entity_id: str
|
||||
|
||||
transform: List[LinearTransform]
|
||||
|
||||
type: Literal["entity_linear_pattern_transform"] = "entity_linear_pattern_transform"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class entity_linear_pattern(BaseModel):
|
||||
"""Create a linear pattern using this entity."""
|
||||
|
||||
@ -373,6 +369,20 @@ class entity_make_helix(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class entity_mirror(BaseModel):
|
||||
"""Mirror the input entities over the specified axis. (Currently only supports sketches)"""
|
||||
|
||||
axis: Point3d
|
||||
|
||||
ids: List[str]
|
||||
|
||||
point: Point3d
|
||||
|
||||
type: Literal["entity_mirror"] = "entity_mirror"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class edit_mode_enter(BaseModel):
|
||||
"""Enter edit mode"""
|
||||
|
||||
@ -481,6 +491,16 @@ class update_annotation(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class edge_lines_visible(BaseModel):
|
||||
"""Changes visibility of scene-wide edge lines on brep solids"""
|
||||
|
||||
hidden: bool
|
||||
|
||||
type: Literal["edge_lines_visible"] = "edge_lines_visible"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class object_visible(BaseModel):
|
||||
"""Hide or show an object"""
|
||||
|
||||
@ -614,6 +634,8 @@ class solid3d_get_prev_adjacent_edge(BaseModel):
|
||||
class solid3d_fillet_edge(BaseModel):
|
||||
"""Fillets the given edge with the specified radius."""
|
||||
|
||||
cut_type: Optional[CutType] = None
|
||||
|
||||
edge_id: str
|
||||
|
||||
object_id: str
|
||||
@ -649,6 +671,16 @@ class face_get_position(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class face_get_center(BaseModel):
|
||||
"""Obtains the surface \"center of mass\" """
|
||||
|
||||
object_id: str
|
||||
|
||||
type: Literal["face_get_center"] = "face_get_center"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class face_get_gradient(BaseModel):
|
||||
"""Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v"""
|
||||
|
||||
@ -763,22 +795,6 @@ class mouse_click(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class sketch_mode_enable(BaseModel):
|
||||
"""Enable sketch mode on the given plane. If you want to sketch on a face, use `enable_sketch_mode` instead."""
|
||||
|
||||
animated: bool
|
||||
|
||||
disable_camera_with_plane: Optional[Point3d] = None
|
||||
|
||||
ortho: bool
|
||||
|
||||
plane_id: str
|
||||
|
||||
type: Literal["sketch_mode_enable"] = "sketch_mode_enable"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class sketch_mode_disable(BaseModel):
|
||||
"""Disable sketch mode. If you are sketching on a face, be sure to not disable sketch mode until you have extruded. Otherwise, your object will not be fused with the face."""
|
||||
|
||||
@ -820,6 +836,8 @@ class enable_sketch_mode(BaseModel):
|
||||
|
||||
ortho: bool
|
||||
|
||||
planar_normal: Optional[Point3d] = None
|
||||
|
||||
type: Literal["enable_sketch_mode"] = "enable_sketch_mode"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
@ -1147,6 +1165,28 @@ class default_camera_set_perspective(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class zoom_to_fit(BaseModel):
|
||||
"""Fit the view to the specified object(s)."""
|
||||
|
||||
object_ids: Optional[List[str]] = None
|
||||
|
||||
padding: float
|
||||
|
||||
type: Literal["zoom_to_fit"] = "zoom_to_fit"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class view_isometric(BaseModel):
|
||||
"""Fit the view to the scene with an isometric view."""
|
||||
|
||||
padding: Optional[float] = None
|
||||
|
||||
type: Literal["view_isometric"] = "view_isometric"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class solid3d_get_extrusion_face_info(BaseModel):
|
||||
"""Get a concise description of all of an extrusion's faces."""
|
||||
|
||||
@ -1199,6 +1239,7 @@ ModelingCmd = RootModel[
|
||||
extend_path,
|
||||
extrude,
|
||||
revolve,
|
||||
solid3d_shell_face,
|
||||
revolve_about_edge,
|
||||
close_path,
|
||||
camera_drag_start,
|
||||
@ -1208,17 +1249,17 @@ ModelingCmd = RootModel[
|
||||
default_camera_look_at,
|
||||
default_camera_perspective_settings,
|
||||
default_camera_zoom,
|
||||
default_camera_enable_sketch_mode,
|
||||
default_camera_disable_sketch_mode,
|
||||
export,
|
||||
entity_get_parent_id,
|
||||
entity_get_num_children,
|
||||
entity_get_child_uuid,
|
||||
entity_get_all_child_uuids,
|
||||
entity_get_distance,
|
||||
entity_linear_pattern_transform,
|
||||
entity_linear_pattern,
|
||||
entity_circular_pattern,
|
||||
entity_make_helix,
|
||||
entity_mirror,
|
||||
edit_mode_enter,
|
||||
select_with_point,
|
||||
select_add,
|
||||
@ -1229,6 +1270,7 @@ ModelingCmd = RootModel[
|
||||
highlight_set_entities,
|
||||
new_annotation,
|
||||
update_annotation,
|
||||
edge_lines_visible,
|
||||
object_visible,
|
||||
object_bring_to_front,
|
||||
object_set_material_params_pbr,
|
||||
@ -1242,6 +1284,7 @@ ModelingCmd = RootModel[
|
||||
solid3d_fillet_edge,
|
||||
face_is_planar,
|
||||
face_get_position,
|
||||
face_get_center,
|
||||
face_get_gradient,
|
||||
send_object,
|
||||
entity_set_opacity,
|
||||
@ -1251,7 +1294,6 @@ ModelingCmd = RootModel[
|
||||
set_tool,
|
||||
mouse_move,
|
||||
mouse_click,
|
||||
sketch_mode_enable,
|
||||
sketch_mode_disable,
|
||||
get_sketch_mode_plane,
|
||||
curve_set_constraint,
|
||||
@ -1285,6 +1327,8 @@ ModelingCmd = RootModel[
|
||||
set_selection_filter,
|
||||
default_camera_set_orthographic,
|
||||
default_camera_set_perspective,
|
||||
zoom_to_fit,
|
||||
view_isometric,
|
||||
solid3d_get_extrusion_face_info,
|
||||
edit_mode_exit,
|
||||
select_clear,
|
||||
|
@ -6,6 +6,7 @@ from typing_extensions import Annotated
|
||||
from ..models.camera_drag_end import CameraDragEnd
|
||||
from ..models.camera_drag_move import CameraDragMove
|
||||
from ..models.center_of_mass import CenterOfMass
|
||||
from ..models.close_path import ClosePath
|
||||
from ..models.curve_get_control_points import CurveGetControlPoints
|
||||
from ..models.curve_get_end_points import CurveGetEndPoints
|
||||
from ..models.curve_get_type import CurveGetType
|
||||
@ -20,8 +21,10 @@ from ..models.entity_get_distance import EntityGetDistance
|
||||
from ..models.entity_get_num_children import EntityGetNumChildren
|
||||
from ..models.entity_get_parent_id import EntityGetParentId
|
||||
from ..models.entity_linear_pattern import EntityLinearPattern
|
||||
from ..models.entity_linear_pattern_transform import EntityLinearPatternTransform
|
||||
from ..models.export import Export
|
||||
from ..models.extrusion_face_info import ExtrusionFaceInfo
|
||||
from ..models.face_get_center import FaceGetCenter
|
||||
from ..models.face_get_gradient import FaceGetGradient
|
||||
from ..models.face_get_position import FaceGetPosition
|
||||
from ..models.face_is_planar import FaceIsPlanar
|
||||
@ -48,7 +51,9 @@ from ..models.solid3d_get_opposite_edge import Solid3dGetOppositeEdge
|
||||
from ..models.solid3d_get_prev_adjacent_edge import Solid3dGetPrevAdjacentEdge
|
||||
from ..models.surface_area import SurfaceArea
|
||||
from ..models.take_snapshot import TakeSnapshot
|
||||
from ..models.view_isometric import ViewIsometric
|
||||
from ..models.volume import Volume
|
||||
from ..models.zoom_to_fit import ZoomToFit
|
||||
|
||||
|
||||
class empty(BaseModel):
|
||||
@ -129,6 +134,16 @@ class entity_get_all_child_uuids(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class close_path(BaseModel):
|
||||
"""The response to the 'ClosePath' endpoint"""
|
||||
|
||||
data: ClosePath
|
||||
|
||||
type: Literal["close_path"] = "close_path"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class camera_drag_move(BaseModel):
|
||||
"""The response to the 'CameraDragMove' endpoint"""
|
||||
|
||||
@ -169,6 +184,26 @@ class default_camera_zoom(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class zoom_to_fit(BaseModel):
|
||||
"""The response to the 'ZoomToFit' endpoint"""
|
||||
|
||||
data: ZoomToFit
|
||||
|
||||
type: Literal["zoom_to_fit"] = "zoom_to_fit"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class view_isometric(BaseModel):
|
||||
"""The response to the 'ViewIsometric' endpoint"""
|
||||
|
||||
data: ViewIsometric
|
||||
|
||||
type: Literal["view_isometric"] = "view_isometric"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class get_num_objects(BaseModel):
|
||||
"""The response to the 'GetNumObjects' endpoint"""
|
||||
|
||||
@ -371,6 +406,16 @@ class face_get_position(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class face_get_center(BaseModel):
|
||||
"""The response to the 'FaceGetCenter' endpoint"""
|
||||
|
||||
data: FaceGetCenter
|
||||
|
||||
type: Literal["face_get_center"] = "face_get_center"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class face_get_gradient(BaseModel):
|
||||
"""The response to the 'FaceGetGradient' endpoint"""
|
||||
|
||||
@ -481,6 +526,16 @@ class entity_get_distance(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class entity_linear_pattern_transform(BaseModel):
|
||||
"""The response to the 'EntityLinearPatternTransform' endpoint"""
|
||||
|
||||
data: EntityLinearPatternTransform
|
||||
|
||||
type: Literal["entity_linear_pattern_transform"] = "entity_linear_pattern_transform"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class entity_linear_pattern(BaseModel):
|
||||
"""The response to the 'EntityLinearPattern' endpoint"""
|
||||
|
||||
@ -532,10 +587,13 @@ OkModelingCmdResponse = RootModel[
|
||||
entity_get_num_children,
|
||||
entity_get_parent_id,
|
||||
entity_get_all_child_uuids,
|
||||
close_path,
|
||||
camera_drag_move,
|
||||
camera_drag_end,
|
||||
default_camera_get_settings,
|
||||
default_camera_zoom,
|
||||
zoom_to_fit,
|
||||
view_isometric,
|
||||
get_num_objects,
|
||||
default_camera_focus_on,
|
||||
select_get,
|
||||
@ -556,6 +614,7 @@ OkModelingCmdResponse = RootModel[
|
||||
curve_get_end_points,
|
||||
face_is_planar,
|
||||
face_get_position,
|
||||
face_get_center,
|
||||
face_get_gradient,
|
||||
plane_intersect_and_project,
|
||||
import_files,
|
||||
@ -567,6 +626,7 @@ OkModelingCmdResponse = RootModel[
|
||||
center_of_mass,
|
||||
get_sketch_mode_plane,
|
||||
entity_get_distance,
|
||||
entity_linear_pattern_transform,
|
||||
entity_linear_pattern,
|
||||
entity_circular_pattern,
|
||||
solid3d_get_extrusion_face_info,
|
||||
|
@ -1,8 +1,9 @@
|
||||
from typing import List, Literal, Union
|
||||
from typing import Dict, List, Literal, Union
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
||||
from typing_extensions import Annotated
|
||||
|
||||
from ..models.batch_response import BatchResponse
|
||||
from ..models.ice_server import IceServer
|
||||
from ..models.ok_modeling_cmd_response import OkModelingCmdResponse
|
||||
from ..models.raw_file import RawFile
|
||||
@ -82,6 +83,24 @@ class modeling(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class ModelingBatchData(BaseModel):
|
||||
""""""
|
||||
|
||||
responses: Dict[str, BatchResponse]
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class modeling_batch(BaseModel):
|
||||
"""Response to a ModelingBatch."""
|
||||
|
||||
data: ModelingBatchData
|
||||
|
||||
type: Literal["modeling_batch"] = "modeling_batch"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class ExportData(BaseModel):
|
||||
""""""
|
||||
|
||||
@ -139,6 +158,7 @@ OkWebSocketResponseData = RootModel[
|
||||
trickle_ice,
|
||||
sdp_answer,
|
||||
modeling,
|
||||
modeling_batch,
|
||||
export,
|
||||
metrics_request,
|
||||
pong,
|
||||
|
@ -22,7 +22,7 @@ class line(BaseModel):
|
||||
|
||||
|
||||
class arc(BaseModel):
|
||||
"""A circular arc segment."""
|
||||
"""A circular arc segment. Arcs can be drawn clockwise when start > end."""
|
||||
|
||||
center: Point2d
|
||||
|
||||
@ -68,7 +68,7 @@ class tangential_arc(BaseModel):
|
||||
|
||||
|
||||
class tangential_arc_to(BaseModel):
|
||||
"""Adds a tangent arc from current pen position to the new position."""
|
||||
"""Adds a tangent arc from current pen position to the new position. Arcs will choose a clockwise or counter-clockwise direction based on the arc end position."""
|
||||
|
||||
angle_snap_increment: Optional[Angle] = None
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
@ -6,10 +7,10 @@ from pydantic import BaseModel, ConfigDict
|
||||
class PerspectiveCameraParameters(BaseModel):
|
||||
"""Defines a perspective view."""
|
||||
|
||||
fov_y: float
|
||||
fov_y: Optional[float] = None
|
||||
|
||||
z_far: float
|
||||
z_far: Optional[float] = None
|
||||
|
||||
z_near: float
|
||||
z_near: Optional[float] = None
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
17
kittycad/models/point4d.py
Normal file
17
kittycad/models/point4d.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
|
||||
class Point4d(BaseModel):
|
||||
"""A point in homogeneous (4D) space"""
|
||||
|
||||
w: float
|
||||
|
||||
x: float
|
||||
|
||||
y: float
|
||||
|
||||
z: float
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -2,6 +2,7 @@ import datetime
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.uuid import Uuid
|
||||
|
||||
|
||||
class Session(BaseModel):
|
||||
@ -9,12 +10,14 @@ class Session(BaseModel):
|
||||
|
||||
created_at: datetime.datetime
|
||||
|
||||
expires_at: datetime.datetime
|
||||
expires: datetime.datetime
|
||||
|
||||
token: str
|
||||
id: Uuid
|
||||
|
||||
session_token: Uuid
|
||||
|
||||
updated_at: datetime.datetime
|
||||
|
||||
user_id: str
|
||||
user_id: Uuid
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
12
kittycad/models/view_isometric.py
Normal file
12
kittycad/models/view_isometric.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.camera_settings import CameraSettings
|
||||
|
||||
|
||||
class ViewIsometric(BaseModel):
|
||||
"""The response from the `ViewIsometric` command."""
|
||||
|
||||
settings: CameraSettings
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -1,4 +1,4 @@
|
||||
from typing import List, Literal, Optional, Union
|
||||
from typing import Dict, List, Literal, Optional, Union
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, RootModel
|
||||
from typing_extensions import Annotated
|
||||
@ -75,6 +75,16 @@ class metrics_response(BaseModel):
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
class headers(BaseModel):
|
||||
"""Authentication header request."""
|
||||
|
||||
headers: Dict[str, str]
|
||||
|
||||
type: Literal["headers"] = "headers"
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
||||
|
||||
|
||||
WebSocketRequest = RootModel[
|
||||
Annotated[
|
||||
Union[
|
||||
@ -84,6 +94,7 @@ WebSocketRequest = RootModel[
|
||||
modeling_cmd_batch_req,
|
||||
ping,
|
||||
metrics_response,
|
||||
headers,
|
||||
],
|
||||
Field(discriminator="type"),
|
||||
]
|
||||
|
12
kittycad/models/zoom_to_fit.py
Normal file
12
kittycad/models/zoom_to_fit.py
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
from ..models.camera_settings import CameraSettings
|
||||
|
||||
|
||||
class ZoomToFit(BaseModel):
|
||||
"""The response from the `ZoomToFit` command."""
|
||||
|
||||
settings: CameraSettings
|
||||
|
||||
model_config = ConfigDict(protected_namespaces=())
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "kittycad"
|
||||
version = "0.6.11"
|
||||
version = "0.6.16"
|
||||
description = "A client library for accessing KittyCAD"
|
||||
|
||||
authors = []
|
||||
|
Reference in New Issue
Block a user