1 ## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ## Lesser General Public License for more details.
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
23 Test case for issue #2018 "After split auxiliary circle edit of axiliary state of arc is wrong"
26 from ModelAPI import *
27 from ModelAPI import ModelAPI_Feature
28 from ModelAPI import FeatureList
29 from ModelGeomAlgo import ModelGeomAlgo_Point2D
30 from SketchAPI import SketchAPI_Arc
31 from salome.shaper import model
33 def getArcs(theSketch):
35 for aSubObj in theSketch.features().list():
36 aFeature = ModelAPI_Feature.feature(aSubObj)
37 if aFeature is not None and aFeature.getKind() == "SketchArc":
38 anArcs.append(aFeature)
43 partSet = model.moduleDocument()
44 Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
45 SketchCircle_1 = Sketch_1.addCircle(-316.2976090885591, -103.0319555403832, 230.3644881376851)
46 SketchCircle_1.setAuxiliary(True)
47 SketchLine_1 = Sketch_1.addLine(-489.6131019153831, 48.7229038254136, -457.9545454545454, 334.0909090909091)
48 SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchCircle_1.results()[1])
49 SketchLine_2 = Sketch_1.addLine(-457.9545454545454, 334.0909090909091, -251.2069112222553, 117.9454153513332)
50 SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
51 SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchCircle_1.results()[1])
53 # prepare point on circle
54 SketchLine_intersecting = Sketch_1.addLine(-316.2976090885591, -103.0319555403832, -457.9545454545454, 334.0909090909091)
55 Intersection_Point = ModelGeomAlgo_Point2D.getSetOfPntIntersectedShape(SketchCircle_1.feature(), FeatureList([SketchLine_intersecting.feature()]))
56 removeFeaturesAndReferences(FeatureSet([SketchLine_intersecting.feature()]))
57 GeomPoint = Intersection_Point[0]
60 Sketch_1.addSplit(SketchCircle_1, Sketch_1.to2D(GeomPoint))
63 anArcs = getArcs(Sketch_1)
64 # check auxiliary flags
66 aCurrentArc = SketchAPI_Arc(arc)
67 assert(aCurrentArc.auxiliary().value())
68 aCurrentArc.setAuxiliary(False)
70 assert(aCurrentArc.auxiliary().value() == False)
74 assert(model.checkPythonDump())