Skip to content

Commit 6a57201

Browse files
b-matteopyansys-ci-botjacobrkerstetterRobPasMuepre-commit-ci[bot]
authored
chore: v1 fix imprint curves (#2454)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Jacob Kerstetter <[email protected]> Co-authored-by: Roberto Pastor Muela <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 6588283 commit 6a57201

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Chore: v1 fix imprint curves

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,14 @@ def imprint_curves(self, **kwargs) -> dict: # noqa: D102
12351235
ImprintCurvesRequestData,
12361236
)
12371237

1238+
# Convert sketch and trimmed curves to gRPC format
1239+
sketch = kwargs["sketch"]
1240+
curves = (
1241+
from_sketch_shapes_to_grpc_geometries(sketch.plane, sketch.edges, sketch.faces)
1242+
if sketch
1243+
else None
1244+
)
1245+
12381246
# Convert trimmed curves to gRPC format
12391247
trimmed_curves = []
12401248
if kwargs.get("tc"):
@@ -1245,17 +1253,36 @@ def imprint_curves(self, **kwargs) -> dict: # noqa: D102
12451253
request_data=[
12461254
ImprintCurvesRequestData(
12471255
body_ids=build_grpc_id(kwargs["id"]),
1256+
curves=curves,
12481257
face_ids=[build_grpc_id(id) for id in kwargs["face_ids"]],
1258+
plane=from_plane_to_grpc_plane(sketch.plane) if sketch else None,
12491259
trimmed_curves=trimmed_curves,
12501260
)
12511261
]
12521262
)
12531263

12541264
# Call the gRPC service
1255-
_ = self.edit_stub.ImprintCurves(request=request)
1265+
response = self.edit_stub.ImprintCurves(request=request).response_data[0]
12561266

12571267
# Return the response - formatted as a dictionary
1258-
return {}
1268+
return {
1269+
"edges": [
1270+
{
1271+
"id": edge.id,
1272+
"curve_type": edge.curve_type,
1273+
"is_reversed": edge.is_reversed,
1274+
}
1275+
for edge in response.created_entities.edges
1276+
],
1277+
"faces": [
1278+
{
1279+
"id": face.id,
1280+
"surface_type": face.surface_type,
1281+
"is_reversed": face.is_reversed,
1282+
}
1283+
for face in response.created_entities.faces
1284+
],
1285+
}
12591286

12601287
@protect_grpc
12611288
def project_curves(self, **kwargs) -> dict: # noqa: D102

0 commit comments

Comments
 (0)