Skip to content

Commit 9a35567

Browse files
committed
fixes after merge conflict
1 parent 8234ee1 commit 9a35567

File tree

1 file changed

+83
-168
lines changed

1 file changed

+83
-168
lines changed

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

Lines changed: 83 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -332,99 +332,6 @@ def find_simplify(self, **kwargs) -> dict: # noqa: D102
332332
]
333333
}
334334

335-
@protect_grpc
336-
def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
337-
from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest
338-
339-
# Create the request - assumes all inputs are valid and of the proper type
340-
request = FindAdjustSimplifyRequest(
341-
selection=kwargs["selection"],
342-
comprehensive=kwargs["comprehensive_result"],
343-
)
344-
345-
# Call the gRPC service
346-
response = self.stub.FindAndSimplify(request)
347-
348-
serialized_tracker_response = serialize_tracker_command_response(
349-
response=response.complete_command_response
350-
)
351-
352-
# Return the response - formatted as a dictionary
353-
return {
354-
"success": response.success,
355-
"found": response.found,
356-
"repaired": response.repaired,
357-
"created_bodies_monikers": [],
358-
"modified_bodies_monikers": [],
359-
"complete_command_response": serialized_tracker_response,
360-
}
361-
362-
@protect_grpc
363-
def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
364-
from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest
365-
from google.protobuf.wrappers_pb2 import BoolValue, DoubleValue
366-
367-
from ..base.conversions import from_measurement_to_server_length
368-
369-
# Create the request - assumes all inputs are valid and of the proper type
370-
request = FindStitchFacesRequest(
371-
faces=kwargs["body_ids"],
372-
maximum_distance=DoubleValue(
373-
value=from_measurement_to_server_length(kwargs["max_distance"])
374-
)
375-
if kwargs["max_distance"] is not None
376-
else None,
377-
allow_multiple_bodies=BoolValue(value=kwargs["allow_multiple_bodies"]),
378-
maintain_components=BoolValue(value=kwargs["maintain_components"]),
379-
check_for_coincidence=BoolValue(value=kwargs["check_for_coincidence"]),
380-
comprehensive=kwargs["comprehensive_result"],
381-
)
382-
383-
# Call the gRPC service
384-
response = self.stub.FindAndFixStitchFaces(request)
385-
386-
serialized_tracker_response = serialize_tracker_command_response(
387-
response=response.complete_command_response
388-
)
389-
390-
# Return the response - formatted as a dictionary
391-
return {
392-
"success": response.success,
393-
"created_bodies_monikers": response.created_bodies_monikers,
394-
"modified_bodies_monikers": response.modified_bodies_monikers,
395-
"found": response.found,
396-
"repaired": response.repaired,
397-
"complete_command_response": serialized_tracker_response,
398-
}
399-
400-
@protect_grpc
401-
def inspect_geometry(self, **kwargs) -> dict: # noqa: D102
402-
from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest
403-
404-
# Create the request - assumes all inputs are valid and of the proper type
405-
request = InspectGeometryRequest(bodies=kwargs.get("bodies", []))
406-
407-
# Call the gRPC service
408-
inspect_result_response = self.stub.InspectGeometry(request)
409-
410-
# Serialize and return the response
411-
return self.__serialize_inspect_result_response(inspect_result_response)
412-
413-
@protect_grpc
414-
def repair_geometry(self, **kwargs) -> dict: # noqa: D102
415-
from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest
416-
417-
# Create the request - assumes all inputs are valid and of the proper type
418-
request = RepairGeometryRequest(bodies=kwargs.get("bodies", []))
419-
420-
# Call the gRPC service
421-
response = self.stub.RepairGeometry(request)
422-
423-
# Return the response - formatted as a dictionary
424-
return {
425-
"success": response.result.success,
426-
}
427-
428335
@protect_grpc
429336
def find_interferences(self, **kwargs) -> dict: # noqa: D102
430337
from ansys.api.geometry.v0.repairtools_pb2 import FindInterferenceRequest
@@ -537,21 +444,6 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
537444
}
538445

