Skip to content

Commit c4e0935

Browse files
Merge branch 'main' of https://github.com/ansys/pyansys-geometry into feat/design_tessellation_streaming
2 parents 13e2c45 + f7e8d3f commit c4e0935

File tree

21 files changed

+708
-144
lines changed

21 files changed

+708
-144
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ jobs:
2626
persist-credentials: false
2727

2828
- name: Initialize CodeQL
29-
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
29+
uses: github/codeql-action/init@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
3030
with:
3131
languages: 'python'
3232
config-file: ./.github/codeql-config.yml
3333

3434
- name: Autobuild
35-
uses: github/codeql-action/autobuild@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
35+
uses: github/codeql-action/autobuild@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
3636

3737
# If the Autobuild fails above, remove it and uncomment the following three lines.
3838
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
@@ -42,6 +42,6 @@ jobs:
4242
# ./location_of_script_within_repo/buildscript.sh
4343

4444
- name: Perform CodeQL Analysis
45-
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
45+
uses: github/codeql-action/analyze@e296a935590eb16afc0c0108289f68c87e2a89a5 # v4.30.7
4646
with:
4747
category: "/language:python"

doc/changelog.d/2260.test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adding test coverage for nurbs, design, and geometry commands
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removing commands stub from body module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump ansys-api-geometry from 0.4.78 to 0.4.80
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump github/codeql-action from 3.30.6 to 4.30.7 in the actions group
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Prevent invalid kwargs from being passed to launcher methods

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ classifiers = [
2424
]
2525

