Skip to content

Commit 65f37ab

Browse files
authored
Merge pull request #858 from jdegenstein/ocp781_minimal_changes
Minimal changes to support OCP >= 7.8 in gumy/build123d@ocp781
2 parents 61ddeed + b93538c commit 65f37ab

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ classifiers = [
3535
]
3636

3737
dependencies = [
38-
"cadquery-ocp >= 7.7.0",
38+
"cadquery-ocp >= 7.8.1",
3939
"typing_extensions >= 4.6.0, <5",
4040
"numpy >= 2, <3",
4141
"svgpathtools >= 1.5.1, <2",

src/build123d/topology/shape_core.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@
167167
from .composite import Compound # pylint: disable=R0801
168168
from build123d.build_part import BuildPart # pylint: disable=R0801
169169

170-
HASH_CODE_MAX = 2147483647
171170
Shapes = Literal["Vertex", "Edge", "Wire", "Face", "Shell", "Solid", "Compound"]
172171
TrimmingTool = Union[Plane, "Shell", "Face"]
173172
TOPODS = TypeVar("TOPODS", bound=TopoDS_Shape)
@@ -805,8 +804,10 @@ def __eq__(self, other) -> bool:
805804
return NotImplemented
806805

807806
def __hash__(self) -> int:
808-
"""Return has code"""
809-
return self.hash_code()
807+
"""Return hash code"""
808+
if self.wrapped is None:
809+
return 0
810+
return hash(self.wrapped)
810811

811812
def __rmul__(self, other):
812813
"""right multiply for positioning operator *"""
@@ -1181,19 +1182,6 @@ def get_top_level_shapes(self) -> ShapeList[Shape]:
11811182
self.__class__.cast(s) for s in get_top_level_topods_shapes(self.wrapped)
11821183
)
11831184

1184-
def hash_code(self) -> int:
1185-
"""Returns a hashed value denoting this shape. It is computed from the
1186-
TShape and the Location. The Orientation is not used.
1187-
1188-
Args:
1189-
1190-
Returns:
1191-
1192-
"""
1193-
if self.wrapped is None:
1194-
return 0
1195-
return self.wrapped.HashCode(HASH_CODE_MAX)
1196-
11971185
def intersect(
11981186
self, *to_intersect: Shape | Axis | Plane
11991187
) -> None | Self | ShapeList[Self]:
@@ -2852,7 +2840,7 @@ def _topods_entities(shape: TopoDS_Shape, topo_type: Shapes) -> list[TopoDS_Shap
28522840

28532841
while explorer.More():
28542842
item = explorer.Current()
2855-
out[item.HashCode(HASH_CODE_MAX)] = (
2843+
out[hash(item)] = (
28562844
item # needed to avoid pseudo-duplicate entities
28572845
)
28582846
explorer.Next()

0 commit comments

Comments
 (0)