]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Split entities are renamed in Sketch test, constraint split is corrected to store...
authornds <nds@opencascade.com>
Thu, 1 Sep 2016 11:14:25 +0000 (14:14 +0300)
committernds <nds@opencascade.com>
Thu, 1 Sep 2016 11:14:46 +0000 (14:14 +0300)
src/SketchPlugin/SketchPlugin_ConstraintSplit.cpp
src/SketchPlugin/Test/TestSplit.py

index 05eb84265676355af28615f314ffb583c42649e6..5681155a21c47db42b3cc66923719c0e5a5e3d9e 100755 (executable)
@@ -983,6 +983,12 @@ FeaturePtr SketchPlugin_ConstraintSplit::createArcFeature(const FeaturePtr& theB
                 theBaseFeature->attribute(aCenterAttributeId));
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::START_ID()), theFirstPointAttr);
   fillAttribute(aFeature->attribute(SketchPlugin_Arc::END_ID()), theSecondPointAttr);
+
+  /// fill referersed state of created arc as it is on the base arc
+  if (theBaseFeature->getKind() == SketchPlugin_Arc::ID()) {
+    bool aReversed = theBaseFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->value();
+    aFeature->boolean(SketchPlugin_Arc::INVERSED_ID())->setValue(aReversed);
+  }
   aFeature->data()->blockSendAttributeUpdated(false);
   aFeature->execute(); // to obtain result
 
index aa140610cb2db15244e8d10d5a92fe29fb555519..6cc31d3a0583a1d0d4b4f7d19b3477ded90918b4 100644 (file)
@@ -34,19 +34,19 @@ assert(idList.count(SketchConstraintParallelId) == 1)
 # Test end
 
 # Test split on line with two points
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_1 = Sketch_1.addLine(0, 50, 100, 50)
-SketchPoint_1 = Sketch_1.addPoint(25, 50)
-SketchPoint_2 = Sketch_1.addPoint(75, 50)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result()[0])
-SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result()[0])
-Sketch_1.addSplit(SketchLine_1, SketchPoint_1.coordinates(), SketchPoint_2.coordinates())
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_2_1 = Sketch_2.addLine(0, 50, 100, 50)
+SketchPoint_2_1 = Sketch_2.addPoint(25, 50)
+SketchPoint_2_2 = Sketch_2.addPoint(75, 50)
+SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident(SketchPoint_2_1.coordinates(), SketchLine_2_1.result()[0])
+SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident(SketchPoint_2_2.coordinates(), SketchLine_2_1.result()[0])
+Sketch_2.addSplit(SketchLine_2_1, SketchPoint_2_1.coordinates(), SketchPoint_2_2.coordinates())
 model.do()
 
-Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature())
+Sketch_2_feature = featureToCompositeFeature(Sketch_2.feature())
 idList = []
-for index in range(Sketch_1_feature.numberOfSubs()):
-  idList.append(Sketch_1_feature.subFeature(index).getKind())
+for index in range(Sketch_2_feature.numberOfSubs()):
+  idList.append(Sketch_2_feature.subFeature(index).getKind())
 
 assert(idList.count(SketchLineId) == 3)
 assert(idList.count(SketchPointId) == 2)
@@ -55,19 +55,19 @@ assert(idList.count(SketchConstraintParallelId) == 2)
 # Test end
 
 # Test split on circle with two points
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(50, 50, 50)
-SketchPoint_1 = Sketch_1.addPoint(50, 0)
-SketchPoint_2 = Sketch_1.addPoint(50, 100)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_1.result()[0])
-SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.result()[0])
-Sketch_1.addSplit(SketchCircle_1, SketchPoint_1.coordinates(), SketchPoint_2.coordinates())
+Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_3_1 = Sketch_3.addCircle(50, 50, 50)
+SketchPoint_3_1 = Sketch_3.addPoint(50, 0)
+SketchPoint_3_2 = Sketch_3.addPoint(50, 100)
+SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident(SketchPoint_3_1.coordinates(), SketchCircle_3_1.result()[0])
+SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident(SketchPoint_3_2.coordinates(), SketchCircle_3_1.result()[0])
+Sketch_3.addSplit(SketchCircle_3_1, SketchPoint_3_1.coordinates(), SketchPoint_3_2.coordinates())
 model.do()
 
-Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature())
+Sketch_3_feature = featureToCompositeFeature(Sketch_3.feature())
 idList = []
