Skip to content

Commit

Permalink
bump rust libs (#334)
Browse files Browse the repository at this point in the history
* bump rust libs

Signed-off-by: Jess Frazelle <[email protected]>

* updates

Signed-off-by: Jess Frazelle <[email protected]>

* updates

Signed-off-by: Jess Frazelle <[email protected]>

* updates

Signed-off-by: Jess Frazelle <[email protected]>

* fixes

Signed-off-by: Jess Frazelle <[email protected]>

---------

Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz authored Oct 1, 2024
1 parent 6f20fd5 commit f355b12
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 267 deletions.
18 changes: 9 additions & 9 deletions tutorials/websocket_tutorial/3_sample.py.part
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ from kittycad.models import (
ModelingCmdId,
WebSocketRequest,
)
from kittycad.models.path_segment import PathSegment, line
from kittycad.models.path_segment import PathSegment, OptionLine
from kittycad.models.modeling_cmd import (
default_camera_look_at,
start_path,
take_snapshot,
extend_path,
move_path_pen,
extrude,
close_path,
OptionDefaultCameraLookAt,
OptionStartPath,
OptionTakeSnapshot,
OptionExtendPath,
OptionMovePathPen,
OptionExtrude,
OptionClosePath,
)
from kittycad.models.web_socket_request import modeling_cmd_req
from kittycad.models.web_socket_request import OptionModelingCmdReq
40 changes: 20 additions & 20 deletions tutorials/websocket_tutorial/6_sample.py.part
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,70 @@

# Move the pen to the bottom left corner.
websocket.send(WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
move_path_pen(
path=str(sketch_path_id),
OptionMovePathPen(
path=str(sketch_path_id),
to={
"x": -5,
"y": -5,
"z": 0,
}
)
),
),
cmd_id=ModelingCmdId(uuid.uuid4())))) # Create a new UUID for this command.

# The next three websocket.send blocks are drawing the line to the right, up, and then to the left.
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,
"z": 0,
},
relative=True, # This means that the line is relative to the current position of the pen.
)
)),
cmd_id=ModelingCmdId(uuid.uuid4())
)),
cmd_id=ModelingCmdId(uuid.uuid4())
)
))

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,
"z": 0,
},
relative=True,
)
)),
)),
cmd_id=ModelingCmdId(uuid.uuid4())
)
))

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,
"z": 0,
},
relative=True,
)
)),
)),
cmd_id=ModelingCmdId(uuid.uuid4())
)
))
Expand All @@ -74,10 +74,10 @@

# Close the sketch
websocket.send(WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
close_path(
path_id=ModelingCmdId(sketch_path_id) # Notice that we need to provide the sketch path UUID we created in the beginning.
OptionClosePath(
path_id=ModelingCmdId(sketch_path_id) # Notice that we need to provide the sketch path UUID we created in the beginning.
)
),
cmd_id=ModelingCmdId(uuid.uuid4())
Expand Down
6 changes: 3 additions & 3 deletions tutorials/websocket_tutorial/7_sample.py.part
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

# Extrude the sketch.
websocket.send(WebSocketRequest(
modeling_cmd_req(
OptionModelingCmdReq(
cmd=ModelingCmd(
extrude(
OptionExtrude(
cap=True,
distance=10,
target=ModelingCmdId(sketch_path_id),
)
),
),
cmd_id=ModelingCmdId(uuid.uuid4())
)
))
8 changes: 4 additions & 4 deletions tutorials/websocket_tutorial/9_sample.py.part
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Orient the camera.
websocket.send(WebSocketRequest(
modeling_cmd_req(
cmd=ModelingCmd(default_camera_look_at(
OptionModelingCmdReq(
cmd=ModelingCmd(OptionDefaultCameraLookAt(
center = {"x": 0, "y": 0, "z": 0},
up = {"x": 0, "y": 0, "z": 1},
vantage = {"x": 20, "y": 20, "z": 20},
Expand All @@ -14,8 +14,8 @@

# 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())
)
))
Loading

0 comments on commit f355b12

Please sign in to comment.