#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_Document.h>
+#include <ModelAPI_Events.h>
//--------------------------------------------------------------------------------------
AttributeReferencePtr aLastFeatAttr = aFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID());
fillAttribute(theLastFeature.feature(), aLastFeatAttr);
+ // to update the folder state in the Object Browser
+ theDoc->updateHistory(ModelAPI_Feature::group());
+
return std::shared_ptr<ModelHighAPI_Folder>(new ModelHighAPI_Folder(aFolder));
}
+
+void removeFolder(std::shared_ptr<ModelHighAPI_Folder>& theFolder)
+{
+ theFolder->folder()->document()->removeFolder(theFolder->folder());
+}
static std::string ID() { return ModelAPI_Folder::ID(); }
virtual std::string getID() { return ID(); }
+ const std::shared_ptr<ModelAPI_Folder>& folder() const {return myFolder;}
/// First feature reference
std::shared_ptr<ModelAPI_AttributeReference> firstFeature() const
MODELHIGHAPI_EXPORT
std::string name() const;
+ /// To update the folder state
+ /// \param isForce start execution of feature instead of sending events
+ //MODELHIGHAPI_EXPORT void execute();
+
+
/// Dump wrapped feature
MODELHIGHAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const;
std::shared_ptr<ModelHighAPI_Folder> addFolder(const std::shared_ptr<ModelAPI_Document>& theDoc,
const ModelHighAPI_Reference& theFirstFeature,
const ModelHighAPI_Reference& theLastFeature);
+/**\ingroup CPPHighAPI
+* \brief Removes Folder feature
+*/
+MODELHIGHAPI_EXPORT
+void removeFolder(std::shared_ptr<ModelHighAPI_Folder>& theFolder);
//--------------------------------------------------------------------------------------
#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_FOLDER_H_ */
from ModelHighAPI import updateFeatures
from ModelHighAPI import undo, redo
from ModelHighAPI import reset
-from ModelHighAPI import addFolder
+from ModelHighAPI import addFolder, removeFolder
from ModelHighAPI import ModelHighAPI_Selection as selection
from ModelHighAPI import checkPythonDump as checkPythonDump
for feature in self.lfeatures:
part.removeFeature(feature.feature())
self.lfeatures = []
- #part.removeFeature(self.folder.feature())
+ model.removeFolder(self.folder)
from os.path import basename
filename = basename(filepath)