Skip to content

Commit 652d21d

Browse files
committed
misc changes for tracker implementation
Move the calls from problem_area to service/v0[1] Fix usage of tracker flag Move serialize tracker to be version dependent
1 parent cbc9562 commit 652d21d

File tree

11 files changed

+400
-193
lines changed

11 files changed

+400
-193
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,5 @@ def boolean(self, **kwargs) -> dict:
221221

222222
@abstractmethod
223223
def combine(self, **kwargs) -> dict:
224-
"""Boolean operation."""
224+
"""Boolean operation through command."""
225225
pass

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,3 @@ def insert(self, **kwargs) -> dict:
8383
def get_active(self, **kwargs) -> dict:
8484
"""Get the active design on the service."""
8585
pass
86-
87-
@abstractmethod
88-
def _serialize_tracker_command_response(self, **kwargs) -> dict:
89-
"""Get a serialized response from the tracker."""
90-
pass

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

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,53 @@ def inspect_geometry(self, **kwargs) -> dict:
128128
def repair_geometry(self, **kwargs) -> dict:
129129
"""Repair the geometry by addressing identified issues."""
130130
pass
131+
132+
@abstractmethod
133+
def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
134+
"""Fix duplicate faces in the geometry."""
135+
pass
136+
137+
@abstractmethod
138+
def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
139+
"""Fix missing faces in the geometry."""
140+
pass
141+
142+
@abstractmethod
143+
def fix_inexact_edges(self, **kwargs) -> dict: # noqa: D102
144+
"""Fix inexact edges in the geometry."""
145+
pass
146+
147+
@abstractmethod
148+
def fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
149+
"""Fix extra edges in the geometry."""
150+
pass
151+
152+
@abstractmethod
153+
def fix_short_edges(self, **kwargs) -> dict: # noqa: D102
154+
"""Fix short edges in the geometry."""
155+
pass
156+
157+
@abstractmethod
158+
def fix_small_faces(self, **kwargs) -> dict: # noqa: D102
159+
"""Fix small faces in the geometry."""
160+
pass
161+
162+
@abstractmethod
163+
def fix_split_edges(self, **kwargs) -> dict: # noqa: D102
164+
"""Fix split edges in the geometry."""
165+
pass
166+
167+
@abstractmethod
168+
def fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
169+
"""Fix stitch faces in the geometry."""
170+
pass
171+
172+
@abstractmethod
173+
def fix_unsimplified_faces(self, **kwargs) -> dict: # noqa: D102
174+
"""Fix areas to simplify in the geometry."""
175+
pass
176+
177+
@abstractmethod
178+
def fix_interference(self, **kwargs) -> dict: # noqa: D102
179+
"""Fix interferences in the geometry."""
180+
pass

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def get_active(self, **kwargs) -> dict: # noqa: D102
195195
"name": response.name,
196196
}
197197