539446
@protect_grpc
540-
def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
541-
from ansys.api.geometry.v0.repairtools_pb2 import FixDuplicateFacesRequest
542-
543-
# Create the request - assumes all inputs are valid and of the proper type
544-
request = FixDuplicateFacesRequest(
545-
duplicate_face_problem_area_id=kwargs["duplicate_face_problem_area_id"],
546-
)
547-
548-
# Call the gRPC service
549-
response = self.stub.FixDuplicateFaces(request)
550-
551-
serialized_tracker_response = serialize_tracker_command_response(
552-
response=response.result.complete_command_response)
553-
554-
@protect_grpc
555447
def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
556448
from ansys.api.geometry.v0.repairtools_pb2 import FindAdjustSimplifyRequest
557449

@@ -564,38 +456,20 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
564456
# Call the gRPC service
565457
response = self.stub.FindAndSimplify(request)
566458

567-
serialized_tracker_response = serialize_tracker_command_response(
568-
response.complete_command_response
459+
serialized_tracker_response = serialize_tracker_command_response(
460+
response=response.complete_command_response
569461
)
570462

571463
# Return the response - formatted as a dictionary
572464
return {
573-
"tracker_response": serialized_tracker_response,
574-
"repair_tracker_response": self.__serialize_message_response(response),
575-
}
576-
577-
@protect_grpc
578-
def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
579-
from ansys.api.geometry.v0.repairtools_pb2 import FixMissingFacesRequest
580-
581-
# Create the request - assumes all inputs are valid and of the proper type
582-
request = FixMissingFacesRequest(
583-
missing_face_problem_area_id=kwargs["missing_face_problem_area_id"],
584-
)
585-
586-
# Call the gRPC service
587-
response = self.stub.FixMissingFaces(request)
588-
589-
serialized_tracker_response = serialize_tracker_command_response(
590-
response=response.result.complete_command_response
591465
"success": response.success,
592466
"found": response.found,
593467
"repaired": response.repaired,
594468
"created_bodies_monikers": [],
595469
"modified_bodies_monikers": [],
596470
"complete_command_response": serialized_tracker_response,
597-
)
598-
471+
}
472+
599473
@protect_grpc
600474
def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
601475
from ansys.api.geometry.v0.repairtools_pb2 import FindStitchFacesRequest
@@ -620,8 +494,83 @@ def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
620494
# Call the gRPC service
621495
response = self.stub.FindAndFixStitchFaces(request)
622496

