X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FTest%2FTestPresentation.py;h=bd18f4c3d26e140b2634b21f64bdc1a657b2770d;hb=cdbbde4803e9c320204d537d22af4ac7ef024962;hp=f4ebf9eb53d6a497ef39d5f9e0aa0816bc3294d9;hpb=9b61e5ee5eafe9d6948d9a78667efa2abec132c3;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/Test/TestPresentation.py b/src/SketchPlugin/Test/TestPresentation.py index f4ebf9eb5..bd18f4c3d 100644 --- a/src/SketchPlugin/Test/TestPresentation.py +++ b/src/SketchPlugin/Test/TestPresentation.py @@ -1,22 +1,21 @@ -## Copyright (C) 2018-20xx 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 -## +# Copyright (C) 2018-2021 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 +# """ TestPresentation.py @@ -30,6 +29,7 @@ from GeomDataAPI import * from ConfigAPI import * Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16") +Config_PropManager().registerProp("Visualization", "sketch_dimension_color", "Dimension color", Config_Prop.Color, "64,128,255") model.begin() partSet = model.moduleDocument() @@ -90,6 +90,8 @@ assert(featureToPresentation(SketchConstraintMirror_1.feature()).getAISObject(No assert(featureToPresentation(SketchMultiTranslation_1.feature()).getAISObject(None) is not None) assert(featureToPresentation(SketchMultiRotation_1.feature()).getAISObject(None) is not None) +model.end() + # Test presentation for Fillet on low-level aSession = ModelAPI_Session.get() aSketchFeature = featureToCompositeFeature(Sketch_1.feature()) @@ -127,4 +129,68 @@ anArcPnt3.setValue(0, 5) assert(featureToPresentation(anArc).getAISObject(None) is not None) aSession.finishOperation() -model.end() +# Test presentation for MacroEllipse on low-level +aSession.startOperation() +anEllipse = aSketchFeature.addFeature("SketchMacroEllipse") +anEllipsePnt1 = geomDataAPI_Point2D(anEllipse.attribute("first_point")) +anEllipsePnt2 = geomDataAPI_Point2D(anEllipse.attribute("second_point")) +anEllipsePnt3 = geomDataAPI_Point2D(anEllipse.attribute("passed_point")) +anEllipseType = anEllipse.string("ellipse_type") +anEllipseType.setValue("by_center_axis_point") +anEllipsePnt1.setValue(10, 0) +anEllipsePnt2.setValue(-10, 0) +anEllipsePnt3.setValue(0, 5) +assert(featureToPresentation(anEllipse).getAISObject(None) is not None) +aSession.finishOperation() + +# Test presentation for MacroEllipticArc on low-level +aSession.startOperation() +anEllipticArc = aSketchFeature.addFeature("SketchMacroEllipticArc") +anEllipticArcPnt1 = geomDataAPI_Point2D(anEllipticArc.attribute("center")) +anEllipticArcPnt2 = geomDataAPI_Point2D(anEllipticArc.attribute("major_axis_point")) +anEllipticArcPnt3 = geomDataAPI_Point2D(anEllipticArc.attribute("start_point")) +anEllipticArcPnt4 = geomDataAPI_Point2D(anEllipticArc.attribute("end_point")) +anEllipticArcPnt1.setValue(0, 0) +anEllipticArcPnt2.setValue(10, 0) +anEllipticArcPnt3.setValue(0, 5) +anEllipticArcPnt4.setValue(-10, 0) +assert(featureToPresentation(anEllipticArc).getAISObject(None) is not None) +aSession.finishOperation() + +# Test presentation for MacroBSpline on low-level +aSession.startOperation() +aBSpline = aSketchFeature.addFeature("SketchMacroBSpline") +aPoles = geomDataAPI_Point2DArray(aBSpline.attribute("poles")) +aPoles.setSize(4) +aPoles.setPnt(0, 0, 0) +aPoles.setPnt(1, 10, 0) +aPoles.setPnt(2, 10, 10) +aPoles.setPnt(3, 0, 10) +aWeights = aBSpline.data().realArray("weights") +aWeights.setSize(4) +aWeights.setValue(0, 1) +aWeights.setValue(1, 2) +aWeights.setValue(2, 2) +aWeights.setValue(3, 1) +aBSpline.boolean("need_control_poly").setValue(True) +assert(featureToPresentation(aBSpline).getAISObject(None) is not None) +aSession.finishOperation() + +# Test presentation for MacroBSplinePeriodic on low-level +aSession.startOperation() +aBSplineP = aSketchFeature.addFeature("SketchMacroBSplinePeriodic") +aPoles = geomDataAPI_Point2DArray(aBSplineP.attribute("poles")) +aPoles.setSize(4) +aPoles.setPnt(0, 0, 0) +aPoles.setPnt(1, 10, 0) +aPoles.setPnt(2, 10, 10) +aPoles.setPnt(3, 0, 10) +aWeights = aBSplineP.data().realArray("weights") +aWeights.setSize(4) +aWeights.setValue(0, 1) +aWeights.setValue(1, 2) +aWeights.setValue(2, 2) +aWeights.setValue(3, 1) +aBSplineP.boolean("need_control_poly").setValue(True) +assert(featureToPresentation(aBSplineP).getAISObject(None) is not None) +aSession.finishOperation()