198-
def _serialize_tracker_command_response(self, **kwargs) -> dict:
198+
def _serialize_tracker_command_response(**kwargs) -> dict:
199199
"""Serialize a TrackerCommandResponse object into a dictionary.
200200
201201
Parameters

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

Lines changed: 216 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import grpc
3030

31+
from ansys.geometry.core._grpc._services.v0.designs import GRPCDesignsServiceV0 as designV0
3132
from ansys.geometry.core.errors import protect_grpc
3233

3334
from ..base.repair_tools import GRPCRepairToolsService
@@ -342,7 +343,7 @@ def find_and_fix_simplify(self, **kwargs) -> dict: # noqa: D102
342343
# Call the gRPC service
343344
response = self.stub.FindAndSimplify(request)
344345

345-
serialized_tracker_response = kwargs["parent_design"]._serialize_tracker_command_response(
346+
serialized_tracker_response = designV0._serialize_tracker_command_response(
346347
response=response.complete_command_response
347348
)
348349

@@ -380,7 +381,7 @@ def find_and_fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
380381
# Call the gRPC service
381382
response = self.stub.FindAndFixStitchFaces(request)
382383

383-
serialized_tracker_response = kwargs["parent_design"]._serialize_tracker_command_response(
384+
serialized_tracker_response = designV0._serialize_tracker_command_response(
384385
response=response.complete_command_response
385386
)
386387

@@ -462,7 +463,7 @@ def find_and_fix_short_edges(self, **kwargs): # noqa: D102
462463
# Call the gRPC service
463464
response = self.stub.FindAndFixShortEdges(request)
464465

465-
serialized_tracker_response = kwargs["parent_design"]._serialize_tracker_command_response(
466+
serialized_tracker_response = designV0._serialize_tracker_command_response(
466467
response=response.complete_command_response
467468
)
468469

@@ -489,7 +490,7 @@ def find_and_fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
489490
# Call the gRPC service
490491
response = self.stub.FindAndFixExtraEdges(request)
491492

492-
serialized_tracker_response = kwargs["parent_design"]._serialize_tracker_command_response(
493+
serialized_tracker_response = designV0._serialize_tracker_command_response(
493494
response=response.complete_command_response
494495
)
495496

@@ -519,7 +520,7 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
519520
# Call the gRPC service
520521
response = self.stub.FindAndFixSplitEdges(request)
521522

522-
serialized_tracker_response = kwargs["parent_design"]._serialize_tracker_command_response(
523+
serialized_tracker_response = designV0._serialize_tracker_command_response(
523524
response=response.complete_command_response
524525
)
525526

@@ -533,6 +534,216 @@ def find_and_fix_split_edges(self, **kwargs) -> dict: # noqa: D102
533534
"complete_command_response": serialized_tracker_response,
534535
}
535536

537+
@protect_grpc
538+
def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102
539+
from ansys.api.geometry.v0.repairtools_pb2 import FixDuplicateFacesRequest
540+
541+
# Create the request - assumes all inputs are valid and of the proper type
542+
request = FixDuplicateFacesRequest(
543+
duplicate_face_problem_area_id=kwargs["duplicate_face_problem_area_id"],
544+
)
545+
546+
# Call the gRPC service
547+
response = self.stub.FixDuplicateFaces(request)
548+
549+
serialized_tracker_response = designV0._serialize_tracker_command_response(
550+
response=response.result.complete_command_response
551+
)
552+
553+
# Return the response - formatted as a dictionary
554+
return {
555+
"tracker_response": serialized_tracker_response,
556+
}
557+
558+
@protect_grpc
559+
def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102
560+
from ansys.api.geometry.v0.repairtools_pb2 import FixMissingFacesRequest
561+
562+
# Create the request - assumes all inputs are valid and of the proper type
563+
request = FixMissingFacesRequest(
564+
missing_face_problem_area_id=kwargs["missing_face_problem_area_id"],
565+
)
566+
567+
# Call the gRPC service
568+
response = self.stub.FixMissingFaces(request)
569+
570+
serialized_tracker_response = designV0._serialize_tracker_command_response(
571+
response=response.result.complete_command_response
572+
)
573+
574+
# Return the response - formatted as a dictionary
575+
return {
576+
"tracker_response": serialized_tracker_response,
577+
}
578+
579+
@protect_grpc
580+
def fix_inexact_edges(self, **kwargs) -> dict: # noqa: D102
581+
from ansys.api.geometry.v0.repairtools_pb2 import FixInexactEdgesRequest
582+
583+
# Create the request - assumes all inputs are valid and of the proper type
584+
request = FixInexactEdgesRequest(
585+
inexact_edge_problem_area_id=kwargs["inexact_edge_problem_area_id"],
586+
)
587+
588+
# Call the gRPC service
589+
response = self.stub.FixInexactEdges(request)
590+
591+
serialized_tracker_response = designV0._serialize_tracker_command_response(
592+
response=response.result.complete_command_response
593+
)
594+
595+
# Return the response - formatted as a dictionary
596+
return {
597+
"tracker_response": serialized_tracker_response,
598+
}
599+
600+
@protect_grpc
601+
def fix_extra_edges(self, **kwargs) -> dict: # noqa: D102
602+
from ansys.api.geometry.v0.repairtools_pb2 import FixExtraEdgesRequest
603+
604+
# Create the request - assumes all inputs are valid and of the proper type
605+
request = FixExtraEdgesRequest(
606+
extra_edge_problem_area_id=kwargs["extra_edge_problem_area_id"],
607+
)
608+
609+
# Call the gRPC service
610+
response = self.stub.FixExtraEdges(request)
611+
612+
serialized_tracker_response = designV0._serialize_tracker_command_response(
613+
response=response.result.complete_command_response
614+
)
615+
616+
# Return the response - formatted as a dictionary
617+
return {
618+
"tracker_response": serialized_tracker_response,
619+
}
620+
621+
@protect_grpc
622+
def fix_short_edges(self, **kwargs) -> dict: # noqa: D102
623+
from ansys.api.geometry.v0.repairtools_pb2 import FixShortEdgesRequest
624+
625+
# Create the request - assumes all inputs are valid and of the proper type
626+
request = FixShortEdgesRequest(
627+
short_edge_problem_area_id=kwargs["short_edge_problem_area_id"],
628+
)
629+
630+
# Call the gRPC service
631+
response = self.stub.FixShortEdges(request)
632+
633+
serialized_tracker_response = designV0._serialize_tracker_command_response(
634+
response=response.result.complete_command_response
635+
)
636+
637+
# Return the response - formatted as a dictionary
638+
return {
639+
"tracker_response": serialized_tracker_response,
640+
}
641+
642+
@protect_grpc
643+
def fix_small_faces(self, **kwargs) -> dict: # noqa: D102
644+
from ansys.api.geometry.v0.repairtools_pb2 import FixSmallFacesRequest
645+
646+
# Create the request - assumes all inputs are valid and of the proper type
647+
request = FixSmallFacesRequest(
648+
small_face_problem_area_id=kwargs["small_face_problem_area_id"],
649+
)
650+
651+
# Call the gRPC service
652+
response = self.stub.FixSmallFaces(request)
653+
654+
serialized_tracker_response = designV0._serialize_tracker_command_response(
655+
response=response.result.complete_command_response
656+
)
657+
658+
# Return the response - formatted as a dictionary
659+
return {
660+
"tracker_response": serialized_tracker_response,
661+
}
662+
663+
@protect_grpc
664+
def fix_split_edges(self, **kwargs) -> dict: # noqa: D102
665+
from ansys.api.geometry.v0.repairtools_pb2 import FixSplitEdgesRequest
666+
667+
# Create the request - assumes all inputs are valid and of the proper type
668+
request = FixSplitEdgesRequest(
669+
split_edge_problem_area_id=kwargs["split_edge_problem_area_id"],
670+
)
671+
672+
# Call the gRPC service
673+
response = self.stub.FixSplitEdges(request)
674+
675+
serialized_tracker_response = designV0._serialize_tracker_command_response(
676+
response=response.result.complete_command_response
677+
)
678+
679+
# Return the response - formatted as a dictionary
680+
return {
681+
"tracker_response": serialized_tracker_response,
682+
}
683+
684+
@protect_grpc
685+
def fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102
686+
from ansys.api.geometry.v0.repairtools_pb2 import FixStitchFacesRequest
687+
688+
# Create the request - assumes all inputs are valid and of the proper type
689+
request = FixStitchFacesRequest(
690+
stitch_face_problem_area_id=kwargs["stitch_face_problem_area_id"],
691+
)
692+
693+
# Call the gRPC service
694+
response = self.stub.FixStitchFaces(request)
695+
696+
serialized_tracker_response = designV0._serialize_tracker_command_response(
697+
response=response.result.complete_command_response
698+
)
699+
700+
# Return the response - formatted as a dictionary
701+
return {
702+
"tracker_response": serialized_tracker_response,
703+
}
704+
705+
@protect_grpc
706+
def fix_unsimplified_faces(self, **kwargs) -> dict: # noqa: D102
707+
from ansys.api.geometry.v0.repairtools_pb2 import FixAdjustSimplifyRequest
708+
709+
# Create the request - assumes all inputs are valid and of the proper type
710+
request = FixAdjustSimplifyRequest(
711+
adjust_simplify_problem_area_id=kwargs["adjust_simplify_problem_area_id"],
712+
)
713+
714+
# Call the gRPC service
715+
response = self.stub.FixAdjustSimplify(request)
716+
717+
serialized_tracker_response = designV0._serialize_tracker_command_response(
718+
response=response.result.complete_command_response
719+
)
720+
721+
# Return the response - formatted as a dictionary
722+
return {
723+
"tracker_response": serialized_tracker_response,
724+
}
725+
726+
@protect_grpc
727+
def fix_interference(self, **kwargs) -> dict: # noqa: D102
728+
from ansys.api.geometry.v0.repairtools_pb2 import FixInterferenceRequest
729+
730+
# Create the request - assumes all inputs are valid and of the proper type
731+
request = FixInterferenceRequest(
732+
interference_problem_area_id=kwargs["interference_problem_area_id"],
733+
)
734+
735+
# Call the gRPC service
736+
response = self.stub.FixInterference(request)
737+
738+
serialized_tracker_response = designV0._serialize_tracker_command_response(
739+
response=response.result.complete_command_response
740+
)
741+
742+
# Return the response - formatted as a dictionary
743+
return {
744+
"tracker_response": serialized_tracker_response,
745+
}
746+
536747
def __serialize_inspect_result_response(self, response) -> dict: # noqa: D102
537748
def serialize_body(body):
538749
return {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,3 @@ def insert(self, **kwargs) -> dict: # noqa: D102
8282
@protect_grpc
8383
def get_active(self, **kwargs) -> dict: # noqa: D102
8484
raise NotImplementedError
85-
86-
def _serialize_tracker_command_response(self, **kwargs) -> dict: # noqa: D102
87-
"""Get a serialized response from the tracker."""
88-
raise NotImplementedError

0 commit comments

Comments
 (0)