//--------------------------------------------------------------------------------------
+std::shared_ptr<GeomAPI_Pnt2d> SketchAPI_Sketch::to2D(const std::shared_ptr<GeomAPI_Pnt>& thePoint)
+{
+ FeaturePtr aBase = feature();
+ std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
+ aBase->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aBase->attribute(SketchPlugin_Sketch::NORM_ID()));
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aBase->attribute(SketchPlugin_Sketch::DIRX_ID()));
+ std::shared_ptr<GeomAPI_Dir> aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
+
+ return thePoint->to2D(aC->pnt(), aX->dir(), aY);
+}
+
+//--------------------------------------------------------------------------------------
+
void SketchAPI_Sketch::dump(ModelHighAPI_Dumper& theDumper) const
{
FeaturePtr aBase = feature();
const std::shared_ptr<ModelHighAPI_Interface> & theConstraint,
const ModelHighAPI_Double & theValue);
+ SKETCHAPI_EXPORT
+ std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
+
// TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
/// Select face
SKETCHAPI_EXPORT
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False)
+SketchLine = Sketch.addLine(32, 20, 82, 70)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 3)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 2)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[0]
+else:
+ GeomPoint = Arc_Points[1]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 1)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 0)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 1)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 1)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_3.feature()]))
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_4.feature()]))
+
+assert(len(Intersection_Points_1) == 0)
+assert(len(Intersection_Points_2) == 1)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False)
+SketchLine = Sketch.addLine(32, 20, 82, 70)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 3)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 2)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[1]
+else:
+ GeomPoint = Arc_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 1)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 0)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 2)
+assert(idList_after.count(SketchArcId) == 2)
+assert(idList_after.count(SketchLineId) == 1)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 3)
+assert(idList_after.count(SketchConstraintEqualId) == 1)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList)
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList)
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList)
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList)
+
+assert(len(Intersection_Points_1) == 1)
+assert(len(Intersection_Points_2) == 0)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False)
+SketchLine_1 = Sketch.addLine(50, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(100, 20, 70, 50)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 7)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[0]
+else:
+ GeomPoint = Arc_Points[1]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 1)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 3)
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList)
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList)
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList)
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList)
+
+assert(len(Intersection_Points_1) == 0)
+assert(len(Intersection_Points_2) == 1)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchArc = Sketch.addArc(50, 50, 30, 50, 50, 70, False)
+SketchLine_1 = Sketch.addLine(50, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(100, 20, 70, 50)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 7)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[1]
+else:
+ GeomPoint = Arc_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 2)
+assert(idList_after.count(SketchArcId) == 2)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 4)
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList)
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList)
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList)
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList)
+
+assert(len(Intersection_Points_1) == 1)
+assert(len(Intersection_Points_2) == 0)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+# Test of inverted Arc
+SketchArc = Sketch.addArc(50, 50, 50, 70, 30, 50, True)
+SketchLine_1 = Sketch.addLine(50, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(100, 20, 70, 50)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 7)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[0]
+else:
+ GeomPoint = Arc_Points[1]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 1)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 3)
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList)
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList)
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList)
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList)
+
+assert(len(Intersection_Points_1) == 0)
+assert(len(Intersection_Points_2) == 1)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+SketchConstraintEqualId = 'SketchConstraintEqual'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+# Test of inverted Arc
+SketchArc = Sketch.addArc(50, 50, 50, 70, 30, 50, True)
+SketchLine_1 = Sketch.addLine(50, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(100, 20, 70, 50)
+SketchLine_intersecting = Sketch.addLine(10, 40, 90, 40)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchArc.results()[1])
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 7)
+
+Arc_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Arc_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Arc_Points) == 2)
+if Arc_Points[0].x() < Arc_Points[1].x():
+ GeomPoint = Arc_Points[1]
+else:
+ GeomPoint = Arc_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchArcId) == 1)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 2)
+assert(idList_after.count(SketchArcId) == 2)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 4)
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(50, 50, 25, 25)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 75, 25)
+SketchLine_intersecting_3 = Sketch.addLine(50, 50, 75, 75)
+SketchLine_intersecting_4 = Sketch.addLine(50, 50, 25, 75)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_1.feature(), anArcList)
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_2.feature(), anArcList)
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_3.feature(), anArcList)
+Intersection_Points_4 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_intersecting_4.feature(), anArcList)
+
+assert(len(Intersection_Points_1) == 1)
+assert(len(Intersection_Points_2) == 0)
+assert(len(Intersection_Points_3) == 1)
+assert(len(Intersection_Points_4) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchLine = Sketch.addLine(30, 75, 75, 30)
+SketchLine_intersecting = Sketch.addLine(10, 55, 90, 55)
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 3)
+
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 2)
+
+assert (len(Circle_Points) == 2)
+if Circle_Points[0].x() < Circle_Points[1].x():
+ GeomPoint = Circle_Points[0]
+else:
+ GeomPoint = Circle_Points[1]
+
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchLineId) == 1)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 0)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 1)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 2)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+assert(len(Intersection_Points_1) == 0)
+assert(len(Intersection_Points_2) == 1)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchLine = Sketch.addLine(30, 75, 75, 30)
+SketchLine_intersecting = Sketch.addLine(10, 55, 90, 55)
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 3)
+
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 2)
+
+assert (len(Circle_Points) == 2)
+if Circle_Points[0].x() < Circle_Points[1].x():
+ GeomPoint = Circle_Points[1]
+else:
+ GeomPoint = Circle_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchLineId) == 1)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 0)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 1)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 2)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+assert(len(Intersection_Points_1) == 1)
+assert(len(Intersection_Points_2) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchLine_1 = Sketch.addLine(70, 50, 80, 80)
+SketchLine_2 = Sketch.addLine(80, 80, 50, 70)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchCircle.results()[1])
+
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+#intersection points on circle to prepare a trim selection point
+SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60)
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Circle_Points) == 2)
+if Circle_Points[0].x() < Circle_Points[1].x():
+ GeomPoint = Circle_Points[0]
+else:
+ GeomPoint = Circle_Points[1]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 3)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+assert(len(Intersection_Points_1) == 0)
+assert(len(Intersection_Points_2) == 1)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchLine_1 = Sketch.addLine(70, 50, 80, 80)
+SketchLine_2 = Sketch.addLine(80, 80, 50, 70)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1])
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchCircle.results()[1])
+
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+#intersection points on circle to prepare a trim selection point
+SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60)
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+assert (len(Circle_Points) == 2)
+GeomPoint = Circle_Points[1]
+if Circle_Points[0].x() < Circle_Points[1].x():
+ GeomPoint = Circle_Points[1]
+else:
+ GeomPoint = Circle_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchLineId) == 2)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 3)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 2)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 3)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50)
+SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+assert(len(Intersection_Points_1) == 1)
+assert(len(Intersection_Points_2) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchPointId = 'SketchPoint'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchPoint_1 = Sketch.addPoint(70, 50)
+SketchPoint_2 = Sketch.addPoint(30, 50)
+SketchPoint_3 = Sketch.addPoint(50, 70)
+SketchPoint_4 = Sketch.addPoint(50, 30)
+
+#coincidence point to circle
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchPoint_1.results()[0], SketchCircle.results()[1])
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchPoint_2.results()[0], SketchCircle.results()[1])
+
+#coincidence circle to point
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchCircle.results()[1], SketchPoint_3.results()[0])
+SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchCircle.results()[1], SketchPoint_4.results()[0])
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 9)
+#intersection points on circle to prepare a trim selection point
+SketchLine_intersecting = Sketch.addLine(10, 60, 90, 60)
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 9)
+
+assert (len(Circle_Points) == 2)
+if Circle_Points[0].x() < Circle_Points[1].x():
+ GeomPoint = Circle_Points[0]
+else:
+ GeomPoint = Circle_Points[1]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchPointId) == 4)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 4)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchPointId) == 4)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 4)
+
+
+#check arc position intersections of created arc to an additional line
+SketchLine_intersecting_1 = Sketch.addLine(0, 0, 100, 100)
+SketchLine_intersecting_2 = Sketch.addLine(0, 100, 100, 0)
+
+Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+assert(len(Intersection_Points_1) == 2)
+assert(len(Intersection_Points_2) == 1)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchArcId = 'SketchArc'
+SketchCircleId = 'SketchCircle'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on circle with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchCircle = Sketch.addCircle(50, 50, 20)
+SketchLine_1 = Sketch.addLine(45, 68, 45, 73)
+SketchLine_2 = Sketch.addLine(45, 73, 55, 73)
+SketchLine_3 = Sketch.addLine(55, 73, 55, 68)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_1.startPoint(), SketchCircle.results()[1])
+SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchLine_3.endPoint(), SketchCircle.results()[1])
+
+SketchLine_4 = Sketch.addLine(68, 45, 73, 45)
+SketchLine_5 = Sketch.addLine(73, 45, 73, 55)
+SketchLine_6 = Sketch.addLine(73, 55, 68, 55)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_1_3 = Sketch.setCoincident(SketchLine_4.startPoint(), SketchCircle.results()[1])
+SketchConstraintCoincidence_1_4 = Sketch.setCoincident(SketchLine_6.endPoint(), SketchCircle.results()[1])
+
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 15)
+#intersection points on circle to prepare a trim selection point
+#first intersection point - vertical
+SketchLine_intersecting = Sketch.addLine(48, 10, 48, 90)
+Circle_Points = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Circle_Points) == 2)
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 15)
+
+assert (len(Circle_Points) == 2)
+GeomPoint = Circle_Points[1]
+if Circle_Points[0].y() < Circle_Points[1].y():
+ GeomPoint = Circle_Points[1]
+else:
+ GeomPoint = Circle_Points[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchCircleId) == 1)
+assert(idList_before.count(SketchArcId) == 0)
+assert(idList_before.count(SketchLineId) == 6)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 8)
+
+#perform trim: vertical
+SketchTrim = Sketch.addTrim(SketchCircle, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ SketchArc = SubFeature
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 1)
+assert(idList_after.count(SketchLineId) == 6)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 8)
+
+
+#check arc position intersections of created arc to an additional line
+#SketchLine_intersecting_1 = Sketch.addLine(0, 0, 50, 50)
+#SketchLine_intersecting_2 = Sketch.addLine(50, 50, 100, 100)
+
+#Intersection_Points_1 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_1.feature()]))
+#Intersection_Points_2 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_2.feature()]))
+
+#assert(len(Intersection_Points_1) == 1)
+#assert(len(Intersection_Points_2) == 0)
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint.x(), GeomPoint.y())
+Intersection_Points_3 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchPoint.feature()]))
+assert(len(Intersection_Points_3) == 0)
+
+
+
+#perform trim: horizontal
+#second intersection point - horizontal
+SketchLine_intersecting_h = Sketch.addLine(10, 48, 72, 48)
+Circle_Points_h = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc, FeatureList([SketchLine_intersecting_h.feature()]))
+assert(len(Circle_Points_h) == 2)
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting_h.feature()]))
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 16)
+
+assert (len(Circle_Points_h) == 2)
+GeomPoint = Circle_Points_h[1]
+if Circle_Points_h[0].x() < Circle_Points_h[1].x():
+ GeomPoint_h = Circle_Points_h[1]
+else:
+ GeomPoint_h = Circle_Points_h[0]
+
+
+SketchTrim = Sketch.addTrim(SketchArc, Sketch.to2D(GeomPoint_h))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+anArcList = FeatureList()
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+ if SubFeature.getKind() == SketchArcId:
+ anArcList.append(SubFeature)
+
+assert(len(anArcList) == 2)
+
+assert(idList_after.count(SketchCircleId) == 0)
+assert(idList_after.count(SketchArcId) == 2)
+assert(idList_after.count(SketchLineId) == 6)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 9)
+
+
+#add point for check
+SketchPoint = Sketch.addPoint(GeomPoint_h.x(), GeomPoint_h.y())
+Intersection_Points_5 = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchPoint.feature(), anArcList)
+assert(len(Intersection_Points_5) == 0)
+
+
+model.end()
+
+#assert(model.checkPythonDump())
--- /dev/null
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
+import math
+
+TOLERANCE = 1.e-7
+
+SketchLineId = 'SketchLine'
+SketchConstraintCoincidenceId = 'SketchConstraintCoincidence'
+
+aSession = ModelAPI_Session.get()
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+
+# Test1:begin split on arc with coincident point and intersection line : smaller part
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+# Test of inverted Arc
+SketchLine_1 = Sketch.addLine(200, 20, 20, 70)
+SketchLine_2 = Sketch.addLine(20, 70, 90, 150)
+SketchLine_3 = Sketch.addLine(-10, 190, 90, 50)
+
+SketchLine_intersecting = Sketch.addLine(-30, 85, 50, 85)
+
+SketchConstraintCoincidence_1_1 = Sketch.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1_2 = Sketch.setCoincident(SketchLine_1.results()[0], SketchLine_3.endPoint())
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 6)
+
+Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchLine_2.feature(), FeatureList([SketchLine_intersecting.feature()]))
+assert(len(Intersection_Point) == 1)
+
+ModelAPI.removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+
+Sketch_features = featureToCompositeFeature(Sketch.feature())
+assert (Sketch_features.numberOfSubs() == 5)
+
+GeomPoint = Intersection_Point[0]
+
+#check number of features before trim
+Sketch_feature = featureToCompositeFeature(Sketch.feature())
+idList_before = []
+for index in range(Sketch_feature.numberOfSubs()):
+ idList_before.append(Sketch_feature.subFeature(index).getKind())
+
+assert(idList_before.count(SketchLineId) == 3)
+assert(idList_before.count(SketchConstraintCoincidenceId) == 2)
+
+#perform trim
+SketchTrim = Sketch.addTrim(SketchLine_2, Sketch.to2D(GeomPoint))
+SketchTrim.execute()
+model.do()
+
+#check number of features after trim
+SketchFeatures = featureToCompositeFeature(Sketch.feature())
+idList_after = []
+for SubIndex in range(SketchFeatures.numberOfSubs()):
+ SubFeature = SketchFeatures.subFeature(SubIndex)
+ idList_after.append(SubFeature.getKind())
+
+assert(idList_after.count(SketchLineId) == 3)
+assert(idList_after.count(SketchConstraintCoincidenceId) == 2)
+
+#check if line points are the same
+assert(SketchLine_1.startPoint().x() == 200)
+assert(SketchLine_1.startPoint().y() == 20)
+assert(SketchLine_1.endPoint().x() == 20)
+assert(SketchLine_1.endPoint().y() == 70)
+
+assert(SketchLine_3.startPoint().x() == -10)
+assert(SketchLine_3.startPoint().y() == 190)
+assert(SketchLine_3.endPoint().x() == 90)
+assert(SketchLine_3.endPoint().y() == 50)
+
+model.end()
+
+#assert(model.checkPythonDump())