]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[Code coverage FeaturesAPI]: Improve coverage of ExtrusionBoolean feature
authorazv <azv@opencascade.com>
Tue, 18 Dec 2018 12:29:45 +0000 (15:29 +0300)
committerazv <azv@opencascade.com>
Tue, 18 Dec 2018 12:30:21 +0000 (15:30 +0300)
src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp
src/FeaturesPlugin/Test/TestExtrusionCut_ByPlanesAndOffsets.py
src/FeaturesPlugin/Test/TestExtrusionCut_BySize.py
src/FeaturesPlugin/Test/TestExtrusionFuse_ByPlanesAndOffsets.py
src/FeaturesPlugin/Test/TestExtrusionFuse_BySize.py

index c78fe3a472240af2e00363d33175161a6c68f50a..90f99e306d0ec0167b3814810dc6b4289db0a2bd 100644 (file)
@@ -263,11 +263,7 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
 {
   if(initialize()) {
     fillAttribute(theBaseObjects, mybaseObjects);
-    fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
-    fillAttribute(theToObject, mytoObject);
-    fillAttribute(theToOffset, mytoOffset);
-    fillAttribute(theFromObject, myfromObject);
-    fillAttribute(theFromOffset, myfromOffset);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
     setBooleanObjects(theBooleanObjects);
   }
 }
@@ -287,11 +283,7 @@ FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(
   if(initialize()) {
     fillAttribute(theBaseObjects, mybaseObjects);
     fillAttribute(theDirection, mydirection);
-    fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
-    fillAttribute(theToObject, mytoObject);
-    fillAttribute(theToOffset, mytoOffset);
-    fillAttribute(theFromObject, myfromObject);
-    fillAttribute(theFromOffset, myfromOffset);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
     setBooleanObjects(theBooleanObjects);
   }
 }
@@ -482,11 +474,7 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
 {
   if(initialize()) {
     fillAttribute(theBaseObjects, mybaseObjects);
-    fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
-    fillAttribute(theToObject, mytoObject);
-    fillAttribute(theToOffset, mytoOffset);
-    fillAttribute(theFromObject, myfromObject);
-    fillAttribute(theFromOffset, myfromOffset);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
     setBooleanObjects(theBooleanObjects);
   }
 }
@@ -506,11 +494,7 @@ FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(
   if(initialize()) {
     fillAttribute(theBaseObjects, mybaseObjects);
     fillAttribute(theDirection, mydirection);
-    fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
-    fillAttribute(theToObject, mytoObject);
-    fillAttribute(theToOffset, mytoOffset);
-    fillAttribute(theFromObject, myfromObject);
-    fillAttribute(theFromOffset, myfromOffset);
+    setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
     setBooleanObjects(theBooleanObjects);
   }
 }
index 6c118349a30d33b97686e92d6278aa706ba447f8..579be45ca05849531be57183156ff7fd6b0694cf 100644 (file)
@@ -38,7 +38,7 @@ Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Axis_4 = model.addAxis(Part_1_doc, 10, 10, 10)
 
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")])
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False)
 SketchLine_1 = SketchProjection_1.createdFeature()
index 907d22b0ae9f1f04808c1eb57abfa9f23a232114..fb8bd45d3930e1acb0098cb4e6e6e09332b0a770 100644 (file)
@@ -53,6 +53,20 @@ model.do()
 Shape = ExtrusionCut_1.results()[0].resultSubShapePair()[0].shape()
 checkMiddlePoint(Shape, 5.00027719467643, 4.861055360637628, 5.101882685002874)
 
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], -5, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
+SketchCircle_2 = Sketch_2.addCircle(2, 7, 1.5)
+ExtrusionCut_2.setNestedSketch(Sketch_2)
+model.do()
+
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], 0, 7, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Box_1_1/Front"))
+SketchCircle_3 = Sketch_3.addCircle(7, 2, 1.5)
+ExtrusionCut_3.setNestedSketch(Sketch_3)
+model.do()
+Shape = ExtrusionCut_3.results()[0].resultSubShapePair()[0].shape()
+checkMiddlePoint(Shape, 5.15104587473, 4.96021, 4.86946)
+
 model.end()
 
 assert(model.checkPythonDump())
index 941f6bacf33de7bceefa1bad7c0fa91423653147..aeda3c26f39f94c92dfaf2161af7be2ce5850406 100644 (file)
@@ -38,7 +38,7 @@ Part_1_doc = Part_1.document()
 Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
 Axis_4 = model.addAxis(Part_1_doc, 10, 10, 10)
 
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")])
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection("FACE", "Box_1_1/Right"), 0, model.selection(), 0, [model.selection("SOLID", "Box_1_1")])
 Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Left"))
 SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False)
 SketchLine_1 = SketchProjection_1.createdFeature()
index 3d7ce1a854338d4c838312ece3a52d3fa4fb58b6..705971438ed0d74aba38f12d38fa6de3db860e27 100644 (file)
@@ -53,6 +53,20 @@ model.do()
 Shape = ExtrusionFuse_1.results()[0].resultSubShapePair()[0].shape()
 checkMiddlePoint(Shape, 5, 4.299736969, 5.70604613)
 
+ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [], 3, [model.selection("SOLID", "ExtrusionFuse_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
+SketchCircle_2 = Sketch_2.addCircle(4, 7, 2)
+ExtrusionFuse_2.setNestedSketch(Sketch_2)
+model.do()
+
+ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [], 10, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Right"))
+SketchCircle_3 = Sketch_3.addCircle(5, -6, 3)
+ExtrusionFuse_3.setNestedSketch(Sketch_3)
+model.do()
+Shape = ExtrusionFuse_3.results()[0].resultSubShapePair()[0].shape()
+checkMiddlePoint(Shape, 5.31705479, 6.86583379, 5.82287969)
+
 model.end()
 
 assert(model.checkPythonDump())