#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepPrimAPI_MakeRevol.hxx>
// Construct the tube
gp_Vec aVec(aNormal);
- BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aFace, aVec * myZ);
+ gp_Trsf aTrsf;
+ aTrsf.SetTranslation(aVec * -myZ/2);
+ BRepBuilderAPI_Transform* aTransformBuilder =
+ new BRepBuilderAPI_Transform(aFace, aTrsf);
+ if (!aTransformBuilder || !aTransformBuilder->IsDone()) {
+ return;
+ }
+// this->appendAlgo(std::shared_ptr<GeomAlgoAPI_MakeShape>(
+// new GeomAlgoAPI_MakeShape(aTransformBuilder)));
+ TopoDS_Shape aMovedBase = aTransformBuilder->Shape();
+ BRepPrimAPI_MakePrism* aPrismBuilder = new BRepPrimAPI_MakePrism(aMovedBase, aVec * myZ);
setImpl(aPrismBuilder);
setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
PrimitivesAPI_Cylinder.h
PrimitivesAPI_Sphere.h
PrimitivesAPI_Torus.h
+ PrimitivesAPI_Tube.h
)
SET(PROJECT_SOURCES
PrimitivesAPI_Cylinder.cpp
PrimitivesAPI_Sphere.cpp
PrimitivesAPI_Torus.cpp
+ PrimitivesAPI_Tube.cpp
)
SET(PROJECT_LIBRARIES
%shared_ptr(PrimitivesAPI_Cylinder)
%shared_ptr(PrimitivesAPI_Sphere)
%shared_ptr(PrimitivesAPI_Torus)
+%shared_ptr(PrimitivesAPI_Tube)
// all supported interfaces
%include "PrimitivesAPI_Box.h"
%include "PrimitivesAPI_Cylinder.h"
%include "PrimitivesAPI_Sphere.h"
%include "PrimitivesAPI_Torus.h"
+%include "PrimitivesAPI_Tube.h"
--- /dev/null
+// Copyright (C) 2014-2019 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_Tube.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+}
+
+//==================================================================================================
+PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(PrimitivesPlugin_Tube::METHODE_SIMPLE_TUBE_ID(), creationMethod());
+ fillAttribute(theRMin, rmin());
+ fillAttribute(theRMax, rmax());
+ fillAttribute(theZ, z());
+
+ execute();
+ }
+}
+
+//==================================================================================================
+PrimitivesAPI_Tube::PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ,
+ const ModelHighAPI_Double& theStartPhi,
+ const ModelHighAPI_Double& theDeltaPhi)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(PrimitivesPlugin_Tube::METHODE_SEGMENT_TUBE_ID(), creationMethod());
+ fillAttribute(theRMin, rmin());
+ fillAttribute(theRMax, rmax());
+ fillAttribute(theZ, z());
+ fillAttribute(theStartPhi, startphi());
+ fillAttribute(theDeltaPhi, deltaphi());
+
+ execute();
+ }
+}
+
+//==================================================================================================
+PrimitivesAPI_Tube::~PrimitivesAPI_Tube()
+{
+}
+
+//==================================================================================================
+void PrimitivesAPI_Tube::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ theDumper << aBase << " = model.addTube(" << aDocName;
+
+ std::string aCreationMethod = aBase->string(PrimitivesPlugin_Tube::CREATION_METHOD())->value();
+
+ if(aCreationMethod == PrimitivesPlugin_Tube::METHODE_SIMPLE_TUBE_ID()) {
+ AttributeDoublePtr anAttrRMin = aBase->real(PrimitivesPlugin_Tube::RMIN_ID());
+ AttributeDoublePtr anAttrRMax = aBase->real(PrimitivesPlugin_Tube::RMAX_ID());
+ AttributeDoublePtr anAttrZ = aBase->real(PrimitivesPlugin_Tube::Z_ID());
+ theDumper << ", " << anAttrRMin << ", " << anAttrRMax << ", " << anAttrZ;
+ } else if (aCreationMethod == PrimitivesPlugin_Tube::METHODE_SEGMENT_TUBE_ID()) {
+ AttributeDoublePtr anAttrRMin = aBase->real(PrimitivesPlugin_Tube::RMIN_ID());
+ AttributeDoublePtr anAttrRMax = aBase->real(PrimitivesPlugin_Tube::RMAX_ID());
+ AttributeDoublePtr anAttrZ = aBase->real(PrimitivesPlugin_Tube::Z_ID());
+ AttributeDoublePtr anAttrStartPhi = aBase->real(PrimitivesPlugin_Tube::START_PHI_ID());
+ AttributeDoublePtr anAttrDeltaPhi = aBase->real(PrimitivesPlugin_Tube::DELTA_PHI_ID());
+ theDumper << ", " << anAttrRMin << ", " << anAttrRMax << ", " << anAttrZ;
+ theDumper << ", " << anAttrStartPhi << ", " << anAttrDeltaPhi;
+ }
+
+ theDumper << ")" << std::endl;
+}
+
+//==================================================================================================
+TubePtr addTube(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Tube::ID());
+ return TubePtr(new PrimitivesAPI_Tube(aFeature, theRMin, theRMax, theZ));
+}
+
+//==================================================================================================
+TubePtr addTube(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ,
+ const ModelHighAPI_Double& theStartPhi,
+ const ModelHighAPI_Double& theDeltaPhi)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PrimitivesAPI_Tube::ID());
+ return TubePtr(new PrimitivesAPI_Tube(aFeature, theRMin, theRMax, theZ,
+ theStartPhi, theDeltaPhi));
+}
--- /dev/null
+// Copyright (C) 2014-2019 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
+//
+
+#ifndef PRIMITIVESAPI_TUBE_H_
+#define PRIMITIVESAPI_TUBE_H_
+
+#include "PrimitivesAPI.h"
+
+#include <PrimitivesPlugin_Tube.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class PrimitivesAPI_Tube
+/// \ingroup CPPHighAPI
+/// \brief Interface for primitive Tube feature.
+class PrimitivesAPI_Tube: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ PRIMITIVESAPI_EXPORT
+ explicit PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ PRIMITIVESAPI_EXPORT
+ explicit PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ);
+
+ /// Constructor with values.
+ PRIMITIVESAPI_EXPORT
+ explicit PrimitivesAPI_Tube(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ,
+ const ModelHighAPI_Double& theStartPhi,
+ const ModelHighAPI_Double& theDeltaPhi);
+
+ /// Destructor.
+ PRIMITIVESAPI_EXPORT
+ virtual ~PrimitivesAPI_Tube();
+
+ INTERFACE_6(PrimitivesPlugin_Tube::ID(),
+ creationMethod, PrimitivesPlugin_Tube::CREATION_METHOD(),
+ ModelAPI_AttributeString, /** Creation method */,
+ rmin, PrimitivesPlugin_Tube::RMIN_ID(),
+ ModelAPI_AttributeDouble, /** ???? */,
+ rmax, PrimitivesPlugin_Tube::RMAX_ID(),
+ ModelAPI_AttributeDouble, /** ???? */,
+ z, PrimitivesPlugin_Tube::Z_ID(),
+ ModelAPI_AttributeDouble, /** ???? */,
+ startphi, PrimitivesPlugin_Tube::START_PHI_ID(),
+ ModelAPI_AttributeDouble, /** ???? */,
+ deltaphi, PrimitivesPlugin_Tube::DELTA_PHI_ID(),
+ ModelAPI_AttributeDouble, /** ???? */)
+
+ /// Dump wrapped feature
+ PRIMITIVESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on primitive Tube object
+typedef std::shared_ptr<PrimitivesAPI_Tube> TubePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create primitive Box feature.
+PRIMITIVESAPI_EXPORT
+TubePtr addTube(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ);
+
+/// \ingroup CPPHighAPI
+/// \brief Create primitive Box feature.
+PRIMITIVESAPI_EXPORT
+TubePtr addTube(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Double& theRMin,
+ const ModelHighAPI_Double& theRMax,
+ const ModelHighAPI_Double& theZ,
+ const ModelHighAPI_Double& theStartPhi,
+ const ModelHighAPI_Double& theDeltaPhi);
+
+#endif // PRIMITIVESAPI_TUBE_H_
#include "PrimitivesAPI_Cylinder.h"
#include "PrimitivesAPI_Sphere.h"
#include "PrimitivesAPI_Torus.h"
+ #include "PrimitivesAPI_Tube.h"
#endif // PRIMITIVESAPI_SWIG_H_
"""Package for Primitives plugin for the Parametric Geometry API of the Modeler.
"""
-from PrimitivesAPI import addBox, addCone, addCylinder, addSphere, addTorus
+from PrimitivesAPI import addBox, addCone, addCylinder, addSphere, addTorus, addTube