#include "FeaturesAPI_Group.h"
+#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Integer.h>
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
execute();
}
+//==================================================================================================
+void FeaturesAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ AttributeSelectionListPtr anAttrList = aBase->selectionList(FeaturesPlugin_Group::LIST_ID());
+
+ theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList << ")" << std::endl;
+}
+
//==================================================================================================
GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
const std::list<ModelHighAPI_Selection>& theGroupList)
#include <ModelHighAPI_Interface.h>
#include <ModelHighAPI_Macro.h>
+class ModelHighAPI_Dumper;
class ModelHighAPI_Selection;
/// \class FeaturesAPI_Group
/// Set main objects.
FEATURESAPI_EXPORT
void setGroupList(const std::list<ModelHighAPI_Selection>& theGroupList);
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
};
/// Pointer on Group object.
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- // extrusion works with faces always
- aSelection->setSelectionType("SOLID");
aSelection = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Boolean::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- // extrusion works with faces always
- aSelection->setSelectionType("SOLID");
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- // extrusion works with faces always
- aSelection->setSelectionType("SOLID");
data()->addAttribute(START_SHAPE_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(END_SHAPE_ID(), ModelAPI_AttributeSelection::typeId());
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- // revolution works with faces always
- aSelection->setSelectionType("SOLID");
data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
AttributeSelectionListPtr aSelection =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
FeaturesPlugin_Translation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- // revolution works with faces always
- aSelection->setSelectionType("SOLID");
data()->addAttribute(FeaturesPlugin_Translation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Translation::DISTANCE_ID(), ModelAPI_AttributeDouble::typeId());
{
return myTypeSubShapeNamePair;
}
+
+//==================================================================================================
+std::string ModelHighAPI_Selection::shapeType() const
+{
+ switch(myVariantType) {
+ case VT_ResultSubShapePair: return myResultSubShapePair.second->shapeTypeStr();
+ case VT_TypeSubShapeNamePair: return myTypeSubShapeNamePair.first;
+ }
+
+ return "SHAPE";
+}
MODELHIGHAPI_EXPORT
virtual TypeSubShapeNamePair typeSubShapeNamePair() const;
+ /// \return shape type.
+ MODELHIGHAPI_EXPORT
+ virtual std::string shapeType() const;
+
private:
VariantType myVariantType;
ResultSubShapePair myResultSubShapePair;
const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
{
theAttribute->clear();
+
+ if(!theValue.empty()) {
+ std::string aSelectionType;
+ const ModelHighAPI_Selection& aSelection = theValue.front();
+ theAttribute->setSelectionType(aSelection.shapeType());
+ }
+
for (auto it = theValue.begin(); it != theValue.end(); ++it)
it->appendToList(theAttribute);
}