2626
dependencies = [
27-
"ansys-api-geometry==0.4.78",
27+
"ansys-api-geometry==0.4.80",
2828
"ansys-tools-path>=0.3,<1",
2929
"beartype>=0.11.0,<0.22",
3030
"geomdl>=5,<6",

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,38 @@ def create_body_from_loft_profiles_with_guides(self, **kwargs) -> dict:
236236
def combine_merge(self, **kwargs) -> dict:
237237
"""Combine and merge bodies."""
238238
pass
239+
240+
@abstractmethod
241+
def assign_midsurface_thickness(self, **kwargs) -> dict:
242+
"""Assign a thickness to a midsurface body."""
243+
pass
244+
245+
@abstractmethod
246+
def assign_midsurface_offset(self, **kwargs) -> dict:
247+
"""Assign a offset to a midsurface body."""
248+
pass
249+
250+
@abstractmethod
251+
def shell(self, **kwargs) -> dict:
252+
"""Shell a body."""
253+
pass
254+
255+
@abstractmethod
256+
def remove_faces(self, **kwargs) -> dict:
257+
"""Remove faces from a body."""
258+
pass
259+
260+
@abstractmethod
261+
def imprint_curves(self, **kwargs) -> dict:
262+
"""Imprint curves on a body."""
263+
pass
264+
265+
@abstractmethod
266+
def project_curves(self, **kwargs) -> dict:
267+
"""Project curves on a body."""
268+
pass
269+
270+
@abstractmethod
271+
def imprint_projected_curves(self, **kwargs) -> dict:
272+
"""Imprint projected curves on a body."""
273+
pass

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

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,3 +905,185 @@ def combine_merge(self, **kwargs) -> dict: # noqa: D102
905905

906906
# Return the response - formatted as a dictionary
907907
return {}
908+
909+
@protect_grpc
910+
def assign_midsurface_thickness(self, **kwargs) -> dict: # noqa: D102
911+
from ansys.api.geometry.v0.commands_pb2 import AssignMidSurfaceThicknessRequest
912+
913+
# Create the request - assumes all inputs are valid and of the proper type
914+
request = AssignMidSurfaceThicknessRequest(
915+
bodies_or_faces=kwargs["ids"],
916+
thickness=from_measurement_to_server_length(kwargs["thickness"]),
917+
)
918+
919+
# Call the gRPC service
920+
self.command_stub.AssignMidSurfaceThickness(request=request)
921+
922+
# Return the response - formatted as a dictionary
923+
return {}
924+
925+
@protect_grpc
926+
def assign_midsurface_offset(self, **kwargs) -> dict: # noqa: D102
927+
from ansys.api.geometry.v0.commands_pb2 import AssignMidSurfaceOffsetTypeRequest
928+
929+
# Create the request - assumes all inputs are valid and of the proper type
930+
request = AssignMidSurfaceOffsetTypeRequest(
931+
bodies_or_faces=kwargs["ids"],
932+
offset_type=kwargs["offset_type"].value,
933+
)
934+
935+
# Call the gRPC service
936+
self.command_stub.AssignMidSurfaceOffsetType(request=request)
937+
938+
# Return the response - formatted as a dictionary
939+
return {}
940+
941+
@protect_grpc
942+
def shell(self, **kwargs) -> dict: # noqa: D102
943+
from ansys.api.geometry.v0.commands_pb2 import ShellRequest
944+
945+
# Create the request - assumes all inputs are valid and of the proper type
946+
request = ShellRequest(
947+
selection=build_grpc_id(kwargs["id"]),
948+
offset=from_measurement_to_server_length(kwargs["offset"]),
949+
)
950+
951+
# Call the gRPC service
952+
response = self.command_stub.Shell(request=request)
953+
954+
# Return the response - formatted as a dictionary
955+
return {
956+
"success": response.success,
957+
}
958+
959+
@protect_grpc
960+
def remove_faces(self, **kwargs) -> dict: # noqa: D102
961+
from ansys.api.geometry.v0.commands_pb2 import RemoveFacesRequest
962+
963+
# Create the request - assumes all inputs are valid and of the proper type
964+
request = RemoveFacesRequest(
965+
selection=[build_grpc_id(id) for id in kwargs["face_ids"]],
966+
offset=from_measurement_to_server_length(kwargs["offset"]),
967+
)
968+
969+
# Call the gRPC service
970+
response = self.command_stub.RemoveFaces(request=request)
971+
972+
# Return the response - formatted as a dictionary
973+
return {
974+
"success": response.success,
975+
}
976+
977+
@protect_grpc
978+
def imprint_curves(self, **kwargs) -> dict: # noqa: D102
979+
from ansys.api.geometry.v0.commands_pb2 import ImprintCurvesRequest
980+
981+
# Convert sketch and trimmed curves to gRPC format
982+
sketch = kwargs["sketch"]
983+
curves = None
984+
if sketch:
985+
curves = from_sketch_shapes_to_grpc_geometries(sketch.plane, sketch.edges, sketch.faces)
986+
987+
trimmed_curves = None
988+
if kwargs["tc"]:
989+
trimmed_curves = [from_trimmed_curve_to_grpc_trimmed_curve(tc) for tc in kwargs["tc"]]
990+
991+
# Create the request - assumes all inputs are valid and of the proper type
992+
request = ImprintCurvesRequest(
993+
body=kwargs["id"],
994+
curves=curves,
995+
faces=kwargs["face_ids"],
996+
plane=from_plane_to_grpc_plane(sketch.plane) if sketch else None,
997+
trimmed_curves=trimmed_curves,
998+
)
999+
1000+
# Call the gRPC service
1001+
response = self.command_stub.ImprintCurves(request=request)
1002+
1003+
# Return the response - formatted as a dictionary
1004+
return {
1005+
"edges": [
1006+
{
1007+
"id": edge.id,
1008+
"curve_type": edge.curve_type,
1009+
"is_reversed": edge.is_reversed,
1010+
}
1011+
for edge in response.edges
1012+
],
1013+
"faces": [
1014+
{
1015+
"id": face.id,
1016+
"surface_type": face.surface_type,
1017+
"is_reversed": face.is_reversed,
1018+
}
1019+
for face in response.faces
1020+
],
1021+
}
1022+
1023+
@protect_grpc
1024+
def project_curves(self, **kwargs) -> dict: # noqa: D102
1025+
from ansys.api.geometry.v0.commands_pb2 import ProjectCurvesRequest
1026+
1027+
# Convert sketch and trimmed curves to gRPC format
1028+
sketch = kwargs["sketch"]
1029+
curves = from_sketch_shapes_to_grpc_geometries(
1030+
sketch.plane, sketch.edges, sketch.faces, kwargs["only_one_curve"]
1031+
)
1032+
1033+
# Create the request - assumes all inputs are valid and of the proper type
1034+
request = ProjectCurvesRequest(
1035+
body=kwargs["id"],
1036+
curves=curves,
1037+
direction=from_unit_vector_to_grpc_direction(kwargs["direction"]),
1038+
closest_face=kwargs["closest_face"],
1039+
plane=from_plane_to_grpc_plane(sketch.plane),
1040+
)
1041+
1042+
# Call the gRPC service
1043+
response = self.command_stub.ProjectCurves(request=request)
1044+
1045+
# Return the response - formatted as a dictionary
1046+
return {
1047+
"faces": [
1048+
{
1049+
"id": face.id,
1050+
"surface_type": face.surface_type,
1051+
"is_reversed": face.is_reversed,
1052+
}
1053+
for face in response.faces
1054+
],
1055+
}
1056+
1057+
@protect_grpc
1058+
def imprint_projected_curves(self, **kwargs) -> dict: # noqa: D102
1059+
from ansys.api.geometry.v0.commands_pb2 import ProjectCurvesRequest
1060+
1061+
# Convert sketch and trimmed curves to gRPC format
1062+
sketch = kwargs["sketch"]
1063+
curves = from_sketch_shapes_to_grpc_geometries(
1064+
sketch.plane, sketch.edges, sketch.faces, kwargs["only_one_curve"]
1065+
)
1066+
1067+
# Create the request - assumes all inputs are valid and of the proper type
1068+
request = ProjectCurvesRequest(
1069+
body=kwargs["id"],
1070+
curves=curves,
1071+
direction=from_unit_vector_to_grpc_direction(kwargs["direction"]),
1072+
closest_face=kwargs["closest_face"],
1073+
plane=from_plane_to_grpc_plane(sketch.plane),
1074+
)
1075+
1076+
# Call the gRPC service
1077+
response = self.command_stub.ImprintProjectedCurves(request=request)
1078+
1079+
# Return the response - formatted as a dictionary
1080+
return {
1081+
"faces": [
1082+
{
1083+
"id": face.id,
1084+
"surface_type": face.surface_type,
1085+
"is_reversed": face.is_reversed,
1086+
}
1087+
for face in response.faces
1088+
],
1089+
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,31 @@ def create_body_from_loft_profiles_with_guides(self, **kwargs) -> dict: # noqa:
207207
@protect_grpc
208208
def combine_merge(self, **kwargs) -> dict: # noqa: D102
209209
raise NotImplementedError
210+
211+
@protect_grpc
212+
def assign_midsurface_thickness(self, **kwargs) -> dict: # noqa: D102
213+
raise NotImplementedError
214+
215+
@protect_grpc
216+
def assign_midsurface_offset(self, **kwargs) -> dict: # noqa: D102
217+
raise NotImplementedError
218+
219+
@protect_grpc
220+
def shell(self, **kwargs) -> dict: # noqa: D102
221+
raise NotImplementedError
222+
223+
@protect_grpc
224+
def remove_faces(self, **kwargs) -> dict: # noqa: D102
225+
raise NotImplementedError
226+
227+
@protect_grpc
228+
def imprint_curves(self, **kwargs) -> dict: # noqa: D102
229+
raise NotImplementedError
230+
231+
@protect_grpc
232+
def project_curves(self, **kwargs) -> dict: # noqa: D102
233+
raise NotImplementedError
234+
235+
@protect_grpc
236+
def imprint_projected_curves(self, **kwargs) -> dict: # noqa: D102
237+
raise NotImplementedError

0 commit comments

Comments
 (0)