Skip to content

Commit ded21c9

Browse files
committed
retain backward compatibility
For versions prior to 25.2 we have to call the core API methods for boolean since proto changes made in 25.2 are needed for the command implementation
1 parent 29c21e2 commit ded21c9

File tree

1 file changed

+17
-11
lines changed
  • src/ansys/geometry/core/designer

1 file changed

+17
-11
lines changed

src/ansys/geometry/core/designer/body.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,20 +1610,26 @@ def plot( # noqa: D102
16101610
pl.show(screenshot=screenshot, **plotting_options)
16111611

16121612
def intersect(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: # noqa: D102
1613-
# self.__generic_boolean_op(other, keep_other, "intersect", "bodies do not intersect")
1614-
self.__generic_boolean_command(
1615-
other, keep_other, False, "intersect", "bodies do not intersect"
1616-
)
1613+
if self._grpc_client.backend_version < (25, 2, 0):
1614+
self.__generic_boolean_op(other, keep_other, "intersect", "bodies do not intersect")
1615+
else:
1616+
self.__generic_boolean_command(
1617+
other, keep_other, False, "intersect", "bodies do not intersect"
1618+
)
16171619

16181620
def subtract(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: # noqa: D102
1619-
# self.__generic_boolean_op(other, keep_other, "subtract", "empty (complete) subtraction")
1620-
self.__generic_boolean_command(
1621-
other, keep_other, True, "subtract", "empty (complete) subtraction"
1622-
)
1621+
if self._grpc_client.backend_version < (25, 2, 0):
1622+
self.__generic_boolean_op(other, keep_other, "subtract", "empty (complete) subtraction")
1623+
else:
1624+
self.__generic_boolean_command(
1625+
other, keep_other, True, "subtract", "empty (complete) subtraction"
1626+
)
16231627

1624-
def unite(self, other: Union["Body", Iterable["Body"]]) -> None: # noqa: D102
1625-
# self.__generic_boolean_op(other, keep_other, "unite", "union operation failed")
1626-
self.__generic_boolean_command(other, False, False, "unite", "union operation failed")
1628+
def unite(self, other: Union["Body", Iterable["Body"]], keep_other: bool = False) -> None: # noqa: D102
1629+
if self._grpc_client.backend_version < (25, 2, 0):
1630+
self.__generic_boolean_op(other, keep_other, "unite", "union operation failed")
1631+
else:
1632+
self.__generic_boolean_command(other, False, False, "unite", "union operation failed")
16271633

16281634
@protect_grpc
16291635
@check_input_types

0 commit comments

Comments
 (0)