From 27c9c9d0acc6396f50d283f62771bb6fe6ba4eec Mon Sep 17 00:00:00 2001 From: Eric Price Date: Sun, 27 Oct 2024 20:53:28 +0100 Subject: [PATCH 1/5] work on #17497 - recursively cut shapes in a compound iindividually to work around OCCT limitation --- .../App/FCBRepAlgoAPI_BooleanOperation.cpp | 32 +++++++++++++++++++ .../Part/App/FCBRepAlgoAPI_BooleanOperation.h | 7 ++++ 2 files changed, 39 insertions(+) diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp index 96af048107..7c888187b2 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp @@ -30,7 +30,9 @@ #include #include #include +#include #include +#include #include #include @@ -78,3 +80,33 @@ void FCBRepAlgoAPIHelper::setAutoFuzzy(BRepAlgoAPI_BuilderAlgo* op) { BRepBndLib::Add(it.Value(), bounds); op->SetFuzzyValue(Part::FuzzyHelper::getBooleanFuzzy() * sqrt(bounds.SquareExtent()) * Precision::Confusion()); } + +void FCBRepAlgoAPI_BooleanOperation::Build(const Message_ProgressRange& theRange) { + + if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) { + myOriginalArguments = myArguments; + myShape = RecursiveCutCompound(myOriginalArguments.First(), theRange); + } else { + return BRepAlgoAPI_BooleanOperation::Build(theRange); + } + +} + +const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange) { + BRep_Builder builder; + TopoDS_Compound comp; + builder.MakeCompound(comp); + TopoDS_Iterator it(theArgument); + for (; it.More(); it.Next()) { + TopTools_ListOfShape currentArguments; + currentArguments.Append(it.Value()); + myArguments = currentArguments; + Build(theRange); + if (IsDone()) { + builder.Add(comp, myShape); + } else { + return TopoDS_Shape(); + } + } + return comp; +} diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h index dcd3451e14..a0e392c00e 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h @@ -49,6 +49,8 @@ public: // set fuzzyness based on size void setAutoFuzzy(); + Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + protected: //! @name Constructors //! Constructor to perform Boolean operation on only two arguments. @@ -57,5 +59,10 @@ protected: //! @name Constructors const TopoDS_Shape& theS2, const BOPAlgo_Operation theOperation); + +private: + TopTools_ListOfShape myOriginalArguments; + Standard_EXPORT const TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange); + }; #endif From 648bb8f5e4728c2bbf85899770878247ed8e80a1 Mon Sep 17 00:00:00 2001 From: Eric Price Date: Sun, 27 Oct 2024 22:16:14 +0100 Subject: [PATCH 2/5] fix #17497 --- .../App/FCBRepAlgoAPI_BooleanOperation.cpp | 35 ++++++++++++++++--- .../Part/App/FCBRepAlgoAPI_BooleanOperation.h | 3 +- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp index 7c888187b2..6e6a069ad8 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp @@ -83,13 +83,19 @@ void FCBRepAlgoAPIHelper::setAutoFuzzy(BRepAlgoAPI_BuilderAlgo* op) { void FCBRepAlgoAPI_BooleanOperation::Build(const Message_ProgressRange& theRange) { - if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) { - myOriginalArguments = myArguments; + if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myTools.Size()==1 && myTools.First().ShapeType() == TopAbs_COMPOUND) { + TopTools_ListOfShape myOriginalTools = myTools; + TopTools_ListOfShape myOriginalArguments = myArguments; + myShape = RecursiveCutByCompound(myOriginalArguments.First(), myOriginalTools.First(), theRange); + myArguments = myOriginalArguments; + myTools = myOriginalTools; + } else if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) { + TopTools_ListOfShape myOriginalArguments = myArguments; myShape = RecursiveCutCompound(myOriginalArguments.First(), theRange); + myArguments = myOriginalArguments; } else { - return BRepAlgoAPI_BooleanOperation::Build(theRange); + BRepAlgoAPI_BooleanOperation::Build(theRange); } - } const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange) { @@ -110,3 +116,24 @@ const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const To } return comp; } + + +const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutByCompound(const TopoDS_Shape& theArgument, const TopoDS_Shape& theTool, const Message_ProgressRange& theRange) { + TopoDS_Shape result = theArgument; + TopoDS_Iterator it(theTool); + for (; it.More(); it.Next()) { + TopTools_ListOfShape currentArguments; + TopTools_ListOfShape currentTools; + currentArguments.Append(result); + currentTools.Append(it.Value()); + myArguments = currentArguments; + myTools = currentTools; + Build(theRange); + if (IsDone()) { + result = myShape; + } else { + return TopoDS_Shape(); + } + } + return result; +} diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h index a0e392c00e..5c90d02218 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h @@ -61,8 +61,7 @@ protected: //! @name Constructors private: - TopTools_ListOfShape myOriginalArguments; Standard_EXPORT const TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange); - + Standard_EXPORT const TopoDS_Shape RecursiveCutByCompound(const TopoDS_Shape& theArgument, const TopoDS_Shape& theTool, const Message_ProgressRange& theRange); }; #endif From f8f525e62d5348b3957a21e0c38ba991497e71de Mon Sep 17 00:00:00 2001 From: Eric Price Date: Tue, 29 Oct 2024 23:46:54 +0100 Subject: [PATCH 3/5] reimplemented recursive cutting tools for better efficiency - merge in a single fuse then perform a single cut - still doesn't fix the issue with toponaming --- .../App/FCBRepAlgoAPI_BooleanOperation.cpp | 82 +++++++++++-------- .../Part/App/FCBRepAlgoAPI_BooleanOperation.h | 6 +- 2 files changed, 50 insertions(+), 38 deletions(-) diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp index 6e6a069ad8..de6fad06fe 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp @@ -81,24 +81,56 @@ void FCBRepAlgoAPIHelper::setAutoFuzzy(BRepAlgoAPI_BuilderAlgo* op) { op->SetFuzzyValue(Part::FuzzyHelper::getBooleanFuzzy() * sqrt(bounds.SquareExtent()) * Precision::Confusion()); } -void FCBRepAlgoAPI_BooleanOperation::Build(const Message_ProgressRange& theRange) { - if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myTools.Size()==1 && myTools.First().ShapeType() == TopAbs_COMPOUND) { - TopTools_ListOfShape myOriginalTools = myTools; - TopTools_ListOfShape myOriginalArguments = myArguments; - myShape = RecursiveCutByCompound(myOriginalArguments.First(), myOriginalTools.First(), theRange); - myArguments = myOriginalArguments; - myTools = myOriginalTools; - } else if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) { - TopTools_ListOfShape myOriginalArguments = myArguments; - myShape = RecursiveCutCompound(myOriginalArguments.First(), theRange); - myArguments = myOriginalArguments; - } else { - BRepAlgoAPI_BooleanOperation::Build(theRange); +void FCBRepAlgoAPI_BooleanOperation::RecursiveAddArguments(const TopoDS_Shape& theArgument) { + TopoDS_Iterator it(theArgument); + for (; it.More(); it.Next()) { + if (it.Value().ShapeType() == TopAbs_COMPOUND) { + RecursiveAddArguments(it.Value()); + } else { + if (!myArguments.Size()) { + myArguments.Append(it.Value()); + } else { + myTools.Append(it.Value()); + } + } } } -const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange) { +void FCBRepAlgoAPI_BooleanOperation::Build() { + + if (myOperation == BOPAlgo_CUT && myArguments.Size() == 1 && myTools.Size() == 1 && myTools.First().ShapeType() == TopAbs_COMPOUND) { + TopTools_ListOfShape myOriginalArguments = myArguments; + TopTools_ListOfShape myOriginalTools = myTools; + TopTools_ListOfShape currentTools, currentArguments; + myArguments = currentArguments; + myTools = currentTools; + RecursiveAddArguments(myOriginalTools.First()); + if (myTools.Size()) { + myOperation = BOPAlgo_FUSE; // fuse tools together + Build(); + myOperation = BOPAlgo_CUT; // restore + myArguments = myOriginalArguments; + if (IsDone()) { + myTools.Append(myShape); + Build(); // cut with fused tools + } + myTools = myOriginalTools; //restore + } else { // there was less than 2 shapes in the compound + myArguments = myOriginalArguments; + myTools = myOriginalTools; //restore + Build(); + } + } else if (myOperation==BOPAlgo_CUT && myArguments.Size()==1 && myArguments.First().ShapeType() == TopAbs_COMPOUND) { + TopTools_ListOfShape myOriginalArguments = myArguments; + myShape = RecursiveCutCompound(myOriginalArguments.First()); + myArguments = myOriginalArguments; + } else { + BRepAlgoAPI_BooleanOperation::Build(); + } +} + +const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument) { BRep_Builder builder; TopoDS_Compound comp; builder.MakeCompound(comp); @@ -107,7 +139,7 @@ const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const To TopTools_ListOfShape currentArguments; currentArguments.Append(it.Value()); myArguments = currentArguments; - Build(theRange); + Build(); if (IsDone()) { builder.Add(comp, myShape); } else { @@ -117,23 +149,3 @@ const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const To return comp; } - -const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutByCompound(const TopoDS_Shape& theArgument, const TopoDS_Shape& theTool, const Message_ProgressRange& theRange) { - TopoDS_Shape result = theArgument; - TopoDS_Iterator it(theTool); - for (; it.More(); it.Next()) { - TopTools_ListOfShape currentArguments; - TopTools_ListOfShape currentTools; - currentArguments.Append(result); - currentTools.Append(it.Value()); - myArguments = currentArguments; - myTools = currentTools; - Build(theRange); - if (IsDone()) { - result = myShape; - } else { - return TopoDS_Shape(); - } - } - return result; -} diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h index 5c90d02218..4d1254c4d4 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h @@ -49,7 +49,7 @@ public: // set fuzzyness based on size void setAutoFuzzy(); - Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE; + Standard_EXPORT virtual void Build(); // not an override - real Build() has optionals, sadly type of those optionals that are differs between OCCT versions protected: //! @name Constructors @@ -61,7 +61,7 @@ protected: //! @name Constructors private: - Standard_EXPORT const TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument, const Message_ProgressRange& theRange); - Standard_EXPORT const TopoDS_Shape RecursiveCutByCompound(const TopoDS_Shape& theArgument, const TopoDS_Shape& theTool, const Message_ProgressRange& theRange); + Standard_EXPORT const TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument); + Standard_EXPORT void RecursiveAddArguments(const TopoDS_Shape& theArgument); }; #endif From 14ebae538f404ababbbabf0cf68ee759e7af78e4 Mon Sep 17 00:00:00 2001 From: Eric Price Date: Sun, 17 Nov 2024 17:59:13 +0100 Subject: [PATCH 4/5] Added test case --- src/Mod/Part/parttests/TopoShapeTest.py | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Mod/Part/parttests/TopoShapeTest.py b/src/Mod/Part/parttests/TopoShapeTest.py index 214a064557..a6a6405e2d 100644 --- a/src/Mod/Part/parttests/TopoShapeTest.py +++ b/src/Mod/Part/parttests/TopoShapeTest.py @@ -73,6 +73,13 @@ class TopoShapeTest(unittest.TestCase, TopoShapeAssertions): self.doc.Box2.Length = 2 self.doc.Box2.Width = 1 self.doc.Box2.Height = 2 + self.doc.addObject("Part::Cylinder", "Cylinder1") + self.doc.Cylinder1.Radius = 0.5 + self.doc.Cylinder1.Height = 2 + self.doc.Cylinder1.Angle = 360 + self.doc.addObject("Part::Compound", "Compound1") + self.doc.Compound1.Links = [ self.doc.Box1, self.doc.Box2 ] + self.doc.recompute() self.box = self.doc.Box1.Shape self.box2 = self.doc.Box2.Shape @@ -758,3 +765,32 @@ class TopoShapeTest(unittest.TestCase, TopoShapeAssertions): # self.assertEqual(result2.ElementMapSize,9) # self.assertEqual(result2.Faces[0].ElementMapSize,0) + def testPartCompoundCut1(self): + # Arrange + self.doc.addObject("Part::Cut", "Cut") + self.doc.Cut.Base = self.doc.Cylinder1 + self.doc.Cut.Tool = self.doc.Compound1 + # Act + self.doc.recompute() + cut1 = self.doc.Cut.Shape + # Assert elementMap + refkeys = ['Vertex6', 'Vertex5', 'Edge7', 'Edge8', 'Edge9', 'Edge5', 'Edge6', 'Face4', 'Face2', 'Edge1', 'Vertex4', 'Edge4', 'Vertex3', 'Edge2', 'Edge3', 'Face1', 'Face5', 'Face3', 'Vertex1', 'Vertex2'] + if cut1.ElementMapVersion != "": # Should be '4' as of Mar 2023. + self.assertKeysInMap(cut1.ElementReverseMap, refkeys ) + self.assertEqual(len(cut1.ElementReverseMap.keys()),len(refkeys)) + # Assert Volume + self.assertAlmostEqual(cut1.Volume, self.doc.Cylinder1.Shape.Volume * (3/4)) + + def testPartCompoundCut2(self): + # Arrange + self.doc.addObject("Part::Cut", "Cut") + self.doc.Cut.Base = self.doc.Compound1 + self.doc.Cut.Tool = self.doc.Cylinder1 + # Act + self.doc.recompute() + cut1 = self.doc.Cut.Shape + # Assert elementMap + refkeys = ['Vertex3', 'Vertex4', 'Vertex8', 'Vertex10', 'Vertex7', 'Vertex9', 'Vertex13', 'Vertex14', 'Vertex18', 'Vertex20', 'Vertex17', 'Vertex19', 'Edge3', 'Edge15', 'Edge9', 'Edge12', 'Edge13', 'Edge11', 'Edge8', 'Edge17', 'Edge18', 'Edge19', 'Edge30', 'Edge24', 'Edge27', 'Edge28', 'Edge29', 'Edge25', 'Edge26', 'Edge23', 'Face7', 'Face4', 'Face8', 'Face14', 'Face13', 'Face11', 'Face12', 'Face10', 'Edge22', 'Vertex12', 'Edge20', 'Vertex11', 'Edge21', 'Edge16', 'Face9', 'Vertex15', 'Vertex16'] + if cut1.ElementMapVersion != "": # Should be '4' as of Mar 2023. + self.assertKeysInMap(cut1.ElementReverseMap, refkeys ) + self.assertEqual(len(cut1.ElementReverseMap.keys()),len(refkeys)) From dbbd07510f4f3668cea81c11f6c9414d14648c45 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Fri, 7 Feb 2025 19:51:11 +0100 Subject: [PATCH 5/5] Fix lint issues --- .../Part/App/FCBRepAlgoAPI_BooleanOperation.cpp | 11 ++++++----- src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h | 9 +++++---- src/Mod/Part/parttests/TopoShapeTest.py | 15 +++++++++++++-- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp index de6fad06fe..9f6e56ab42 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.cpp @@ -88,7 +88,7 @@ void FCBRepAlgoAPI_BooleanOperation::RecursiveAddArguments(const TopoDS_Shape& t if (it.Value().ShapeType() == TopAbs_COMPOUND) { RecursiveAddArguments(it.Value()); } else { - if (!myArguments.Size()) { + if (myArguments.IsEmpty()) { myArguments.Append(it.Value()); } else { myTools.Append(it.Value()); @@ -102,11 +102,12 @@ void FCBRepAlgoAPI_BooleanOperation::Build() { if (myOperation == BOPAlgo_CUT && myArguments.Size() == 1 && myTools.Size() == 1 && myTools.First().ShapeType() == TopAbs_COMPOUND) { TopTools_ListOfShape myOriginalArguments = myArguments; TopTools_ListOfShape myOriginalTools = myTools; - TopTools_ListOfShape currentTools, currentArguments; + TopTools_ListOfShape currentTools; + TopTools_ListOfShape currentArguments; myArguments = currentArguments; myTools = currentTools; RecursiveAddArguments(myOriginalTools.First()); - if (myTools.Size()) { + if (!myTools.IsEmpty()) { myOperation = BOPAlgo_FUSE; // fuse tools together Build(); myOperation = BOPAlgo_CUT; // restore @@ -130,7 +131,7 @@ void FCBRepAlgoAPI_BooleanOperation::Build() { } } -const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument) { +TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const TopoDS_Shape& theArgument) { BRep_Builder builder; TopoDS_Compound comp; builder.MakeCompound(comp); @@ -143,7 +144,7 @@ const TopoDS_Shape FCBRepAlgoAPI_BooleanOperation::RecursiveCutCompound(const To if (IsDone()) { builder.Add(comp, myShape); } else { - return TopoDS_Shape(); + return {}; } } return comp; diff --git a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h index 4d1254c4d4..d86a5f0910 100644 --- a/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h +++ b/src/Mod/Part/App/FCBRepAlgoAPI_BooleanOperation.h @@ -49,19 +49,20 @@ public: // set fuzzyness based on size void setAutoFuzzy(); - Standard_EXPORT virtual void Build(); // not an override - real Build() has optionals, sadly type of those optionals that are differs between OCCT versions + // not an override - real Build() has optionals, sadly type of those optionals that are differs between OCCT versions + Standard_EXPORT virtual void Build(); // NOLINT(clang-diagnostic-overloaded-virtual, -Woverloaded-virtual) protected: //! @name Constructors //! Constructor to perform Boolean operation on only two arguments. //! Obsolete Standard_EXPORT FCBRepAlgoAPI_BooleanOperation(const TopoDS_Shape& theS1, - const TopoDS_Shape& theS2, - const BOPAlgo_Operation theOperation); + const TopoDS_Shape& theS2, + BOPAlgo_Operation theOperation); private: - Standard_EXPORT const TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument); + Standard_EXPORT TopoDS_Shape RecursiveCutCompound(const TopoDS_Shape& theArgument); Standard_EXPORT void RecursiveAddArguments(const TopoDS_Shape& theArgument); }; #endif diff --git a/src/Mod/Part/parttests/TopoShapeTest.py b/src/Mod/Part/parttests/TopoShapeTest.py index a6a6405e2d..c41e789794 100644 --- a/src/Mod/Part/parttests/TopoShapeTest.py +++ b/src/Mod/Part/parttests/TopoShapeTest.py @@ -774,7 +774,11 @@ class TopoShapeTest(unittest.TestCase, TopoShapeAssertions): self.doc.recompute() cut1 = self.doc.Cut.Shape # Assert elementMap - refkeys = ['Vertex6', 'Vertex5', 'Edge7', 'Edge8', 'Edge9', 'Edge5', 'Edge6', 'Face4', 'Face2', 'Edge1', 'Vertex4', 'Edge4', 'Vertex3', 'Edge2', 'Edge3', 'Face1', 'Face5', 'Face3', 'Vertex1', 'Vertex2'] + refkeys = [ + 'Vertex6', 'Vertex5', 'Edge7', 'Edge8', 'Edge9', 'Edge5', 'Edge6', 'Face4', 'Face2', + 'Edge1', 'Vertex4', 'Edge4', 'Vertex3', 'Edge2', 'Edge3', 'Face1', 'Face5', 'Face3', + 'Vertex1', 'Vertex2' + ] if cut1.ElementMapVersion != "": # Should be '4' as of Mar 2023. self.assertKeysInMap(cut1.ElementReverseMap, refkeys ) self.assertEqual(len(cut1.ElementReverseMap.keys()),len(refkeys)) @@ -790,7 +794,14 @@ class TopoShapeTest(unittest.TestCase, TopoShapeAssertions): self.doc.recompute() cut1 = self.doc.Cut.Shape # Assert elementMap - refkeys = ['Vertex3', 'Vertex4', 'Vertex8', 'Vertex10', 'Vertex7', 'Vertex9', 'Vertex13', 'Vertex14', 'Vertex18', 'Vertex20', 'Vertex17', 'Vertex19', 'Edge3', 'Edge15', 'Edge9', 'Edge12', 'Edge13', 'Edge11', 'Edge8', 'Edge17', 'Edge18', 'Edge19', 'Edge30', 'Edge24', 'Edge27', 'Edge28', 'Edge29', 'Edge25', 'Edge26', 'Edge23', 'Face7', 'Face4', 'Face8', 'Face14', 'Face13', 'Face11', 'Face12', 'Face10', 'Edge22', 'Vertex12', 'Edge20', 'Vertex11', 'Edge21', 'Edge16', 'Face9', 'Vertex15', 'Vertex16'] + refkeys = [ + 'Vertex3', 'Vertex4', 'Vertex8', 'Vertex10', 'Vertex7', 'Vertex9', 'Vertex13', + 'Vertex14', 'Vertex18', 'Vertex20', 'Vertex17', 'Vertex19', 'Edge3', 'Edge15', 'Edge9', + 'Edge12', 'Edge13', 'Edge11', 'Edge8', 'Edge17', 'Edge18', 'Edge19', 'Edge30', 'Edge24', + 'Edge27', 'Edge28', 'Edge29', 'Edge25', 'Edge26', 'Edge23', 'Face7', 'Face4', 'Face8', + 'Face14', 'Face13', 'Face11', 'Face12', 'Face10', 'Edge22', 'Vertex12', 'Edge20', + 'Vertex11', 'Edge21', 'Edge16', 'Face9', 'Vertex15', 'Vertex16' + ] if cut1.ElementMapVersion != "": # Should be '4' as of Mar 2023. self.assertKeysInMap(cut1.ElementReverseMap, refkeys ) self.assertEqual(len(cut1.ElementReverseMap.keys()),len(refkeys))