FeaturesAPI_Extrusion.h
FeaturesAPI_ExtrusionBoolean.h
FeaturesAPI_Intersection.h
+ FeaturesAPI_MultiRotation.h
FeaturesAPI_MultiTranslation.h
FeaturesAPI_Partition.h
FeaturesAPI_Pipe.h
FeaturesAPI_Extrusion.cpp
FeaturesAPI_ExtrusionBoolean.cpp
FeaturesAPI_Intersection.cpp
+ FeaturesAPI_MultiRotation.cpp
FeaturesAPI_MultiTranslation.cpp
FeaturesAPI_Partition.cpp
FeaturesAPI_Pipe.cpp
%shared_ptr(FeaturesAPI_ExtrusionCut)
%shared_ptr(FeaturesAPI_ExtrusionFuse)
%shared_ptr(FeaturesAPI_Intersection)
+%shared_ptr(FeaturesAPI_MultiRotation)
%shared_ptr(FeaturesAPI_MultiTranslation)
%shared_ptr(FeaturesAPI_Partition)
%shared_ptr(FeaturesAPI_Pipe)
%include "FeaturesAPI_Extrusion.h"
%include "FeaturesAPI_ExtrusionBoolean.h"
%include "FeaturesAPI_Intersection.h"
+%include "FeaturesAPI_MultiRotation.h"
%include "FeaturesAPI_MultiTranslation.h"
%include "FeaturesAPI_Partition.h"
%include "FeaturesAPI_Pipe.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_MultiRotation.cpp
+// Created: 04 Apr 2017
+// Author: Clarisse Genrault (CEA)
+
+#include <FeaturesAPI_MultiRotation.h>
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+
+//==================================================================================================
+FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Integer& theNumber)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mainObjects());
+ fillAttribute(theAxis, axisAngular());
+ fillAttribute("",useStepAngular());
+ setNumberAngular(theNumber);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_MultiRotation::FeaturesAPI_MultiRotation(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theStep,
+ const ModelHighAPI_Integer& theNumber)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mainObjects());
+ fillAttribute(theAxis, axisAngular());
+ fillAttribute(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(),useStepAngular());
+ fillAttribute(theStep, stepAngular());
+ setNumberAngular(theNumber);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_MultiRotation::~FeaturesAPI_MultiRotation()
+{
+}
+
+//==================================================================================================
+void FeaturesAPI_MultiRotation::setMainObjects(
+ const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mainObjects());
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_MultiRotation::setAxisAngular(const ModelHighAPI_Selection& theAxis)
+{
+ fillAttribute(theAxis, axisAngular());
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_MultiRotation::setStepAngular(const ModelHighAPI_Double& theStep)
+{
+ fillAttribute(theStep, stepAngular());
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_MultiRotation::setNumberAngular(const ModelHighAPI_Integer& theNumber)
+{
+ fillAttribute(theNumber, nbAngular());
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_MultiRotation::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ AttributeSelectionListPtr anAttrObjects =
+ aBase->selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID());
+ theDumper << aBase << " = model.addMultiRotation(" << aDocName << ", " << anAttrObjects;
+
+ AttributeSelectionPtr anAttrAxis =
+ aBase->selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID());
+ theDumper << ", " << anAttrAxis;
+
+ if (aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->isInitialized()
+ && !aBase->string(FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID())->value().empty()) {
+ AttributeDoublePtr anAttrStepAngular =
+ aBase->real(FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID());
+ theDumper << ", " << anAttrStepAngular;
+ }
+
+ AttributeIntegerPtr anAttrNumberAngular =
+ aBase->integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID());
+ theDumper << ", " << anAttrNumberAngular;
+
+ theDumper << ")" << std::endl;
+}
+
+//==================================================================================================
+MultiRotationPtr addMultiRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Integer& theNumber)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ thePart->addFeature(FeaturesAPI_MultiRotation::ID());
+ return MultiRotationPtr(new FeaturesAPI_MultiRotation(aFeature, theMainObjects,
+ theAxis, theNumber));
+}
+
+//==================================================================================================
+MultiRotationPtr addMultiRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theStep,
+ const ModelHighAPI_Integer& theNumber)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ thePart->addFeature(FeaturesAPI_MultiRotation::ID());
+ return MultiRotationPtr(new FeaturesAPI_MultiRotation(aFeature, theMainObjects,
+ theAxis, theStep, theNumber));
+}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_MultiRotation.h
+// Created: 04 Apr 2017
+// Author: Clarisse Genrault (CEA)
+
+#ifndef FEATURESAPI_MULTIROTATION_H_
+#define FEATURESAPI_MULTIROTATION_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_MultiRotation.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Dumper;
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_MultiRotation
+/// \ingroup CPPHighAPI
+/// \brief Interface for Translation feature.
+class FeaturesAPI_MultiRotation: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_MultiRotation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_MultiRotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Integer& theNumber);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_MultiRotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theStep,
+ const ModelHighAPI_Integer& theNumber);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_MultiRotation();
+
+ INTERFACE_5(FeaturesPlugin_MultiRotation::ID(),
+ mainObjects, FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID(),
+ ModelAPI_AttributeSelectionList, /** Main objects */,
+ axisAngular, FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID(),
+ ModelAPI_AttributeSelection, /** Angular direction */,
+ useStepAngular, FeaturesPlugin_MultiRotation::USE_ANGULAR_STEP_ID(),
+ ModelAPI_AttributeString, /** Use step angular */,
+ stepAngular, FeaturesPlugin_MultiRotation::STEP_ANGULAR_ID(),
+ ModelAPI_AttributeDouble, /** Step angular */,
+ nbAngular, FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(),
+ ModelAPI_AttributeInteger, /** Number of copies for angular */
+ )
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Modify CreationMethod, axis_angular attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setAxisAngular(const ModelHighAPI_Selection& theAxis);
+
+ /// Modify CreationMethod, step_angular attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setStepAngular(const ModelHighAPI_Double& theStep);
+
+ /// Modify CreationMethod, nb_angular attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setNumberAngular(const ModelHighAPI_Integer& theNumber);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Multirotation object.
+typedef std::shared_ptr<FeaturesAPI_MultiRotation> MultiRotationPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create MultiRotation feature.
+FEATURESAPI_EXPORT
+MultiRotationPtr addMultiRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Integer& theNumber);
+
+/// \ingroup CPPHighAPI
+/// \brief Create MultiRotation feature.
+FEATURESAPI_EXPORT
+MultiRotationPtr addMultiRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theStep,
+ const ModelHighAPI_Integer& theNumber);
+
+#endif // FEATURESAPI_MULTIROTATION_H_
virtual void dump(ModelHighAPI_Dumper& theDumper) const;
};
-/// Pointer on Translation object.
+/// Pointer on MultiTranslation object.
typedef std::shared_ptr<FeaturesAPI_MultiTranslation> MultiTranslationPtr;
/// \ingroup CPPHighAPI
#include "FeaturesAPI_Extrusion.h"
#include "FeaturesAPI_ExtrusionBoolean.h"
#include "FeaturesAPI_Intersection.h"
+ #include "FeaturesAPI_MultiRotation.h"
#include "FeaturesAPI_MultiTranslation.h"
#include "FeaturesAPI_Partition.h"
#include "FeaturesAPI_Pipe.h"
myError = "Rotation builder :: source shape is not valid.";
return false;
}
- if (myAngle < -360.) {
- myError = "Rotation builder :: angle smaller than -360 degrees.";
- return false;
- }
- if (myAngle > 360.) {
- myError = "Rotation builder :: angle greater than 360 degrees.";
- return false;
- }
return true;
}
case BY_POINTS: {
"""
from FeaturesAPI import addPlacement, addRotation, addScale, addSymmetry, addTranslation
-from FeaturesAPI import addMultiTranslation
+from FeaturesAPI import addMultiTranslation, addMultiRotation
from FeaturesAPI import addExtrusion, addExtrusionCut, addExtrusionFuse
from FeaturesAPI import addRevolution, addRevolutionCut, addRevolutionFuse
from FeaturesAPI import addPipe