Skip to content

Commit 9bb9fc5

Browse files
Merge branch 'feat/pull_commands' of https://github.com/ansys/pyansys-geometry into feat/pull_commands
2 parents 1122fe4 + 79847de commit 9bb9fc5

File tree

8 files changed

+24
-20
lines changed

8 files changed

+24
-20
lines changed

doc/changelog.d/2241.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Pull commands pt. 1

src/ansys/geometry/core/_grpc/_services/base/curves.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def __init__(self, channel: grpc.Channel):
4242
@abstractmethod
4343
def revolve_edges(self, **kwargs) -> dict:
4444
"""Revolve edges around an axis to create a surface of revolution."""
45-
pass
45+
pass

src/ansys/geometry/core/_grpc/_services/v0/curves.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from ansys.geometry.core.errors import protect_grpc
2727

28-
from ..base.conversions import from_measurement_to_server_angle, from_measurement_to_server_length
28+
from ..base.conversions import from_measurement_to_server_angle
2929
from ..base.curves import GRPCCurvesService
3030
from .conversions import from_line_to_grpc_line, from_trimmed_curve_to_grpc_trimmed_curve
3131

src/ansys/geometry/core/_grpc/_services/v0/faces.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,14 @@ def offset_faces(self, **kwargs) -> dict: # noqa: D102
528528

529529
# Create the request - assumes all inputs are valid and of the proper type
530530
request = OffsetFacesRequest(
531-
request_data=[OffsetFacesRequestData(
532-
faces=[EntityIdentifier(id=face_id) for face_id in kwargs["face_ids"]],
533-
offset=from_measurement_to_server_length(kwargs["distance"]),
534-
direction=from_unit_vector_to_grpc_direction(kwargs["direction"]),
535-
extrude_type=kwargs["extrude_type"].value,
536-
)]
531+
request_data=[
532+
OffsetFacesRequestData(
533+
faces=[EntityIdentifier(id=face_id) for face_id in kwargs["face_ids"]],
534+
offset=from_measurement_to_server_length(kwargs["distance"]),
535+
direction=from_unit_vector_to_grpc_direction(kwargs["direction"]),
536+
extrude_type=kwargs["extrude_type"].value,
537+
)
538+
]
537539
)
538540

539541
# Call the gRPC service
@@ -543,5 +545,6 @@ def offset_faces(self, **kwargs) -> dict: # noqa: D102
543545
return {
544546
"results": [
545547
[face.id for face in response_data.new_faces]
546-
for response_data in response.response_data]
547-
}
548+
for response_data in response.response_data
549+
]
550+
}

src/ansys/geometry/core/_grpc/_services/v1/curves.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, channel: grpc.Channel): # noqa: D102
4646
from ansys.api.geometry.v1.curves_pb2_grpc import CurvesStub
4747

4848
self.stub = CurvesStub(channel)
49-
49+
5050
@protect_grpc
5151
def revolve_edges(self, **kwargs) -> dict: # noqa: D102
52-
raise NotImplementedError
52+
raise NotImplementedError

src/ansys/geometry/core/_grpc/_services/v1/faces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def draft_faces(self, **kwargs) -> dict: # noqa: D102
134134
@protect_grpc
135135
def get_round_info(self, **kwargs): # noqa: D102
136136
raise NotImplementedError
137-
137+
138138
@protect_grpc
139139
def offset_faces(self, **kwargs): # noqa: D102
140140
raise NotImplementedError

src/ansys/geometry/core/designer/geometry_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1834,4 +1834,4 @@ def revolve_edges(
18341834
)
18351835

18361836
design = get_design_from_edge(edges[0])
1837-
design._update_design_inplace()
1837+
design._update_design_inplace()

tests/integration/test_geometry_commands.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1406,6 +1406,7 @@ def test_thicken_surface_body(modeler: Modeler):
14061406
Quantity(0.4, UNITS.m**3).m, rel=1e-6, abs=1e-8
14071407
)
14081408

1409+
14091410
def test_offset_faces(modeler: Modeler):
14101411
"""Test offsetting faces."""
14111412
design = modeler.create_design("offset_faces")
@@ -1432,12 +1433,13 @@ def test_offset_faces(modeler: Modeler):
14321433

14331434
assert box.volume.m == pytest.approx(Quantity(8.8, UNITS.m**3).m, rel=1e-6, abs=1e-8)
14341435
assert box2.volume.m == pytest.approx(Quantity(8.4, UNITS.m**3).m, rel=1e-6, abs=1e-8)
1435-
1436+
1437+
14361438
def test_revolve_edges(modeler: Modeler):
14371439
"""Test revolving edges."""
14381440
design = modeler.create_design("revolve_edges")
14391441
box = design.extrude_sketch("box", Sketch().box(Point2D([0, 0]), 2, 2), 2)
1440-
1442+
14411443
assert len(box.faces) == 6
14421444
assert box.volume.m == pytest.approx(Quantity(8, UNITS.m**3).m, rel=1e-6, abs=1e-8)
14431445

@@ -1447,10 +1449,8 @@ def test_revolve_edges(modeler: Modeler):
14471449
modeler.geometry_commands.revolve_edges(edge, axis, Angle(np.pi / 2, UNITS.rad), True)
14481450

14491451
assert len(design.bodies) == 2
1450-
assert design.bodies[0].volume.m == pytest.approx(
1451-
Quantity(8, UNITS.m**3).m, rel=1e-6, abs=1e-8
1452-
)
1452+
assert design.bodies[0].volume.m == pytest.approx(Quantity(8, UNITS.m**3).m, rel=1e-6, abs=1e-8)
14531453
assert design.bodies[1].is_surface
14541454
assert design.bodies[1].faces[0].area.m == pytest.approx(
14551455
Quantity(8.88576587632, UNITS.m**2).m, rel=1e-6, abs=1e-8
1456-
)
1456+
)

0 commit comments

Comments
 (0)