From aed55d2496b384351b0f5dfa406ff683e678bec8 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 15 Dec 2017 17:16:03 +0300 Subject: [PATCH] Fixes due to the union testings --- src/FeaturesPlugin/FeaturesPlugin_Union.cpp | 7 ++++--- src/FeaturesPlugin/FeaturesPlugin_Validators.cpp | 4 ++++ src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py | 10 +++++----- src/FeaturesPlugin/Test/TestUnion4Faces.py | 4 ++-- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp index 8b1a811a2..76683a26f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Union.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Union.cpp @@ -166,6 +166,7 @@ void FeaturesPlugin_Union::execute() aMakeShapeList.appendAlgo(aFillerAlgo); aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes()); } + // workaround: make copy to name edges correctly // Store result and naming. const int aModifyEdgeTag = 1; @@ -182,11 +183,11 @@ void FeaturesPlugin_Union::execute() for(ListOfShape::const_iterator anIter = anObjects.begin(); anIter != anObjects.end(); ++anIter) { aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::EDGE, aModifyEdgeTag, aModEName, aMapOfShapes, - false, false, true); + true, false, true); aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aModifyFaceTag, aModFName, aMapOfShapes, - false, false, true); - aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag); + true, false, true); + //aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag); } setResult(aResultBody); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp index 0df681c49..41fcdc652 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Validators.cpp @@ -896,6 +896,10 @@ bool FeaturesPlugin_ValidatorUnionSelection::isValid(const AttributePtr& theAttr bool isSameFound = false; AttributeSelectionPtr anAttrSelectionInList = aBaseObjectsAttrList->value(anIndex); ResultPtr aContext = anAttrSelectionInList->context(); + if (!aContext.get()) { + theError = "Error: selection is invalid."; + return false; + } ResultConstructionPtr aConstruction = std::dynamic_pointer_cast(aContext); diff --git a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py index a39c10cec..da123a80b 100644 --- a/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py +++ b/src/FeaturesPlugin/Test/TestUnion4CurvedFaces.py @@ -37,13 +37,13 @@ SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), S SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result()) model.do() Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")]) -Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 360, 0) -Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")]) -Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_8"), model.selection("FACE", "Partition_1_1_7")]) +Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 200, 0) +Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "Revolution_1_1")]) +Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")]) model.do() -model.checkBooleansResult(Partition_1,model,1,[8],[0],[8],[32],[64]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkBooleansResult(Union_1,model,1,[0],[0],[1],[4],[8]) +model.testHaveNamingSubshapes(Union_1,model,Part_1_doc) model.end() diff --git a/src/FeaturesPlugin/Test/TestUnion4Faces.py b/src/FeaturesPlugin/Test/TestUnion4Faces.py index f499624df..7557083df 100644 --- a/src/FeaturesPlugin/Test/TestUnion4Faces.py +++ b/src/FeaturesPlugin/Test/TestUnion4Faces.py @@ -58,8 +58,8 @@ Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1" Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]) model.do() -model.checkBooleansResult(Partition_1,model,1,[4],[0],[4],[18],[36]) -model.testHaveNamingSubshapes(Partition_1,model,Part_1_doc) +model.checkBooleansResult(Union_1,model,1,[2],[0],[2],[13],[26]) +#model.testHaveNamingSubshapes(Union_1,model,Part_1_doc) model.end() -- 2.39.2