Add support for OCCT 7.8.0 (#11909)

This commit is contained in:
bgbsww
2024-01-09 20:47:25 -05:00
committed by GitHub
parent b1ee268d98
commit bd1fc0fc03
29 changed files with 161 additions and 35 deletions

View File

@@ -137,7 +137,12 @@ int Part::ImportStepParts(App::Document *pcDoc, const char* Name)
// This is a trick to access the GUI via Python and set the color property
// of the associated view provider. If no GUI is up an exception is thrown
// and cleared immediately
#if OCC_VERSION_HEX >= 0x070800
std::hash<TopoDS_Solid> hasher;
std::map<int, Quantity_Color>::iterator it = hash_col.find(hasher(aSolid));
#else
std::map<int, Quantity_Color>::iterator it = hash_col.find(aSolid.HashCode(INT_MAX));
#endif
if (it != hash_col.end()) {
try {
Py::Object obj(pcFeature->getPyObject(), true);

View File

@@ -1306,7 +1306,11 @@ PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
TopTools_ListIteratorOfListOfShape it(ancestors);
for (; it.More(); it.Next()) {
// make sure to avoid duplicates
#if OCC_VERSION_HEX >= 0x070800
const size_t code = std::hash<TopoDS_Shape>{}(static_cast<TopoDS_Shape>(it.Value()));
#else
Standard_Integer code = it.Value().HashCode(INT_MAX);
#endif
if (hashes.find(code) == hashes.end()) {
list.append(shape2pyshape(it.Value()));
hashes.insert(code);
@@ -1928,7 +1932,11 @@ PyObject* TopoShapePy::hashCode(PyObject *args)
if (!PyArg_ParseTuple(args, "|i",&upper))
return nullptr;
#if OCC_VERSION_HEX >= 0x070800
int hc = std::hash<TopoDS_Shape>{}(getTopoShapePtr()->getShape());
#else
int hc = getTopoShapePtr()->getShape().HashCode(upper);
#endif
return Py_BuildValue("i", hc);
}