-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+// Copyright (C) 2014-201x CEA/DEN, EDF R&D -->
-// File: PrimitivesAPI_Cylinder.h
+// File: PrimitivesAPI_Cylinder.cpp
// Created: 12 Jan 2017
-// Author: Clarisse Genrault (CEA)
+// Author: Clarisse Genrault
#include "PrimitivesAPI_Cylinder.h"
//==================================================================================================
PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Selection& theBasePoint,
- const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theRadius,
- const ModelHighAPI_Double& theHeight)
+ const ModelHighAPI_Selection& theBasePoint,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theRadius,
+ const ModelHighAPI_Double& theHeight)
: ModelHighAPI_Interface(theFeature)
{
if (initialize()) {
- fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER(), creationMethod());
- setObjects(theBasePoint, theAxis);
+ fillAttribute(theBasePoint, basePoint());
+ fillAttribute(theAxis, axis());
setSizes(theRadius, theHeight);
}
}
//==================================================================================================
PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const ModelHighAPI_Selection& theBasePoint,
- const ModelHighAPI_Selection& theAxis,
- const ModelHighAPI_Double& theRadius,
- const ModelHighAPI_Double& theHeight,
- const ModelHighAPI_Double& theAngle)
+ const ModelHighAPI_Selection& theBasePoint,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theRadius,
+ const ModelHighAPI_Double& theHeight,
+ const ModelHighAPI_Double& theAngle)
: ModelHighAPI_Interface(theFeature)
{
if (initialize()) {
- fillAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD_CYLINDER_PORTION(), creationMethod());
- setObjects(theBasePoint, theAxis);
+ fillAttribute(theBasePoint, basePoint());
+ fillAttribute(theAxis, axis());
+ fillAttribute(theAngle, angle());
setSizes(theRadius, theHeight);
- setAngle(theAngle);
}
}
//==================================================================================================
-void PrimitivesAPI_Cylinder::setObjects(const ModelHighAPI_Selection& theBasePoint,
- const ModelHighAPI_Selection& theAxis)
+PrimitivesAPI_Cylinder::~PrimitivesAPI_Cylinder()
{
- fillAttribute(theBasePoint, basePoint());
- fillAttribute(theAxis, axis());
- execute();
}
//==================================================================================================
{
fillAttribute(theRadius, radius());
fillAttribute(theHeight, height());
-
- execute();
-}
-
-//==================================================================================================
-void PrimitivesAPI_Cylinder::setAngle(const ModelHighAPI_Double& theAngle)
-{
- fillAttribute(theAngle, angle());
-
execute();
}
theDumper << aBase << " = model.addCylinder(" << aDocName;
- std::string aCreationMethod = aBase->string(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;
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<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, theBasePoint, theAxis,
- theRadius, theHeight, theAngle));
+ theRadius, theHeight));
}
//==================================================================================================
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<ModelAPI_Feature> 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<ModelAPI_Document>& thePart,
const ModelHighAPI_Double& theRadius,
- const ModelHighAPI_Double& theHeight,
- const ModelHighAPI_Double& theAngle)
+ const ModelHighAPI_Double& theHeight)
{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
ModelHighAPI_Selection aBasePoint("VERT", "Origin");
ModelHighAPI_Selection anAxis("EDGE", "OZ");
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis,
- theRadius, theHeight, theAngle));
+ theRadius, theHeight));
}
//==================================================================================================
CylinderPtr addCylinder(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Double& theRadius,
- const ModelHighAPI_Double& theHeight)
+ const ModelHighAPI_Double& theHeight,
+ const ModelHighAPI_Double& theAngle)
{
- std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
ModelHighAPI_Selection aBasePoint("VERT", "Origin");
ModelHighAPI_Selection anAxis("EDGE", "OZ");
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis,
theRadius, theHeight));
}
\ No newline at end of file