Salome HOME
Issue #2376: Wrong DoF when creating the sketch
[modules/shaper.git] / src / SketchPlugin / Test / TestHighload.py
index f8fed6087f82e0ddf6147a1696b4aecdb97ab8b7..befac2e273e9a4fe2ef3d48b8c52a4b706e89dc6 100644 (file)
@@ -1,3 +1,23 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## 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<mailto:webmaster.salome@opencascade.com>
+##
+
 """
     TestHighload.py
 """
@@ -41,6 +61,7 @@ def createNAngle(theSketch, theN, theRadius, theEdgeLength=0):
         anEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
         aStartPoint.setValue(begin[0], begin[1])
         anEndPoint.setValue(end[0], end[1])
+        aSketchLine.execute()
         allStartPoints.append(aStartPoint)
         allEndPoints.append(anEndPoint)
         allLines.append(aSketchLine)
@@ -90,19 +111,18 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
 origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
 dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
 norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create 4x4 polygons N = {5, 21}
 #=========================================================================
+aDOF = 0
 deltaX = deltaY = 50.
 n = 5
 aSession.startOperation()
@@ -111,6 +131,7 @@ for i in xrange(4):
         allNangleLines = createNAngle(aSketchFeature, n, 50)
         fixLineLength(aSketchFeature, allNangleLines)
         moveTo(allNangleLines, deltaX, deltaY)
+        aDOF += n
         n += 1
         deltaX += 110.
     deltaY += 110.
@@ -121,3 +142,7 @@ aSession.finishOperation()
 #=========================================================================
 # End of test
 #=========================================================================
+
+from salome.shaper import model
+assert(model.dof(aSketchFeature) == aDOF)
+assert(model.checkPythonDump())