Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/2295.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove grpc ids
25 changes: 15 additions & 10 deletions src/ansys/geometry/core/_grpc/_services/v0/repair_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
geometry issues, such as split edges, extra edges, duplicate faces etc.
"""

from google.protobuf.wrappers_pb2 import Int32Value
import grpc

from ansys.geometry.core.errors import protect_grpc
Expand Down Expand Up @@ -542,7 +543,9 @@ def fix_duplicate_faces(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixDuplicateFacesRequest(
duplicate_face_problem_area_id=kwargs["duplicate_face_problem_area_id"],
duplicate_face_problem_area_id=Int32Value(
value=kwargs["duplicate_face_problem_area_id"]
),
)

# Call the gRPC service
Expand All @@ -564,7 +567,7 @@ def fix_missing_faces(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixMissingFacesRequest(
missing_face_problem_area_id=kwargs["missing_face_problem_area_id"],
missing_face_problem_area_id=Int32Value(value=kwargs["missing_face_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -586,7 +589,7 @@ def fix_inexact_edges(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixInexactEdgesRequest(
inexact_edge_problem_area_id=kwargs["inexact_edge_problem_area_id"],
inexact_edge_problem_area_id=Int32Value(value=kwargs["inexact_edge_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -608,7 +611,7 @@ def fix_extra_edges(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixExtraEdgesRequest(
extra_edge_problem_area_id=kwargs["extra_edge_problem_area_id"],
extra_edge_problem_area_id=Int32Value(value=kwargs["extra_edge_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -630,7 +633,7 @@ def fix_short_edges(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixShortEdgesRequest(
short_edge_problem_area_id=kwargs["short_edge_problem_area_id"],
short_edge_problem_area_id=Int32Value(value=kwargs["short_edge_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -652,7 +655,7 @@ def fix_small_faces(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixSmallFacesRequest(
small_face_problem_area_id=kwargs["small_face_problem_area_id"],
small_face_problem_area_id=Int32Value(value=kwargs["small_face_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -674,7 +677,7 @@ def fix_split_edges(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixSplitEdgesRequest(
split_edge_problem_area_id=kwargs["split_edge_problem_area_id"],
split_edge_problem_area_id=Int32Value(value=kwargs["split_edge_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -696,7 +699,7 @@ def fix_stitch_faces(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixStitchFacesRequest(
stitch_face_problem_area_id=kwargs["stitch_face_problem_area_id"],
stitch_face_problem_area_id=Int32Value(value=kwargs["stitch_face_problem_area_id"]),
)

# Call the gRPC service
Expand All @@ -718,7 +721,9 @@ def fix_unsimplified_faces(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixAdjustSimplifyRequest(
adjust_simplify_problem_area_id=kwargs["adjust_simplify_problem_area_id"],
adjust_simplify_problem_area_id=Int32Value(
value=kwargs["adjust_simplify_problem_area_id"]
),
)

# Call the gRPC service
Expand All @@ -740,7 +745,7 @@ def fix_interference(self, **kwargs) -> dict: # noqa: D102

# Create the request - assumes all inputs are valid and of the proper type
request = FixInterferenceRequest(
interference_problem_area_id=kwargs["interference_problem_area_id"],
interference_problem_area_id=Int32Value(value=kwargs["interference_problem_area_id"]),
)

# Call the gRPC service
Expand Down
16 changes: 1 addition & 15 deletions src/ansys/geometry/core/designer/body.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
from abc import ABC, abstractmethod
from collections.abc import Iterable
from enum import Enum, unique
from functools import cached_property, wraps
from functools import wraps
from typing import TYPE_CHECKING, Union

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from beartype import beartype as check_input_types
import matplotlib.colors as mcolors
from pint import Quantity
Expand Down Expand Up @@ -120,11 +119,6 @@ def id(self) -> str:
"""Get the ID of the body as a string."""
return

@abstractmethod
def _grpc_id(self) -> EntityIdentifier:
"""Entity identifier of this body on the server side."""
return

@abstractmethod
def name(self) -> str:
"""Get the name of the body."""
Expand Down Expand Up @@ -890,10 +884,6 @@ def wrapper(self: "MasterBody", *args, **kwargs):
def id(self) -> str: # noqa: D102
return self._id

@cached_property
def _grpc_id(self) -> EntityIdentifier: # noqa: D102
return EntityIdentifier(id=self._id)

@property
def name(self) -> str: # noqa: D102
return self._name
Expand Down Expand Up @@ -1468,10 +1458,6 @@ def _reset_tessellation_cache(self): # noqa: N805
def id(self) -> str: # noqa: D102
return self._id

@cached_property
def _grpc_id(self) -> EntityIdentifier: # noqa: D102
return EntityIdentifier(id=self._id)

@property
def name(self) -> str: # noqa: D102
return self._template.name
Expand Down
6 changes: 0 additions & 6 deletions src/ansys/geometry/core/designer/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from typing import TYPE_CHECKING, Any, Optional, Union
import uuid

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from beartype import beartype as check_input_types
from pint import Quantity

Expand Down Expand Up @@ -276,11 +275,6 @@ def id(self) -> str:
"""ID of the component."""
return self._id

@property
def _grpc_id(self) -> EntityIdentifier:
"""ID of the component in gRPC format."""
return EntityIdentifier(id=self.id)

@property
def name(self) -> str:
"""Name of the component."""
Expand Down
6 changes: 0 additions & 6 deletions src/ansys/geometry/core/designer/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from enum import Enum, unique
from typing import TYPE_CHECKING

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from pint import Quantity

from ansys.geometry.core.connection.client import GrpcClient
Expand Down Expand Up @@ -93,11 +92,6 @@ def id(self) -> str:
"""ID of the edge."""
return self._id

@property
def _grpc_id(self) -> EntityIdentifier:
"""Entity ID of this edge on the server side."""
return EntityIdentifier(id=self._id)

@property
def body(self) -> "Body":
"""Body of the edge."""
Expand Down
6 changes: 0 additions & 6 deletions src/ansys/geometry/core/designer/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from enum import Enum, unique
from typing import TYPE_CHECKING

from ansys.api.dbu.v0.dbumodels_pb2 import EntityIdentifier
from beartype import beartype as check_input_types
import matplotlib.colors as mcolors
from pint import Quantity
Expand Down Expand Up @@ -185,11 +184,6 @@ def id(self) -> str:
"""Face ID."""
return self._id

@property
def _grpc_id(self) -> EntityIdentifier:
"""Entity ID of this face on the server side."""
return EntityIdentifier(id=self._id)

@property
def is_reversed(self) -> bool:
"""Flag indicating if the face is reversed."""
Expand Down
25 changes: 10 additions & 15 deletions src/ansys/geometry/core/tools/problem_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
from abc import abstractmethod
from typing import TYPE_CHECKING

from ansys.api.geometry.v0.repairtools_pb2_grpc import RepairToolsStub
from google.protobuf.wrappers_pb2 import Int32Value

import ansys.geometry.core as pyansys_geom
from ansys.geometry.core.connection import GrpcClient
from ansys.geometry.core.misc.auxiliary import (
Expand Down Expand Up @@ -57,8 +54,6 @@ class ProblemArea:
def __init__(self, id: str, grpc_client: GrpcClient):
"""Initialize a new instance of a problem area class."""
self._id = id
self._grpc_id = Int32Value(value=int(id))
self._repair_stub = RepairToolsStub(grpc_client.channel)
self._grpc_client = grpc_client

@property
Expand Down Expand Up @@ -138,7 +133,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_face(self.faces[0])
response = self._grpc_client.services.repair_tools.fix_duplicate_faces(
duplicate_face_problem_area_id=self._grpc_id
duplicate_face_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -192,7 +187,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_edge(self.edges[0])
response = self._grpc_client.services.repair_tools.fix_missing_faces(
missing_face_problem_area_id=self._grpc_id
missing_face_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -247,7 +242,7 @@ def fix(self) -> RepairToolMessage:
parent_design = get_design_from_edge(self.edges[0])

response = self._grpc_client.services.repair_tools.fix_inexact_edges(
inexact_edge_problem_area_id=self._grpc_id
inexact_edge_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -301,7 +296,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_edge(self.edges[0])
response = self._grpc_client.services.repair_tools.fix_extra_edges(
extra_edge_problem_area_id=self._grpc_id
extra_edge_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -355,7 +350,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_edge(self.edges[0])
response = self._grpc_client.services.repair_tools.fix_short_edges(
short_edge_problem_area_id=self._grpc_id
short_edge_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -409,7 +404,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_face(self.faces[0])
response = self._grpc_client.services.repair_tools.fix_small_faces(
small_face_problem_area_id=self._grpc_id
small_face_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -463,7 +458,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_edge(self.edges[0])
response = self._grpc_client.services.repair_tools.fix_split_edges(
split_edge_problem_area_id=self._grpc_id
split_edge_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -517,7 +512,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_body(self.bodies[0])
response = self._grpc_client.services.repair_tools.fix_stitch_faces(
stitch_face_problem_area_id=self._grpc_id
stitch_face_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -566,7 +561,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_face(self.faces[0])
response = self._grpc_client.services.repair_tools.fix_unsimplified_faces(
adjust_simplify_problem_area_id=self._grpc_id
adjust_simplify_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down Expand Up @@ -620,7 +615,7 @@ def fix(self) -> RepairToolMessage:

parent_design = get_design_from_body(self.bodies[0])
response = self._grpc_client.services.repair_tools.fix_interference(
interference_problem_area_id=self._grpc_id
interference_problem_area_id=int(self.id)
)

if not pyansys_geom.USE_TRACKER_TO_UPDATE_DESIGN:
Expand Down