Skip to content

Commit 55f37a4

Browse files
wip
1 parent b94575b commit 55f37a4

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,8 @@ def upload_file(self, **kwargs) -> dict:
9393
def upload_file_stream(self, **kwargs) -> dict:
9494
"""Upload a file to the server using streaming."""
9595
pass
96+
97+
@abstractmethod
98+
def stream_design_tessellation(self, **kwargs) -> dict:
99+
"""Stream the tessellation of a design."""
100+
pass

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,32 @@ def request_generator(
256256

257257
# Return the response - formatted as a dictionary
258258
return {"file_path": response.file_path}
259+
260+
@protect_grpc
261+
def stream_design_tessellation(self, **kwargs) -> dict: # noqa: D102
262+
from ansys.api.dbu.v0.designs_pb2 import DesignTessellationRequest
263+
264+
# Create the request - assumes all inputs are valid and of the proper type
265+
request = DesignTessellationRequest(
266+
chordal_deviation=kwargs["chordal_deviation"],
267+
angle_deviation=kwargs["angle_deviation"],
268+
max_aspect_ratio=kwargs["max_aspect_ratio"],
269+
min_edge_length=kwargs["min_edge_length"],
270+
max_edge_length=kwargs["max_edge_length"],
271+
deflection_type=kwargs["deflection_type"],
272+
)
273+
274+
# Call the gRPC service
275+
response = self.designs_stub.StreamDesignTessellation(request)
276+
277+
# Return the response - formatted as a dictionary
278+
points = []
279+
triangles = []
280+
for elem in response:
281+
points.extend(elem.points)
282+
triangles.extend(elem.triangles)
283+
284+
return {
285+
"points": points,
286+
"triangles": triangles,
287+
}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ def upload_file(self, **kwargs) -> dict: # noqa: D102
9090
@protect_grpc
9191
def upload_file_stream(self, **kwargs) -> dict: # noqa: D102
9292
raise NotImplementedError
93+
94+
@protect_grpc
95+
def stream_design_tessellation(self, **kwargs) -> dict: # noqa: D102
96+
raise NotImplementedError

0 commit comments

Comments
 (0)