+# Copyright (C) 2014-2023 CEA, EDF
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
from salome.shaper import model
from ModelAPI import *
+from ModelGeomAlgo import ModelGeomAlgo_Point2D
+from salome.shaper import geom
SketchPointId = 'SketchPoint'
SketchLineId = 'SketchLine'
SketchLine_1 = Sketch_1.addLine(0, 50, 100, 50)
SketchPoint_1 = Sketch_1.addPoint(50, 50)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
-Sketch_1.addSplit(SketchLine_1, SketchPoint_1.coordinates(), SketchLine_1.endPoint())
+GeomPoint = geom.Pnt2d(20, 50)
+Sketch_1.addSplit(SketchLine_1, GeomPoint)
model.do()
Sketch_1_feature = featureToCompositeFeature(Sketch_1.feature())
assert(idList.count(SketchLineId) == 2)
assert(idList.count(SketchPointId) == 1)
assert(idList.count(SketchConstraintCoincidenceId) == 3)
-assert(idList.count(SketchConstraintParallelId) == 1)
+assert(idList.count(SketchConstraintParallelId) == 0)
# Test end
# Test split on line with two points
SketchPoint_2_2 = Sketch_2.addPoint(75, 50)
SketchConstraintCoincidence_2_1 = Sketch_2.setCoincident(SketchPoint_2_1.coordinates(), SketchLine_2_1.result())
SketchConstraintCoincidence_2_2 = Sketch_2.setCoincident(SketchPoint_2_2.coordinates(), SketchLine_2_1.result())
-Sketch_2.addSplit(SketchLine_2_1, SketchPoint_2_1.coordinates(), SketchPoint_2_2.coordinates())
+GeomPoint = geom.Pnt2d(40, 50)
+Sketch_2.addSplit(SketchLine_2_1, GeomPoint)
model.do()
Sketch_2_feature = featureToCompositeFeature(Sketch_2.feature())
assert(idList.count(SketchLineId) == 3)
assert(idList.count(SketchPointId) == 2)
assert(idList.count(SketchConstraintCoincidenceId) == 6)
-assert(idList.count(SketchConstraintParallelId) == 2)
+assert(idList.count(SketchConstraintParallelId) == 0)
# Test end
# Test split on circle with two points
SketchPoint_3_2 = Sketch_3.addPoint(50, 100)
SketchConstraintCoincidence_3_1 = Sketch_3.setCoincident(SketchPoint_3_1.coordinates(), SketchCircle_3_1.results()[1])
SketchConstraintCoincidence_3_2 = Sketch_3.setCoincident(SketchPoint_3_2.coordinates(), SketchCircle_3_1.results()[1])
-Sketch_3.addSplit(SketchCircle_3_1, SketchPoint_3_1.coordinates(), SketchPoint_3_2.coordinates())
+GeomPoint = geom.Pnt2d(0, 50)
+Sketch_3.addSplit(SketchCircle_3_1, GeomPoint)
model.do()
Sketch_3_feature = featureToCompositeFeature(Sketch_3.feature())
assert(idList.count(SketchArcId) == 2)
assert(idList.count(SketchPointId) == 2)
assert(idList.count(SketchConstraintCoincidenceId) == 6)
-assert(idList.count(SketchConstraintTangentId) == 1)
+assert(idList.count(SketchConstraintTangentId) == 0)
# Test end
# Test split on arc with one point
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.results()[1])
-Sketch_4.addSplit(SketchArc_4_1, SketchPoint_4_1.coordinates(), SketchArc_4_1.endPoint())
+# prepare point on circle
+SketchLine_intersecting = Sketch_4.addLine(0, 100, 50, 50)
+Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchArc_4_1.feature(), FeatureList([SketchLine_intersecting.feature()]))
+removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
+Intersection_GeomPoint = Intersection_Point[0]
+Sketch_4.addSplit(SketchArc_4_1, Sketch_1.to2D(Intersection_GeomPoint))
model.do()
Sketch_4_feature = featureToCompositeFeature(Sketch_4.feature())
assert(idList.count(SketchArcId) == 2)
assert(idList.count(SketchPointId) == 1)
assert(idList.count(SketchConstraintCoincidenceId) == 3)
-assert(idList.count(SketchConstraintEqualId) == 1)
-assert(idList.count(SketchConstraintTangentId) == 1)
+assert(idList.count(SketchConstraintEqualId) == 0)
+assert(idList.count(SketchConstraintTangentId) == 0)
# Test end
# Test split on arc with two points
SketchConstraintCoincidence_5_2 = Sketch_5.setCoincident(SketchLine_5_1.endPoint(), SketchArc_5_1.results()[1])
SketchConstraintHorizontal_5_1 = Sketch_5.setHorizontal(SketchLine_5_1.result())
SketchConstraintLength_5_1 = Sketch_5.setLength(SketchLine_5_1.result(), 50)
-Sketch_5.addSplit(SketchArc_5_1, SketchLine_5_1.startPoint(), SketchLine_5_1.endPoint())
+GeomPoint = geom.Pnt2d(50, 100)
+Sketch_5.addSplit(SketchArc_5_1, GeomPoint)
model.do()
Sketch_5_feature = featureToCompositeFeature(Sketch_5.feature())
assert(idList.count(SketchArcId) == 3)
assert(idList.count(SketchPointId) == 0)
assert(idList.count(SketchConstraintCoincidenceId) == 6)
-assert(idList.count(SketchConstraintEqualId) == 2)
-assert(idList.count(SketchConstraintTangentId) == 2)
+assert(idList.count(SketchConstraintEqualId) == 0)
+assert(idList.count(SketchConstraintTangentId) == 0)
# Test end
model.end()