Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump kittycad from 0.6.21 to 0.6.24 #329

Merged
merged 13 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.18]
test-path:
Expand Down Expand Up @@ -70,6 +71,7 @@ jobs:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
test-path:
Expand Down Expand Up @@ -119,6 +121,7 @@ jobs:
build-test-js-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20]
test-path:
Expand Down Expand Up @@ -152,6 +155,7 @@ jobs:
build-test-rs-versions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test-path:
- ./tutorials/websocket_tutorial/draw_cube_rust
Expand Down Expand Up @@ -181,6 +185,7 @@ jobs:
needs: [build-test-python-versions]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: |
pip install isort ruff black
isort . */*/*.py
black . */*/*.py
ruff format
ruff check --fix . */*/*.py

- name: Check for modified files
Expand All @@ -41,5 +41,5 @@ jobs:
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch origin
git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!"
git push origin ${{github.event.pull_request.head.ref }}
git commit -am "LOOK ON MY REFORMAT, YE MIGHTY, AND DESPAIR!" || true
git push origin ${{github.event.pull_request.head.ref }} || true
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
kittycad==0.6.21
kittycad==0.7.0
2 changes: 1 addition & 1 deletion samples/convert_file/convert_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
output_file_path = "./output.stl"
print(f"Saving output to {output_file_path}")
output_file = open(output_file_path, "wb")
output_file.write(output.get_decoded())
output_file.write(output)
output_file.close()
2 changes: 1 addition & 1 deletion tutorials/beginner_tutorial/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def convertOBJtoSTL():
output_file_path = "./dodecahedron.stl"
print(f"Saving output to {output_file_path}")
output_file = open(output_file_path, "wb")
output_file.write(output.get_decoded())
output_file.write(output)
output_file.close()
return body

Expand Down
2 changes: 1 addition & 1 deletion tutorials/conversion_obj_step/conversion_obj_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@
output_file_path = "./output.step"
print(f"Saving output to {output_file_path}")
output_file = open(output_file_path, "wb")
output_file.write(output.get_decoded())
output_file.write(output)
output_file.close()
2 changes: 1 addition & 1 deletion tutorials/conversion_obj_step/output.step
Git LFS file not shown
2 changes: 1 addition & 1 deletion tutorials/conversion_obj_stl/conversion_obj_stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@
output_file_path = "./output.stl"
print(f"Saving output to {output_file_path}")
output_file = open(output_file_path, "wb")
output_file.write(output.get_decoded())
output_file.write(output)
output_file.close()
2 changes: 1 addition & 1 deletion tutorials/getting_started/getting_started.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@
output_file_path = "./output.stl"
print(f"Saving output to {output_file_path}")
output_file = open(output_file_path, "wb")
output_file.write(output.get_decoded())
output_file.write(output)
output_file.close()
26 changes: 13 additions & 13 deletions tutorials/import_file/import_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
UnitLength,
WebSocketRequest,
)
from kittycad.models.input_format import obj
from kittycad.models.input_format import OptionObj
from kittycad.models.modeling_cmd import (
default_camera_focus_on,
import_files,
take_snapshot,
OptionDefaultCameraFocusOn,
OptionImportFiles,
OptionTakeSnapshot,
)
from kittycad.models.web_socket_request import modeling_cmd_req
from kittycad.models.web_socket_request import OptionModelingCmdReq


def test_ws_import():
Expand All @@ -49,12 +49,12 @@ def test_ws_import():
ImportFile(data=content, path=file_name)
# form the request
req = WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
import_files(
OptionImportFiles(
files=[ImportFile(data=content, path=file_name)],
format=InputFormat(
obj(
OptionObj(
units=UnitLength.M,
coords=System(
forward=AxisDirectionPair(
Expand Down Expand Up @@ -103,8 +103,8 @@ def test_ws_import():
cmd_id = uuid.uuid4()
# form the request
req = WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(default_camera_focus_on(uuid=object_id)),
OptionModelingCmdReq(
cmd=ModelingCmd(OptionDefaultCameraFocusOn(uuid=object_id)),
cmd_id=ModelingCmdId(cmd_id),
)
)
Expand All @@ -127,8 +127,8 @@ def test_ws_import():
cmd_id = uuid.uuid4()
# form the request
req = WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(take_snapshot(format=ImageFormat.PNG)),
OptionModelingCmdReq(
cmd=ModelingCmd(OptionTakeSnapshot(format=ImageFormat.PNG)),
cmd_id=ModelingCmdId(cmd_id),
)
)
Expand All @@ -154,7 +154,7 @@ def test_ws_import():
# Break since now we know it was a success.
png_contents = message_dict["resp"]["data"]["modeling_response"][
"data"
]["contents"].get_decoded()
]["contents"]
break

# Save the contents to a file.
Expand Down
2 changes: 1 addition & 1 deletion tutorials/text-to-cad/text-to-cad.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@
# Save the STEP data as text-to-cad-output.step
final_result = response.outputs["source.step"]
with open("text-to-cad-output.step", "w", encoding="utf-8") as output_file:
output_file.write(final_result.get_decoded().decode("utf-8"))
output_file.write(final_result.decode("utf-8"))
print(f"Saved output to {output_file.name}")
2 changes: 1 addition & 1 deletion tutorials/websocket_tutorial/10_sample.py.part
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
):
png_contents = message_dict["resp"]["data"]["modeling_response"][
"data"
]["contents"].get_decoded()
]["contents"]
break

# Save the contents to a file.
Expand Down
1 change: 0 additions & 1 deletion tutorials/websocket_tutorial/draw_cube_rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ async fn draw_cube(
write_to_ws
.send(to_msg(
ModelingCmd::Extrude {
cap: true,
distance: width * 2.0,
target: path_id,
},
Expand Down
67 changes: 35 additions & 32 deletions tutorials/websocket_tutorial/websocketexample.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
from kittycad.client import ClientFromEnv
from kittycad.models import ImageFormat, ModelingCmd, ModelingCmdId, WebSocketRequest
from kittycad.models.modeling_cmd import (
close_path,
default_camera_look_at,
extend_path,
extrude,
move_path_pen,
start_path,
take_snapshot,
OptionClosePath,
OptionDefaultCameraLookAt,
OptionExtendPath,
OptionExtrude,
OptionMovePathPen,
OptionStartPath,
OptionTakeSnapshot,
)
from kittycad.models.path_segment import line
from kittycad.models.web_socket_request import modeling_cmd_req
from kittycad.models.path_segment import OptionLine
from kittycad.models.web_socket_request import OptionModelingCmdReq


def make_cube():
Expand All @@ -41,17 +41,18 @@ def make_cube():
# Start the Path
websocket.send(
WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(start_path()), cmd_id=ModelingCmdId(sketch_path_id)
OptionModelingCmdReq(
cmd=ModelingCmd(OptionStartPath()),
cmd_id=ModelingCmdId(sketch_path_id),
),
)
)

websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
move_path_pen(
OptionMovePathPen(
path=str(sketch_path_id),
to={
"x": -5,
Expand All @@ -67,11 +68,11 @@ def make_cube():

websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
extend_path(
OptionExtendPath(
path=str(sketch_path_id),
segment=line(
segment=OptionLine(
end={
"x": 10,
"y": 0,
Expand All @@ -88,11 +89,11 @@ def make_cube():

websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
extend_path(
OptionExtendPath(
path=str(sketch_path_id),
segment=line(
segment=OptionLine(
end={
"x": 0,
"y": 10,
Expand All @@ -109,11 +110,11 @@ def make_cube():

websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
extend_path(
OptionExtendPath(
path=str(sketch_path_id),
segment=line(
segment=OptionLine(
end={
"x": -10,
"y": 0,
Expand All @@ -131,19 +132,21 @@ def make_cube():
# Close the sketch
websocket.send(
WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(close_path(path_id=ModelingCmdId(sketch_path_id))),
OptionModelingCmdReq(
cmd=ModelingCmd(
OptionClosePath(path_id=ModelingCmdId(sketch_path_id))
),
cmd_id=ModelingCmdId(uuid.uuid4()),
)
)
)

# Extrude the square into a cube
# OptionExtrude the square into a cube
websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
extrude(
OptionExtrude(
cap=True,
distance=10,
target=ModelingCmdId(sketch_path_id),
Expand All @@ -163,9 +166,9 @@ def make_cube():
# Orient the camera.
websocket.send(
WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
default_camera_look_at(
OptionDefaultCameraLookAt(
center={"x": 0, "y": 0, "z": 0},
up={"x": 0, "y": 0, "z": 1},
vantage={"x": 20, "y": 20, "z": 20},
Expand All @@ -179,8 +182,8 @@ def make_cube():
# Take a snapshot.
websocket.send(
WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(take_snapshot(format=ImageFormat.PNG)),
OptionModelingCmdReq(
cmd=ModelingCmd(OptionTakeSnapshot(format=ImageFormat.PNG)),
cmd_id=ModelingCmdId(uuid.uuid4()),
)
)
Expand All @@ -196,7 +199,7 @@ def make_cube():
):
png_contents = message_dict["resp"]["data"]["modeling_response"][
"data"
]["contents"].get_decoded()
]["contents"]
break

# Save the contents to a file.
Expand Down