GDMLPlugin.h
GDMLPlugin_Plugin.h
GDMLPlugin_ConeSegment.h
+ GDMLPlugin_Ellipsoid.h
)
SET(PROJECT_SOURCES
GDMLPlugin_Plugin.cpp
GDMLPlugin_ConeSegment.cpp
+ GDMLPlugin_Ellipsoid.cpp
)
SET(XML_RESOURCES
plugin-GDML.xml
conesegment_widget.xml
+ ellipsoid_widget.xml
)
INCLUDE_DIRECTORIES(
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeDouble.h>
-#include <ModelAPI_AttributeString.h>
//=================================================================================================
GDMLPlugin_ConeSegment::GDMLPlugin_ConeSegment() // Nothing to do during instantiation
--- /dev/null
+// 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <GDMLPlugin_Ellipsoid.h>
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeString.h>
+
+//=================================================================================================
+GDMLPlugin_Ellipsoid::GDMLPlugin_Ellipsoid() // Nothing to do during instantiation
+{
+}
+
+//=================================================================================================
+void GDMLPlugin_Ellipsoid::initAttributes()
+{
+ data()->addAttribute(GDMLPlugin_Ellipsoid::AX_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::BY_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::CZ_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT1_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT1_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::USE_ZCUT2_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(GDMLPlugin_Ellipsoid::ZCUT2_ID(), ModelAPI_AttributeDouble::typeId());
+}
+
+//=================================================================================================
+void GDMLPlugin_Ellipsoid::execute()
+{
+ std::shared_ptr<GeomAlgoAPI_Ellipsoid> anEllipsoidAlgo;
+
+ double aAx = real(AX_ID())->value();
+ double aBy = real(BY_ID())->value();
+ double aCz = real(CZ_ID())->value();
+
+ std::string useZCut1 = string(USE_ZCUT1_ID())->value();
+ std::string useZCut2 = string(USE_ZCUT2_ID())->value();
+
+ double aZCut1 = 0.;
+ if (useZCut1.empty()) {
+ aZCut1 = aCz /2.;
+ } else {
+ aZCut1 = real(ZCUT1_ID())->value();
+ }
+ double aZCut2 = 0.;
+ if (useZCut2.empty()) {
+ aZCut2 = aCz /2.;
+ } else {
+ aZCut2 = real(ZCUT2_ID())->value();
+ }
+
+ anEllipsoidAlgo = std::shared_ptr<GeomAlgoAPI_Ellipsoid>(
+ new GeomAlgoAPI_Ellipsoid(aAx, aBy, aCz, aZCut1, aZCut2));
+
+ // Check with that the arguments for anEllipsoidAlgo are correct
+ if (!anEllipsoidAlgo->check()){
+ setError(anEllipsoidAlgo->getError(), false);
+ return;
+ }
+
+ anEllipsoidAlgo->build();
+
+ // Check if the creation of the ellipsoid is correct
+ if (!anEllipsoidAlgo->isDone()) {
+ setError(anEllipsoidAlgo->getError(), false);
+ return;
+ }
+
+ // Check if the created ellipsoid is valid
+ if (!anEllipsoidAlgo->checkValid("Ellipsoid builder")) {
+ setError(anEllipsoidAlgo->getError(), false);
+ return;
+ }
+
+ int aResultIndex = 0;
+ ResultBodyPtr aResultEllipsoid = document()->createBody(data(), aResultIndex);
+ loadNamingDS(anEllipsoidAlgo, aResultEllipsoid);
+ setResult(aResultEllipsoid, aResultIndex);
+
+}
+
+//=================================================================================================
+void GDMLPlugin_Ellipsoid::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Ellipsoid> theEllipsoidAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultEllipsoid)
+{
+ // Load the result
+ theResultEllipsoid->store(theEllipsoidAlgo->shape());
+
+ // Prepare the naming
+ theEllipsoidAlgo->prepareNamingFaces();
+
+ // Insert to faces
+ int num = 1;
+ std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
+ theEllipsoidAlgo->getCreatedFaces();
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
+ it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
+ std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
+ theResultEllipsoid->generated(aFace, (*it).first, num++);
+ }
+}
+
--- /dev/null
+// 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef GDMLPLUGIN_ELLIPSOID_H_
+#define GDMLPLUGIN_ELLIPSOID_H_
+
+#include <GDMLPlugin.h>
+#include <ModelAPI_Feature.h>
+#include <GeomAlgoAPI_Ellipsoid.h>
+
+class GeomAPI_Shape;
+class ModelAPI_ResultBody;
+
+/**\class GDMLPlugin_Ellipsoid
+ * \ingroup Plugins
+ * \brief Feature for creation of a GDML Ellipsoid solid.
+ */
+class GDMLPlugin_Ellipsoid : public ModelAPI_Feature
+{
+ public:
+ /// Cone segment kind
+ inline static const std::string& ID()
+ {
+ static const std::string MY_CONESEGMENT_ID("Ellipsoid");
+ return MY_CONESEGMENT_ID;
+ }
+ /// attribute name of the inner radius at base of cone
+ inline static const std::string& AX_ID()
+ {
+ static const std::string MY_AX_ID("ax");
+ return MY_AX_ID;
+ }
+ /// attribute name of the outer radius at base of cone
+ inline static const std::string& BY_ID()
+ {
+ static const std::string MY_BY_ID("by");
+ return MY_BY_ID;
+ }
+ /// attribute name of the inner radius at top of cone
+ inline static const std::string& CZ_ID()
+ {
+ static const std::string MY_CZ_ID("cz");
+ return MY_CZ_ID;
+ }
+ /// attribute name of the outer radius at top of cone
+ inline static const std::string& ZCUT1_ID()
+ {
+ static const std::string MY_ZCUT1_ID("zcut1");
+ return MY_ZCUT1_ID;
+ }
+ /// attribute name of the outer radius at top of cone
+ inline static const std::string& USE_ZCUT1_ID()
+ {
+ static const std::string MY_USE_ZCUT1_ID("use_zcut1");
+ return MY_USE_ZCUT1_ID;
+ }
+ /// attribute name of the outer radius at top of cone
+ inline static const std::string& USE_ZCUT2_ID()
+ {
+ static const std::string MY_USE_ZCUT2_ID("use_zcut2");
+ return MY_USE_ZCUT2_ID;
+ }
+ /// attribute name of the outer radius at top of cone
+ inline static const std::string& ZCUT2_ID()
+ {
+ static const std::string MY_ZCUT2_ID("zcut2");
+ return MY_ZCUT2_ID;
+ }
+
+ /// Returns the kind of a feature
+ GDMLPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = GDMLPlugin_Ellipsoid::ID();
+ return MY_KIND;
+ }
+
+ /// Creates a new part document if needed
+ GDMLPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ GDMLPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation
+ GDMLPlugin_Ellipsoid();
+
+ private:
+ /// Load Naming data structure of the feature to the document
+ void loadNamingDS(std::shared_ptr<GeomAlgoAPI_Ellipsoid> theEllipsoidAlgo,
+ std::shared_ptr<ModelAPI_ResultBody> theResultEllipsoid);
+
+};
+
+#endif // GDMLPLUGIN_ELLIPSOID_H_
#include <GDMLPlugin_Plugin.h>
#include <GDMLPlugin_ConeSegment.h>
+#include <GDMLPlugin_Ellipsoid.h>
// the only created instance of this plugin
static GDMLPlugin_Plugin* MY_GDML_INSTANCE = new GDMLPlugin_Plugin();
{
if (theFeatureID == GDMLPlugin_ConeSegment::ID()) {
return FeaturePtr(new GDMLPlugin_ConeSegment);
+ } else if (theFeatureID == GDMLPlugin_Ellipsoid::ID()) {
+ return FeaturePtr(new GDMLPlugin_Ellipsoid);
}
+
// feature of such kind is not found
return FeaturePtr();
}
--- /dev/null
+<!--
+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<mailto:webmaster.salome@opencascade.com>
+-->
+
+<source>
+ <groupbox title="Dimensions">
+ <doublevalue id="ax"
+ label="ax"
+ step="1.0"
+ default="10.0"
+ tooltip="Enter the x semi axis length">
+ </doublevalue>
+ <doublevalue id="by"
+ label="by"
+ step="1.0"
+ default="20.0"
+ tooltip="Enter the y semi axis length">
+ </doublevalue>
+ <doublevalue id="cz"
+ label="cz"
+ step="1.0"
+ default="40.0"
+ tooltip="Enter the z semi axis length">
+ </doublevalue>
+ </groupbox>
+ <groupbox title="Cuts">
+ <optionalbox id="use_zcut1" title="">
+ <doublevalue id="zcut1"
+ label="zcut1"
+ tooltip="Enter the lower zcut"
+ default="5."
+ step="1.0"/>
+ </optionalbox>
+ <optionalbox id="use_zcut2" title="">
+ <doublevalue id="zcut2"
+ label="zcut2"
+ tooltip="Enter the upper zcut"
+ default="5."
+ step="1.0"/>
+ </optionalbox>
+ </groupbox>
+ <label title="" icon="icons/GDML/gui_ellipsoid.png"/>
+</source>
<plugin>
<workbench id="GDML" document="Part">
<group id="GDML">
- <feature id="ConeSegment" title="Cone Segment" tooltip="Create a Cone Segment" icon="icons/GDML/cone_segment.png">
+ <feature id="ConeSegment" title="Cone segment" tooltip="Create a GDML Cone Segment" icon="icons/GDML/cone_segment.png">
<source path="conesegment_widget.xml"/>
</feature>
+ <feature id="Ellipsoid" title="Ellipsoid" tooltip="Create a GDML Ellipsoid" icon="icons/GDML/ellipsoid.png">
+ <source path="ellipsoid_widget.xml"/>
+ </feature>
</group>
</workbench>
</plugin>
GeomAlgoAPI_XAOImport.h
GeomAlgoAPI_Copy.h
GeomAlgoAPI_ConeSegment.h
+ GeomAlgoAPI_Ellipsoid.h
GeomAlgoAPI_Symmetry.h
GeomAlgoAPI_Scale.h
GeomAlgoAPI_Circ2dBuilder.h
GeomAlgoAPI_XAOImport.cpp
GeomAlgoAPI_Copy.cpp
GeomAlgoAPI_ConeSegment.cpp
+ GeomAlgoAPI_Ellipsoid.cpp
GeomAlgoAPI_Symmetry.cpp
GeomAlgoAPI_Scale.cpp
GeomAlgoAPI_Circ2dBuilder.cpp
--- /dev/null
+// 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <GeomAlgoAPI_Ellipsoid.h>
+
+#include <gp_Ax2.hxx>
+#include <gp_Elips.hxx>
+#include <gp_GTrsf.hxx>
+#include <BRepBuilderAPI_GTransform.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepOffsetAPI_Sewing.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeSolid.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepPrimAPI_MakeRevol.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+
+//=================================================================================================
+GeomAlgoAPI_Ellipsoid::GeomAlgoAPI_Ellipsoid()
+{
+}
+
+//=================================================================================================
+
+GeomAlgoAPI_Ellipsoid::GeomAlgoAPI_Ellipsoid(const double theAx,
+ const double theBy,
+ const double theCz,
+ const double theZCut1,
+ const double theZCut2)
+{
+ myAx = theAx;
+ myBy = theBy;
+ myCz = theCz;
+ myZCut1 = theZCut1;
+ myZCut2 = theZCut2;
+}
+
+//=================================================================================================
+bool GeomAlgoAPI_Ellipsoid::check()
+{
+ if (myAx < Precision::Confusion()) {
+ myError = "Ellipsoid builder :: ax is negative or null.";
+ return false;
+ } else if (myBy < Precision::Confusion()) {
+ myError = "Ellipsoid builder :: by is negative or null.";
+ return false;
+ } else if (myCz < Precision::Confusion()) {
+ myError = "Ellipsoid builder :: cz is negative or null.";
+ return false;
+ } else if (myZCut1 < 0.) {
+ myError = "Ellipsoid builder :: zcut1 is negative.";
+ return false;
+ } else if (myZCut2 < 0.) {
+ myError = "Ellipsoid builder :: zcut2 is negative.";
+ return false;
+ } else if (myZCut1 < Precision::Confusion() && myZCut2 < Precision::Confusion()) {
+ myError = "Ellipsoid builder :: zcut1 and zcut2 are null.";
+ return false;
+ }
+
+ return true;
+}
+
+//=================================================================================================
+void GeomAlgoAPI_Ellipsoid::build()
+{
+ myCreatedFaces.clear();
+
+ BRepOffsetAPI_Sewing aSewer;
+ gp_Ax2 aRefAx2;
+ gp_Elips anElips;
+
+ gp_Pnt anOrigin(0., 0., 0.);
+ gp_Dir aDirX(1., 0., 0.);
+ gp_Dir aDirY(0., 1., 0.);
+ gp_Dir aDirZ(0., 0., 1.);
+ gp_Ax1 aZAxis(anOrigin, aDirZ);
+
+ // Calculate the parameters needed to make the edges and the faces
+ // gp_Elips needs the second parameter to be greater than the third (major axis)
+ if (myCz < myAx) {
+ aRefAx2 = gp_Ax2(anOrigin, aDirY, aDirX);
+ anElips = gp_Elips(aRefAx2, myAx / 2., myCz / 2.);
+ } else {
+ aRefAx2 = gp_Ax2(anOrigin, aDirY, aDirZ);
+ anElips = gp_Elips(aRefAx2, myCz / 2., myAx / 2.);
+ }
+
+ double aLowPositionFactor = sqrt(1. - (myZCut1 * myZCut1 * 4. / (myCz * myCz))) / 2.;
+ double aHighPositionFactor = sqrt(1. - (myZCut2 * myZCut2 * 4. / (myCz * myCz))) / 2.;
+
+ double aXEndTop = myAx * aHighPositionFactor;
+ double aXEndBottom = myAx * aLowPositionFactor;
+
+ // Build the XZ ellipse
+ gp_Pnt anEndPoint1(aXEndTop, 0., myZCut2);
+ gp_Pnt anEndPoint2(aXEndBottom, 0., -myZCut1);
+ BRepBuilderAPI_MakeEdge anElipsBuilder(anElips, anEndPoint1, anEndPoint2);
+ anElipsBuilder.Build();
+ TopoDS_Edge anOuterEdge = anElipsBuilder.Edge();
+
+ // Perform a revolution based on the section to build a simple version of the outer face
+ // (isotropic in XY)
+ BRepPrimAPI_MakeRevol aRevolBuilder(anOuterEdge, aZAxis, 2. * M_PI, Standard_True);
+ if (!aRevolBuilder.IsDone()) {
+ myError = "Ellipsoid builder :: section revolution did not succeed";
+ return;
+ }
+
+ gp_GTrsf aGTrsf;
+ gp_Mat rot (1., 0., 0.,
+ 0., myBy / myAx, 0.,
+ 0., 0., 1.);
+
+ aGTrsf.SetVectorialPart(rot);
+
+ BRepBuilderAPI_GTransform aScaleBuilder(aRevolBuilder.Shape(), aGTrsf, true);
+ if (!aScaleBuilder.IsDone()) {
+ myError = "Ellipsoid builder :: scale did not succeed";
+ return;
+ }
+
+ TopoDS_Face anOuterFace = TopoDS::Face(aScaleBuilder.Shape());
+ aSewer.Add(TopoDS::Face(anOuterFace.Reversed()));
+
+ // Build the high and low ellipse if needed
+ gp_Ax2 aLowAx2;
+ gp_Ax2 aHighAx2;
+ gp_Elips aLowElips;
+ gp_Elips aHighElips;
+ if (myBy < myAx) {
+ if ((myCz / 2. - myZCut1) > Precision::Confusion()) {
+ aLowAx2 = gp_Ax2(gp_Pnt(0., 0., -myZCut1), aDirZ, aDirX);
+ aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myAx, aLowPositionFactor * myBy);
+ }
+ if ((myCz / 2. - myZCut2) > Precision::Confusion()) {
+ aHighAx2 = gp_Ax2(gp_Pnt(0., 0., myZCut2), aDirZ, aDirX);
+ aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myAx, aHighPositionFactor * myBy);
+ }
+ } else {
+ if ((myCz / 2. - myZCut1) > Precision::Confusion()) {
+ aLowAx2 = gp_Ax2(gp_Pnt(0., 0., -myZCut1), aDirZ, aDirY);
+ aLowElips = gp_Elips(aLowAx2, aLowPositionFactor * myBy, aLowPositionFactor * myAx);
+ }
+ if ((myCz / 2. - myZCut2) > Precision::Confusion()) {
+ aHighAx2 = gp_Ax2(gp_Pnt(0., 0., myZCut2), aDirZ, aDirY);
+ aHighElips = gp_Elips(aHighAx2, aHighPositionFactor * myBy, aHighPositionFactor * myAx);
+ }
+ }
+
+ // Make higher and lower elliptical faces if needed
+ if ((myCz / 2. - myZCut1) > Precision::Confusion()) {
+ TopoDS_Face aBottomFace;
+ BRepBuilderAPI_MakeEdge aBottomEdgeMk(aLowElips);
+ aBottomEdgeMk.Build();
+ BRepBuilderAPI_MakeWire aBottomWireMk;
+ aBottomWireMk.Add(aBottomEdgeMk.Edge());
+ BRepBuilderAPI_MakeFace aBottomFaceMk(aBottomWireMk.Wire());
+ aBottomFace = aBottomFaceMk.Face();
+ aSewer.Add(TopoDS::Face(aBottomFace.Reversed()));
+ }
+ if ((myCz / 2. - myZCut2) > Precision::Confusion()) {
+ TopoDS_Face aTopFace;
+ BRepBuilderAPI_MakeEdge aTopEdgeMk(aHighElips);
+ aTopEdgeMk.Build();
+ BRepBuilderAPI_MakeWire aTopWireMk;
+ aTopWireMk.Add(aTopEdgeMk.Edge());
+ BRepBuilderAPI_MakeFace aTopFaceMk(aTopWireMk.Wire());
+ aTopFace = aTopFaceMk.Face();
+ aSewer.Add(TopoDS::Face(aTopFace.Reversed()));
+ }
+
+ TopoDS_Shell aShell;
+ aSewer.Perform();
+ if ((myCz / 2. - myZCut2) > Precision::Confusion() || (myCz / 2. - myZCut1) > Precision::Confusion()) {
+ aShell = TopoDS::Shell(aSewer.SewedShape());
+ } else {
+ TopoDS_Builder aBuilder;
+ aBuilder.MakeShell(aShell);
+ aBuilder.Add(aShell, aSewer.SewedShape());
+ }
+
+ BRepBuilderAPI_MakeSolid *anEllipsoidMk = new BRepBuilderAPI_MakeSolid(aShell);
+ anEllipsoidMk->Build();
+
+ // Store and publish the results
+ std::shared_ptr<GeomAPI_Shape> aResultShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape()) ;
+ aResultShape->setImpl(new TopoDS_Shape(anEllipsoidMk->Solid()));
+ setShape(aResultShape);
+
+ // Test on the shapes
+ if (!(aResultShape).get() || aResultShape->isNull()) {
+ myError = "Ellipsoid builder :: resulting shape is null.";
+ return;
+ }
+
+ setImpl(anEllipsoidMk);
+ setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
+
+ setDone(true);
+}
--- /dev/null
+// 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef GEOMALGOAPI_ELLIPSOID_H_
+#define GEOMALGOAPI_ELLIPSOID_H_
+
+#include <GeomAlgoAPI_MakeShape.h>
+
+/**\class GeomAlgoAPI_Ellipsoid
+ * \ingroup DataAlgo
+ * \brief Allows to create Ellipsoid GDML Primitives.
+ */
+class GeomAlgoAPI_Ellipsoid : public GeomAlgoAPI_MakeShape
+{
+ public:
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Ellipsoid();
+
+ /// Creates a ellipsoid using standard GDML parameters.
+ /// \param theAx X dimension of the ellipsoid.
+ /// \param theBy Y dimension of the ellipsoid.
+ /// \param theCz Z dimension of the ellipsoid.
+ /// \param theZCut1 Lower z cut.
+ /// \param theZCut2 Upper z cut.
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Ellipsoid(const double theAx,
+ const double theBy,
+ const double theCz,
+ const double theZCut1,
+ const double theZCut2);
+
+ /// Checks if the set of parameters used to define the ellipsoid are OK.
+ GEOMALGOAPI_EXPORT bool check();
+
+ /// Builds the ellipsoid based on the parameters given in the constructor.
+ GEOMALGOAPI_EXPORT void build();
+
+ private:
+ double myAx; /// X dimension of the ellipsoid.
+ double myBy; /// Y dimension of the ellipsoid.
+ double myCz; /// Z dimension of the ellipsoid.
+ double myZCut1; /// Lower z cut.
+ double myZCut2; /// Upper z cut.
+};
+
+#endif // GEOMALGOAPI_ELLIPSOID_H_
+