X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPrimitivesAPI%2FPrimitivesAPI_Cylinder.cpp;h=36666e63264665dcd043dc69cfb9f21418e6431c;hb=fc72d43b677baa05ae7fd317346fd8b723b799ed;hp=42c10aed1f8f4ea718893bccf57f4646b2321705;hpb=ccd1d538ff04366093c86220b22b53c4b7370f14;p=modules%2Fshaper.git diff --git a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp index 42c10aed1..36666e632 100644 --- a/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp +++ b/src/PrimitivesAPI/PrimitivesAPI_Cylinder.cpp @@ -1,8 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: PrimitivesAPI_Cylinder.h -// Created: 12 Jan 2017 -// Author: Clarisse Genrault (CEA) +// Copyright (C) 2014-2023 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 +// #include "PrimitivesAPI_Cylinder.h" @@ -27,7 +40,8 @@ PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptrstring(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); - AttributeSelectionPtr anAttrBasePoint = aBase->selection(PrimitivesPlugin_Cylinder::BASE_POINT_ID()); AttributeSelectionPtr anAttrAxis = aBase->selection(PrimitivesPlugin_Cylinder::AXIS_ID()); + theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; + AttributeDoublePtr anAttrRadius = aBase->real(PrimitivesPlugin_Cylinder::RADIUS_ID()); AttributeDoublePtr anAttrHeight = aBase->real(PrimitivesPlugin_Cylinder::HEIGHT_ID()); - - theDumper << ", " << anAttrBasePoint << ", " << anAttrAxis; theDumper << ", " << anAttrRadius << ", " << anAttrHeight; - + + std::string aCreationMethod = + aBase->string(PrimitivesPlugin_Cylinder::CREATION_METHOD())->value(); + if (aCreationMethod == PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION()) { AttributeDoublePtr anAttrAngle = aBase->real(PrimitivesPlugin_Cylinder::ANGLE_ID()); theDumper << ", " << anAttrAngle; @@ -109,12 +112,11 @@ CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theBasePoint, const ModelHighAPI_Selection& theAxis, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) + const ModelHighAPI_Double& theHeight) { std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, - theRadius, theHeight, theAngle)); + theRadius, theHeight)); } //================================================================================================== @@ -122,34 +124,35 @@ CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Selection& theBasePoint, const ModelHighAPI_Selection& theAxis, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) + const ModelHighAPI_Double& theHeight, + const ModelHighAPI_Double& theAngle) { std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis, - theRadius, theHeight)); + theRadius, theHeight, theAngle)); } //================================================================================================== CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight, - const ModelHighAPI_Double& theAngle) + const ModelHighAPI_Double& theHeight) { + ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); + ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); - ModelHighAPI_Selection aBasePoint("VERT", "Origin"); - ModelHighAPI_Selection anAxis("EDGE", "OZ"); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, - theRadius, theHeight, theAngle)); + theRadius, theHeight)); } //================================================================================================== CylinderPtr addCylinder(const std::shared_ptr& thePart, const ModelHighAPI_Double& theRadius, - const ModelHighAPI_Double& theHeight) + const ModelHighAPI_Double& theHeight, + const ModelHighAPI_Double& theAngle) { + ModelHighAPI_Selection aBasePoint("VERTEX", L"PartSet/Origin"); + ModelHighAPI_Selection anAxis("EDGE", L"PartSet/OZ"); std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID()); - ModelHighAPI_Selection aBasePoint("VERT", "Origin"); - ModelHighAPI_Selection anAxis("EDGE", "OZ"); return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis, - theRadius, theHeight)); -} \ No newline at end of file + theRadius, theHeight, theAngle)); +}