+# Copyright (C) 2014-2020 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
+#
+
"""
TestConstraintCoincidence.py
Unit test of SketchPlugin_ConstraintCoincidence class
assert (math.fabs(aDirX * aVecY - aDirY * aVecX) <= TOLERANCE)
def checkPointOnCircle(point, circle):
- aCenter = geomDataAPI_Point2D(circle.attribute("CircleCenter"))
- aRadius = circle.real("CircleRadius").value()
+ aCenter = geomDataAPI_Point2D(circle.attribute("circle_center"))
+ aRadius = circle.real("circle_radius").value()
aDist = math.hypot(point.x() - aCenter.x(), point.y() - aCenter.y())
assert (math.fabs(aDist - aRadius) <= TOLERANCE)
def checkPointOnArc(point, arc):
- aStart = geomDataAPI_Point2D(arc.attribute("ArcStartPoint"))
- aCenter = geomDataAPI_Point2D(arc.attribute("ArcCenter"))
+ aStart = geomDataAPI_Point2D(arc.attribute("start_point"))
+ aCenter = geomDataAPI_Point2D(arc.attribute("center_point"))
aRadius = math.hypot(aStart.x() - aCenter.x(), aStart.y() - aCenter.y())
aDist = math.hypot(point.x() - aCenter.x(), point.y() - aCenter.y())
assert (math.fabs(aDist - aRadius) <= TOLERANCE)
# add an origin
aSession.startOperation()
aFeature = aDocument.addFeature("Point")
-# aFeature.string("creation_method").setValue("by_xyz")
-aFeature.real("x").setValue(0.)
-aFeature.real("y").setValue(0.)
-aFeature.real("z").setValue(0.)
+geomDataAPI_Point(aFeature.attribute("point3d")).setValue(0., 0., 0.)
+aFeature.string("creation_method").setValue("by_xyz")
anOriginName = aFeature.name()
aSession.finishOperation()
#=========================================================================
#=========================================================================
aSession.startOperation()
aSketchArc = aSketchFeature.addFeature("SketchArc")
-anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter"))
-anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcStartPoint"))
-anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
+anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("center_point"))
+anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("start_point"))
+anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("end_point"))
anArcCentr.setValue(10., 10.)
anArcStartPoint.setValue(0., 50.)
anArcEndPoint.setValue(50., 0.)
aSession.startOperation()
# create circle with center coincident with origin
aSketchCircle = aSketchFeature.addFeature("SketchCircle")
-aCircleCenter = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
-aCircleRadius = aSketchCircle.real("CircleRadius")
+aCircleCenter = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
aCircleCenter.setValue(10., 10.)
aCircleRadius.setValue(25.)
aSession.finishOperation()
anOrigShape = anOrigRes.shape()
assert (anOrigShape)
anOrigin = aSketchFeature.addFeature("SketchPoint")
-anOriginCoord = geomDataAPI_Point2D(anOrigin.attribute("PointCoordindates"))
+anOriginCoord = geomDataAPI_Point2D(anOrigin.attribute("PointCoordinates"))
anOriginCoord.setValue(0., 0.)
anOrigin.selection("External").setValue(anOrigRes, anOrigShape)
aSession.finishOperation()