-for index in range(Sketch_1_feature.numberOfSubs()):
-  idList.append(Sketch_1_feature.subFeature(index).getKind())
+for index in range(Sketch_3_feature.numberOfSubs()):
+  idList.append(Sketch_3_feature.subFeature(index).getKind())
 
 assert(idList.count(SketchArcId) == 2)
 assert(idList.count(SketchPointId) == 2)
@@ -76,20 +76,20 @@ assert(idList.count(SketchConstraintTangentId) == 1)
 # Test end
 
 # Test split on arc with one point
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchArc_1 = Sketch_1.addArc(50, 50, 0, 50, 100, 50, True)
-Sketch_1.setFixed(SketchArc_1.startPoint())
-Sketch_1.setFixed(SketchArc_1.endPoint())
-Sketch_1.setRadius(SketchArc_1, 50)
-SketchPoint_1 = Sketch_1.addPoint(50, 100)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.result()[0])
-Sketch_1.addSplit(SketchArc_1, SketchPoint_1.coordinates(), SketchArc_1.endPoint())
+Sketch_4 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchArc_4_1 = Sketch_4.addArc(50, 50, 0, 50, 100, 50, True)
+Sketch_4.setFixed(SketchArc_4_1.startPoint())
+Sketch_4.setFixed(SketchArc_4_1.endPoint())
+Sketch_4.setRadius(SketchArc_4_1, 50)
+SketchPoint_4_1 = Sketch_4.addPoint(50, 100)
+SketchConstraintCoincidence_4_1 = Sketch_4.setCoincident(SketchPoint_4_1.coordinates(), SketchArc_4_1.result()[0])
+Sketch_4.addSplit(SketchArc_4_1, SketchPoint_4_1.coordinates(), SketchArc_4_1.endPoint())
 model.do()
 
-Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature())
+Sketch_4_feature = featureToCompositeFeature(Sketch_4.feature())
 idList = []
-for index in range(Sketch_1_feature.numberOfSubs()):
-  idList.append(Sketch_1_feature.subFeature(index).getKind())
+for index in range(Sketch_4_feature.numberOfSubs()):
+  idList.append(Sketch_4_feature.subFeature(index).getKind())
 
 assert(idList.count(SketchArcId) == 2)
 assert(idList.count(SketchPointId) == 1)
@@ -99,22 +99,22 @@ assert(idList.count(SketchConstraintTangentId) == 1)
 # Test end
 
 # Test split on arc with two points
-Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchArc_1 = Sketch_1.addArc(50, 50, 0, 50, 100, 50, True)
-Sketch_1.setFixed(SketchArc_1.startPoint())
-Sketch_1.setFixed(SketchArc_1.endPoint())
-Sketch_1.setRadius(SketchArc_1, 50)
-SketchPoint_1 = Sketch_1.addPoint(25, 93.301270189222)
-SketchPoint_2 = Sketch_1.addPoint(75, 93.301270189222)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_1.result()[0])
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchArc_1.result()[0])
-Sketch_1.addSplit(SketchArc_1, SketchPoint_1.coordinates(), SketchPoint_2.coordinates())
+Sketch_5 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchArc_5_1 = Sketch_5.addArc(50, 50, 0, 50, 100, 50, True)
+Sketch_5.setFixed(SketchArc_5_1.startPoint())
+Sketch_5.setFixed(SketchArc_5_1.endPoint())
+Sketch_5.setRadius(SketchArc_5_1, 50)
+SketchPoint_5_1 = Sketch_5.addPoint(25, 93.301270189222)
+SketchPoint_5_2 = Sketch_5.addPoint(75, 93.301270189222)
+SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident(SketchPoint_5_1.coordinates(), SketchArc_5_1.result()[0])
+SketchConstraintCoincidence_5_1 = Sketch_5.setCoincident(SketchPoint_5_2.coordinates(), SketchArc_5_1.result()[0])
+Sketch_5.addSplit(SketchArc_5_1, SketchPoint_5_1.coordinates(), SketchPoint_5_2.coordinates())
 model.do()
 
-Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature())
+Sketch_5_feature = featureToCompositeFeature(Sketch_5.feature())
 idList = []
-for index in range(Sketch_1_feature.numberOfSubs()):
-  idList.append(Sketch_1_feature.subFeature(index).getKind())
+for index in range(Sketch_5_feature.numberOfSubs()):
+  idList.append(Sketch_5_feature.subFeature(index).getKind())
 
 assert(idList.count(SketchArcId) == 3)
 assert(idList.count(SketchPointId) == 2)