FeaturesAPI_Extrusion.h
FeaturesAPI_ExtrusionBoolean.h
FeaturesAPI_Group.h
+ FeaturesAPI_Pipe.h
FeaturesAPI_Placement.h
FeaturesAPI_Revolution.h
FeaturesAPI_RevolutionBoolean.h
FeaturesAPI_Extrusion.cpp
FeaturesAPI_ExtrusionBoolean.cpp
FeaturesAPI_Group.cpp
+ FeaturesAPI_Pipe.cpp
FeaturesAPI_Placement.cpp
FeaturesAPI_Rotation.cpp
FeaturesAPI_Revolution.cpp
%shared_ptr(FeaturesAPI_ExtrusionCut)
%shared_ptr(FeaturesAPI_ExtrusionFuse)
%shared_ptr(FeaturesAPI_Group)
+%shared_ptr(FeaturesAPI_Pipe)
%shared_ptr(FeaturesAPI_Placement)
%shared_ptr(FeaturesAPI_Revolution)
%shared_ptr(FeaturesAPI_RevolutionBoolean)
%include "FeaturesAPI_Extrusion.h"
%include "FeaturesAPI_ExtrusionBoolean.h"
%include "FeaturesAPI_Group.h"
+%include "FeaturesAPI_Pipe.h"
%include "FeaturesAPI_Placement.h"
%include "FeaturesAPI_Revolution.h"
%include "FeaturesAPI_RevolutionBoolean.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Pipe.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Pipe.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ setPath(thePath);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setByBasePathBiNormal(theBaseObjects, thePath, theBiNoramal);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setByBasePathLocations(theBaseObjects, thePath, theLocations);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::~FeaturesAPI_Pipe()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setPath(const ModelHighAPI_Selection& thePath)
+{
+ fillAttribute(thePath, mypath);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePath(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePathBiNormal(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+ fillAttribute(theBiNoramal, mybiNormal);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePathLocations(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+ fillAttribute(theLocations, mylocations);
+
+ execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath));
+}
+
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theBiNoramal));
+}
+
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theLocations));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Pipe.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Pipe_H_
+#define FeaturesAPI_Pipe_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Pipe.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Pipe
+/// \ingroup CPPHighAPI
+/// \brief Interface for Pipe feature.
+class FeaturesAPI_Pipe: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Pipe();
+
+ INTERFACE_5(FeaturesPlugin_Pipe::ID(),
+ baseObjects, FeaturesPlugin_Pipe::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ path, FeaturesPlugin_Pipe::PATH_OBJECT_ID(), ModelAPI_AttributeSelection, /** Path */,
+ creationMethod, FeaturesPlugin_Pipe::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ biNormal, FeaturesPlugin_Pipe::BINORMAL_ID(), ModelAPI_AttributeSelection, /** Bi-Normal */,
+ locations, FeaturesPlugin_Pipe::LOCATIONS_ID(), ModelAPI_AttributeSelectionList, /** Locations */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify path attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setPath(const ModelHighAPI_Selection& thePath);
+
+ /// Modify creation method, base and path.
+ FEATURESAPI_EXPORT
+ void setByBasePath(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+ /// Modify creation method, base, path and bi-normal.
+ FEATURESAPI_EXPORT
+ void setByBasePathBiNormal(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+ /// Modify creation method, base, path and locations.
+ FEATURESAPI_EXPORT
+ void setByBasePathLocations(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+};
+
+/// Pointer on Pipe object.
+typedef std::shared_ptr<FeaturesAPI_Pipe> PipePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+
+#endif // FeaturesAPI_Pipe_H_
#include "FeaturesAPI_Extrusion.h"
#include "FeaturesAPI_ExtrusionBoolean.h"
#include "FeaturesAPI_Group.h"
+ #include "FeaturesAPI_Pipe.h"
#include "FeaturesAPI_Placement.h"
#include "FeaturesAPI_Revolution.h"
#include "FeaturesAPI_RevolutionBoolean.h"
}
// Searching faces with common edges.
- if(aCreationMethod == "simple") {
+ if(aCreationMethod == CREATION_METHOD_SIMPLE()) {
ListOfShape aShells;
ListOfShape aFreeFaces;
std::shared_ptr<GeomAPI_Shape> aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList);
// Getting Bi-Normal
std::shared_ptr<GeomAPI_Shape> aBiNormal;
- if(aCreationMethod == "binormal") {
+ if(aCreationMethod == CREATION_METHOD_BINORMAL()) {
AttributeSelectionPtr aBiNormalSelection = selection(BINORMAL_ID());
if(!aBiNormalSelection.get()) {
setError("Error: Bi-Normal selection is empty.");
// Getting locations.
ListOfShape aLocations;
- if(aCreationMethod == "locations") {
+ if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
AttributeSelectionListPtr aLocationsSelectionList = selectionList(LOCATIONS_ID());
if(!aLocationsSelectionList.get()) {
setError("Error: Could not get locations selection list.");
// Generating result for each object.
int aResultIndex = 0;
- if(aCreationMethod == "simple" || aCreationMethod == "binormal") {
+ if(aCreationMethod == CREATION_METHOD_SIMPLE() || aCreationMethod == CREATION_METHOD_BINORMAL()) {
for(ListOfShape::const_iterator anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
- GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod == "simple" ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
- GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
+ GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod ==
+ CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
+ GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
if(!aPipeAlgo.isDone()) {
setError("Error: Pipe algorithm failed.");
storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
}
- } else if(aCreationMethod == "locations") {
+ } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
GeomAlgoAPI_Pipe aPipeAlgo = GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape);
if(!aPipeAlgo.isDone()) {
return MY_CREATION_METHOD;
}
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_SIMPLE()
+ {
+ static const std::string MY_CREATION_METHOD("simple");
+ return MY_CREATION_METHOD;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BINORMAL()
+ {
+ static const std::string MY_CREATION_METHOD("binormal");
+ return MY_CREATION_METHOD;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_LOCATIONS()
+ {
+ static const std::string MY_CREATION_METHOD("locations");
+ return MY_CREATION_METHOD;
+ }
+
/// Attribute name of base objects.
inline static const std::string& BASE_OBJECTS_ID()
{