-<!-- Copyright (C) 2014-2016 CEA/DEN, EDF R&D -->
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
<!-- Modified by Clarisse Genrault (CEA) : 17 Nov 2016 -->
<source>
<toolbox id="CreationMethod">
</shape_selector>
</box>
</toolbox>
-</source>
\ No newline at end of file
+</source>
#include "GDMLAPI_ConeSegment.h"
+#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
//==================================================================================================
//==================================================================================================
GDMLAPI_ConeSegment::~GDMLAPI_ConeSegment()
{
-
}
//==================================================================================================
execute();
}
+//==================================================================================================
+void GDMLAPI_ConeSegment::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ theDumper << aBase << " = model.addConeSegment(" << aDocName;
+
+ AttributeDoublePtr anAttrRMin1 = aBase->real(GDMLPlugin_ConeSegment::RMIN1_ID());
+ AttributeDoublePtr anAttrRMax1 = aBase->real(GDMLPlugin_ConeSegment::RMAX1_ID());
+ AttributeDoublePtr anAttrRMin2 = aBase->real(GDMLPlugin_ConeSegment::RMIN2_ID());
+ AttributeDoublePtr anAttrRMax2 = aBase->real(GDMLPlugin_ConeSegment::RMAX2_ID());
+ AttributeDoublePtr anAttrZ = aBase->real(GDMLPlugin_ConeSegment::Z_ID());
+ AttributeDoublePtr anAttrStartPhi = aBase->real(GDMLPlugin_ConeSegment::STARTPHI_ID());
+ AttributeDoublePtr anAttrDeltaPhi = aBase->real(GDMLPlugin_ConeSegment::DELTAPHI_ID());
+ theDumper << ", " << anAttrRMin1 << ", " << anAttrRMax1;
+ theDumper << ", " << anAttrRMin2 << ", " << anAttrRMax2;
+ theDumper << ", " << anAttrZ << ", " << anAttrStartPhi << " , " << anAttrDeltaPhi;
+
+ theDumper << ")" << std::endl;
+}
+
//==================================================================================================
ConeSegmentPtr addConeSegment(const std::shared_ptr<ModelAPI_Document>& thePart,
const ModelHighAPI_Double& theRMin1,
const ModelHighAPI_Double& theZ,
const ModelHighAPI_Double& theStartPhi,
const ModelHighAPI_Double& theDeltaPhi);
+
+ /// Dump wrapped feature
+ GDMLAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
};
/// Pointer on primitive ConeSegment object
step="1.0"
default="12.0"
tooltip="Enter the height">
- <validator id="GeomValidators_Positive"/>
</doublevalue>
<doublevalue
id="startphi"
step="15.0"
default="270."
tooltip="Enter the revolution angle">
- <validator id="GeomValidators_Positive"/>
</doublevalue>
</groupbox>
<label title="" icon="icons/GDML/gui_cone_segment.png"/>
std::shared_ptr<GeomAPI_Pnt> theBasePoint, std::shared_ptr<GeomAPI_Edge> theEdge,
double theRadius, double theHeight, double theAngle) throw (GeomAlgoAPI_Exception)
{
+ // Check if the base point is OK
+ if (!theBasePoint) {
+ throw GeomAlgoAPI_Exception("Cylinder builder :: the base point is not valid.");
+ }
+ // Check if the edge is OK
+ if (!theEdge) {
+ throw GeomAlgoAPI_Exception("Cylinder builder :: the axis is not valid.");
+ }
+
std::shared_ptr<GeomAPI_Ax2> anAxis;
anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(theBasePoint,
theEdge->line()->direction()));
myError = "Translation builder :: source shape is invalid.";
return false;
}
+ if(myStartPoint->distance(myEndPoint) < Precision::Confusion()) {
+ myError = "Translation builder :: start point and end point coincide.";
+ return false;
+ }
return true;
}
default: {
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
+#include <iostream>
+
//==================================================================================================
PrimitivesAPI_Cylinder::PrimitivesAPI_Cylinder(const std::shared_ptr<ModelAPI_Feature>& theFeature)
: ModelHighAPI_Interface(theFeature)
const ModelHighAPI_Double& theRadius,
const ModelHighAPI_Double& theHeight)
{
- ModelHighAPI_Selection aBasePoint("VERT", "Origin");
- ModelHighAPI_Selection anAxis("EDGE", "OZ");
+ ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
+ ModelHighAPI_Selection anAxis("EDGE", "PartSet/OZ");
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Cylinder::ID());
return CylinderPtr(new PrimitivesAPI_Cylinder(aFeature, aBasePoint, anAxis,
theRadius, theHeight));
const ModelHighAPI_Double& theHeight,
const ModelHighAPI_Double& theAngle)
{
- ModelHighAPI_Selection aBasePoint("VERT", "Origin");
- ModelHighAPI_Selection anAxis("EDGE", "OZ");
+ ModelHighAPI_Selection aBasePoint("VERTEX", "PartSet/Origin");
+ ModelHighAPI_Selection anAxis("EDGE", "PartSet/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
+ theRadius, theHeight, theAngle));
+}