623-
serialized_tracker_response = self._serialize_tracker_command_response(
624-
response.complete_command_response
497+
serialized_tracker_response = serialize_tracker_command_response(
498+
response=response.complete_command_response
499+
)
500+
501+
# Return the response - formatted as a dictionary
502+
return {
503+
"success": response.success,
504+
"created_bodies_monikers": response.created_bodies_monikers,
505+
"modified_bodies_monikers": response.modified_bodies_monikers,
506+
"found": response.found,
507+
"repaired": response.repaired,
508+
"complete_command_response": serialized_tracker_response,
509+
}
510+
511+
@protect_grpc
512+
def inspect_geometry(self, **kwargs) -> dict: # noqa: D102
513+
from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest
514+
515+
# Create the request - assumes all inputs are valid and of the proper type
516+
request = InspectGeometryRequest(bodies=kwargs.get("bodies", []))
517+
518+
# Call the gRPC service
519+
inspect_result_response = self.stub.InspectGeometry(request)
520+
521+
# Serialize and return the response
522+
return self.__serialize_inspect_result_response(inspect_result_response)
523+
524+
@protect_grpc
525+
def repair_geometry(self, **kwargs) -> dict: # noqa: D102
526+
from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest
527+
528+
# Create the request - assumes all inputs are valid and of the proper type
529+
request = RepairGeometryRequest(bodies=kwargs.get("bodies", []))
530+
531+
# Call the gRPC service
532+
response = self.stub.RepairGeometry(request)
533+
534+
# Return the response - formatted as a dictionary
535+
return {
536+
"success": response.result.success,
537+
}
538+
539+
@protect_grpc
540+
def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
541+
from ansys.api.geometry.v0.repairtools_pb2 import FixDuplicateFacesRequest
542+
543+
# Create the request - assumes all inputs are valid and of the proper type
544+
request = FixDuplicateFacesRequest(
545+
duplicate_face_problem_area_id=kwargs["duplicate_face_problem_area_id"],
546+
)
547+
548+
# Call the gRPC service
549+
response = self.stub.FixDuplicateFaces(request)
550+
551+
serialized_tracker_response = serialize_tracker_command_response(
552+
response=response.result.complete_command_response)
553+
554+
# Return the response - formatted as a dictionary
555+
return {
556+
"tracker_response": serialized_tracker_response,
557+
"repair_tracker_response": self.__serialize_message_response(response),
558+
}
559+
560+
@protect_grpc
561+
def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
562+
from ansys.api.geometry.v0.repairtools_pb2 import FixMissingFacesRequest
563+
564+
# Create the request - assumes all inputs are valid and of the proper type
565+
request = FixMissingFacesRequest(
566+
missing_face_problem_area_id=kwargs["missing_face_problem_area_id"],
567+
)
568+
569+
# Call the gRPC service
570+
response = self.stub.FixMissingFaces(request)
571+
572+
serialized_tracker_response = serialize_tracker_command_response(
573+
response=response.result.complete_command_response
625574
)
626575

627576
# Return the response - formatted as a dictionary
@@ -804,42 +753,8 @@ def fix_interference(self, **kwargs) -> dict: # noqa: D102
804753
return {
805754
"tracker_response": serialized_tracker_response,
806755
"repair_tracker_response": self.__serialize_message_response(response),
807-
"success": response.success,
808-
"created_bodies_monikers": response.created_bodies_monikers,
809-
"modified_bodies_monikers": response.modified_bodies_monikers,
810-
"found": response.found,
811-
"repaired": response.repaired,
812-
"complete_command_response": serialized_tracker_response,
813756
}
814-
815-
@protect_grpc
816-
def inspect_geometry(self, **kwargs) -> dict: # noqa: D102
817-
from ansys.api.geometry.v0.repairtools_pb2 import InspectGeometryRequest
818-
819-
# Create the request - assumes all inputs are valid and of the proper type
820-
request = InspectGeometryRequest(bodies=[build_grpc_id(b) for b in kwargs["body_ids"]])
821-
822-
# Call the gRPC service
823-
response = self.stub.InspectGeometry(request)
824-
825-
# Serialize and return the response
826-
return self.__serialize_inspect_result_response(response)
827-
828-
@protect_grpc
829-
def repair_geometry(self, **kwargs) -> dict: # noqa: D102
830-
from ansys.api.geometry.v0.repairtools_pb2 import RepairGeometryRequest
831-
832-
# Create the request - assumes all inputs are valid and of the proper type
833-
request = RepairGeometryRequest(bodies=[build_grpc_id(b) for b in kwargs["body_ids"]])
834-
835-
# Call the gRPC service
836-
response = self.stub.RepairGeometry(request)
837-
838-
# Return the response - formatted as a dictionary
839-
return {
840-
"success": response.result.success,
841-
}
842-
757+
843758
def __serialize_inspect_result_response(self, response) -> dict: # noqa: D102
844759
def serialize_body(body):
845760
return {
@@ -892,7 +807,7 @@ def serialize_issue(issue):
892807
}
893808
for body_issues in response.issues_by_body
894809
]
895-
}
810+
}
896811

897812
def __serialize_message_response(self, response):
898813
return {

0 commit comments

Comments
 (0)