From f683c7e26a3ab8d24912b462f6eab69d8c91dd13 Mon Sep 17 00:00:00 2001 From: mpv Date: Tue, 15 May 2018 17:31:55 +0300 Subject: [PATCH] Fix for the issue #2465 and a unit test and a correction for the test becomes working. --- src/FeaturesPlugin/CMakeLists.txt | 1 + src/FeaturesPlugin/Test/Test2465.py | 35 +++++++++++++++++++ src/GDMLAPI/GDMLAPI_Ellipsoid.cpp | 2 +- .../GeomValidators_ShapeType.cpp | 2 +- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 src/FeaturesPlugin/Test/Test2465.py diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 382f00ec6..b0be8b412 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -250,4 +250,5 @@ ADD_UNIT_TESTS(TestExtrusion.py Test2419_1.py Test2419_2.py Test2419_3.py + Test2465.py ) diff --git a/src/FeaturesPlugin/Test/Test2465.py b/src/FeaturesPlugin/Test/Test2465.py new file mode 100644 index 000000000..d23abdd5e --- /dev/null +++ b/src/FeaturesPlugin/Test/Test2465.py @@ -0,0 +1,35 @@ +## 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 +## + +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Ellipsoid_1 = model.addEllipsoid(Part_1_doc, 10, 20, 40) +Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3) +LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Ellipsoid_1_1")], model.selection("EDGE", "Ellipsoid_1_1/Face_1"), 10, 2) +model.end() + +# check that for the linear copy direction the elliptical edge is invalid +from ModelAPI import * +aFactory = ModelAPI_Session.get().validators() +assert(not aFactory.validate(LinearCopy_1.feature())) diff --git a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp index 385b5dea2..167d6aa64 100644 --- a/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp +++ b/src/GDMLAPI/GDMLAPI_Ellipsoid.cpp @@ -38,7 +38,7 @@ GDMLAPI_Ellipsoid::GDMLAPI_Ellipsoid(const std::shared_ptr& th if (initialize()) { setSizes(theAX, theBY, theCZ); fillAttribute("", useZCut1()); - fillAttribute("", useZCut1()); + fillAttribute("", useZCut2()); } } diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index 0c1a18b49..3ee016de3 100755 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -232,7 +232,7 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape, aValid = theShape->isEdge(); break; case Line: - aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle(); + aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine(); break; case Circle: aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle(); -- 2.39.2