1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include "PartSet_Module.h"
4 #include <PartSet_WidgetSketchLabel.h>
5 #include <PartSet_Validators.h>
6 #include <PartSet_Tools.h>
7 #include <PartSet_WidgetPoint2d.h>
8 #include <PartSet_WidgetPoint2dDistance.h>
9 #include <PartSet_WidgetShapeSelector.h>
10 #include <PartSet_WidgetConstraintShapeSelector.h>
11 #include <PartSet_SketcherMgr.h>
13 #include <ModuleBase_Operation.h>
14 #include <ModuleBase_IViewer.h>
15 #include <ModuleBase_IViewWindow.h>
16 #include <ModuleBase_IPropertyPanel.h>
17 #include <ModuleBase_WidgetEditor.h>
18 #include <ModuleBase_FilterFactory.h>
19 #include <ModuleBase_FilterLinearEdge.h>
20 #include <ModuleBase_FilterFace.h>
21 #include <ModuleBase_FilterMulti.h>
22 #include <ModuleBase_FilterCustom.h>
23 #include <ModuleBase_FilterNoConsructionSubShapes.h>
25 #include <ModelAPI_Object.h>
26 #include <ModelAPI_Events.h>
27 #include <ModelAPI_Validator.h>
28 #include <ModelAPI_Data.h>
29 #include <ModelAPI_Session.h>
30 #include <ModelAPI_ShapeValidator.h>
32 #include <GeomDataAPI_Point2D.h>
33 #include <GeomDataAPI_Point.h>
34 #include <GeomDataAPI_Dir.h>
36 #include <XGUI_Displayer.h>
37 #include <XGUI_Workshop.h>
38 #include <XGUI_OperationMgr.h>
39 #include <XGUI_PropertyPanel.h>
40 #include <XGUI_ModuleConnector.h>
41 #include <XGUI_ContextMenuMgr.h>
42 #include <XGUI_Tools.h>
44 #include <SketchPlugin_Feature.h>
45 #include <SketchPlugin_Sketch.h>
46 #include <SketchPlugin_Line.h>
47 //#include <SketchPlugin_Arc.h>
48 //#include <SketchPlugin_Circle.h>
49 #include <SketchPlugin_ConstraintLength.h>
50 #include <SketchPlugin_ConstraintDistance.h>
51 #include <SketchPlugin_ConstraintParallel.h>
52 #include <SketchPlugin_ConstraintPerpendicular.h>
53 #include <SketchPlugin_ConstraintRadius.h>
54 //#include <SketchPlugin_ConstraintRigid.h>
56 #include <Events_Loop.h>
57 #include <Config_PropManager.h>
59 #include <StdSelect_TypeOfFace.hxx>
60 #include <TopoDS_Vertex.hxx>
62 #include <TopoDS_Shape.hxx>
63 #include <BRep_Tool.hxx>
66 #include <QMouseEvent>
69 #include <QApplication>
70 #include <QMessageBox>
71 #include <QMainWindow>
73 #include <GeomAlgoAPI_FaceBuilder.h>
74 #include <GeomDataAPI_Dir.h>
80 /*!Create and return new instance of XGUI_Module*/
81 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
83 return new PartSet_Module(theWshop);
86 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
87 : ModuleBase_IModule(theWshop),
88 myRestartingMode(RM_None)
90 //myWorkshop = dynamic_cast<XGUI_Workshop*>(theWshop);
91 mySketchMgr = new PartSet_SketcherMgr(this);
93 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
94 XGUI_Workshop* aWorkshop = aConnector->workshop();
96 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
97 connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
98 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
99 this, SLOT(onOperationActivatedByPreselection()));
101 ModuleBase_IViewer* aViewer = theWshop->viewer();
102 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
103 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
108 PartSet_Module::~PartSet_Module()
110 if (!myDocumentShapeFilter.IsNull())
111 myDocumentShapeFilter.Nullify();
114 void PartSet_Module::registerValidators()
116 //Registering of validators
117 SessionPtr aMgr = ModelAPI_Session::get();
118 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
119 aFactory->registerValidator("PartSet_DistanceValidator", new PartSet_DistanceValidator);
120 aFactory->registerValidator("PartSet_LengthValidator", new PartSet_LengthValidator);
121 aFactory->registerValidator("PartSet_PerpendicularValidator", new PartSet_PerpendicularValidator);
122 aFactory->registerValidator("PartSet_ParallelValidator", new PartSet_ParallelValidator);
123 aFactory->registerValidator("PartSet_RadiusValidator", new PartSet_RadiusValidator);
124 aFactory->registerValidator("PartSet_RigidValidator", new PartSet_RigidValidator);
125 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
126 aFactory->registerValidator("PartSet_DifferentShapes", new ModelAPI_ShapeValidator);
127 aFactory->registerValidator("PartSet_SketchValidator", new PartSet_SketchValidator);
130 void PartSet_Module::registerFilters()
132 //Registering of selection filters
133 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
134 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
136 aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
137 aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
138 aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
139 Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
140 aFactory->registerFilter("NoConstructionSubShapesFilter",
141 new ModuleBase_FilterCustom(aSelectFilter));
144 void PartSet_Module::registerProperties()
146 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
148 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
149 Config_Prop::Integer, SKETCH_WIDTH);
152 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
154 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
155 mySketchMgr->commitNestedSketch(theOperation);
158 if (theOperation->isEditOperation())
160 // the selection is cleared after commit the create operation
161 // in order to do not use the same selected objects in the restarted operation
162 // for common behaviour, the selection is cleared even if the operation is not restarted
163 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
164 if (!aContext.IsNull())
165 aContext->ClearSelected();
167 /// Restart sketcher operations automatically
168 FeaturePtr aFeature = theOperation->feature();
169 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
170 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
171 if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed ||
172 myRestartingMode == RM_EmptyFeatureUsed)) {
173 myLastOperationId = theOperation->id();
174 myLastFeature = myRestartingMode == RM_LastFeatureUsed ? theOperation->feature() : FeaturePtr();
176 launchOperation(myLastOperationId);
178 breakOperationSequence();
181 void PartSet_Module::breakOperationSequence()
183 myLastOperationId = "";
184 myLastFeature = FeaturePtr();
185 myRestartingMode = RM_None;
188 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
190 breakOperationSequence();
193 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
195 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
196 mySketchMgr->startSketch(theOperation);
198 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
199 mySketchMgr->startNestedSketch(theOperation);
202 if (myDocumentShapeFilter.IsNull())
203 myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
204 myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
207 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
209 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
210 mySketchMgr->stopSketch(theOperation);
212 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
213 mySketchMgr->stopNestedSketch(theOperation);
215 myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
218 bool PartSet_Module::canUndo() const
220 bool aCanUndo = false;
221 SessionPtr aMgr = ModelAPI_Session::get();
222 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
223 aCanUndo = !aMgr->isOperation();
224 if (!aCanUndo) // check the enable state additionally by sketch manager
225 aCanUndo = aMgr->canUndo();
230 bool PartSet_Module::canRedo() const
232 bool aCanRedo = false;
233 SessionPtr aMgr = ModelAPI_Session::get();
234 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
235 aCanRedo = !aMgr->isOperation();
236 if (!aCanRedo) // check the enable state additionally by sketch manager
237 aCanRedo = aMgr->canRedo();
242 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
244 bool aCanDisplay = false;
245 if (!mySketchMgr->canDisplayObject())
247 CompositeFeaturePtr aSketchFeature = mySketchMgr->activeSketch();
248 if (aSketchFeature.get() != NULL) {
249 FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
251 // MPV: the second and third conditions to avoid crash on exit for application
252 if (aFeature.get() != NULL && aFeature->data().get() && aFeature->data()->isValid()) {
253 if (aFeature == aSketchFeature) {
256 else if (aSketchFeature.get() && aSketchFeature->data().get() &&
257 aSketchFeature->data()->isValid()) {
258 for (int i = 0; i < aSketchFeature->numberOfSubs() && !aCanDisplay; i++) {
259 FeaturePtr aSubFeature = aSketchFeature->subFeature(i);
260 std::list<ResultPtr> aResults = aSubFeature->results();
261 std::list<ResultPtr>::const_iterator aIt;
262 for (aIt = aResults.begin(); aIt != aResults.end() && !aCanDisplay; ++aIt) {
263 if (theObject == (*aIt))
266 if (aSubFeature == theObject)
273 aCanDisplay = ModuleBase_IModule::canDisplayObject(theObject);
278 void PartSet_Module::addViewerItems(QMenu* theMenu) const
280 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
281 if (!PartSet_SketcherMgr::isSketchOperation(anOperation) &&
282 !PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
285 ModuleBase_ISelection* aSelection = myWorkshop->selection();
286 QObjectPtrList aObjects = aSelection->selectedPresentations();
287 if (aObjects.size() > 0) {
288 bool hasFeature = false;
289 foreach(ObjectPtr aObject, aObjects)
291 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
292 if (aFeature.get() != NULL) {
297 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
298 XGUI_Workshop* aWorkshop = aConnector->workshop();
299 QAction* anAction = aWorkshop->contextMenuMgr()->action("DELETE_CMD");
300 theMenu->addAction(anAction);
304 if (mySketchMgr->canChangeConstruction(isConstruction)) {
305 QAction* anAction = action("CONSTRUCTION_CMD");
306 theMenu->addAction(anAction);
307 anAction->setChecked(isConstruction);
311 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
313 ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel();
314 if (PartSet_SketcherMgr::isSketchOperation(theOperation) && (theOperation->isEditOperation())) {
315 // we have to manually activate the sketch label in edit mode
316 aPanel->activateWidget(aPanel->modelWidgets().first());
320 // Restart last operation type
321 if ((theOperation->id() == myLastOperationId) && myLastFeature) {
322 ModuleBase_ModelWidget* aWgt = aPanel->activeWidget();
323 if (theOperation->id().toStdString() == SketchPlugin_Line::ID()) {
324 // Initialise new line with first point equal to end of previous
325 PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
327 std::shared_ptr<ModelAPI_Data> aData = myLastFeature->data();
328 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
329 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
331 aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
332 PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), theOperation->feature(),
333 aWgt->attributeID(), aPoint->x(), aPoint->y());
334 aPanel->activateNextWidget(aPnt2dWgt);
339 // Start editing constraint
340 if (theOperation->isEditOperation()) {
341 // TODO: #391 - to be removed
342 std::string aId = theOperation->id().toStdString();
343 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation) &&
344 PartSet_SketcherMgr::isDistanceOperation(theOperation)) {
345 // Find and activate widget for management of point for dimension line position
346 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
347 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
348 PartSet_WidgetPoint2D* aPntWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
350 aPanel->activateWidget(aPntWgt);
360 void PartSet_Module::onSelectionChanged()
362 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
366 bool isSketcherOp = false;
367 // An edit operation is enable only if the current opeation is the sketch operation
368 if (mySketchMgr->activeSketch()) {
369 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
370 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
373 // Editing of constraints can be done on selection
374 ModuleBase_ISelection* aSelect = myWorkshop->selection();
375 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
376 if (aSelected.size() == 1) {
377 ModuleBase_ViewerPrs aPrs = aSelected.first();
378 ObjectPtr aObject = aPrs.object();
379 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
381 std::string aId = aFeature->getKind();
382 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
383 (aId == SketchPlugin_ConstraintLength::ID()) ||
384 (aId == SketchPlugin_ConstraintDistance::ID())) {
385 editFeature(aFeature);
392 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
394 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
395 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
396 anOpMgr->onKeyReleased(theEvent);
399 void PartSet_Module::onEnterReleased()
401 myRestartingMode = RM_EmptyFeatureUsed;
404 void PartSet_Module::onOperationActivatedByPreselection()
406 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
407 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
408 // Set final definitions if they are necessary
409 //propertyPanelDefined(aOperation);
411 /// Commit sketcher operations automatically
412 anOperation->commit();
416 void PartSet_Module::onNoMoreWidgets()
418 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
419 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
421 if (myRestartingMode != RM_Forbided)
422 myRestartingMode = RM_LastFeatureUsed;
423 anOperation->commit();
428 void PartSet_Module::onVertexSelected()
430 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
431 if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) {
432 /// If last line finished on vertex the lines creation sequence has to be break
433 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
434 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
435 if (aWidgets.last() == aPanel->activeWidget()) {
436 myRestartingMode = RM_Forbided;
441 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
442 Config_WidgetAPI* theWidgetApi, std::string theParentId)
444 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
445 XGUI_Workshop* aWorkshop = aConnector->workshop();
446 ModuleBase_ModelWidget* aWgt = NULL;
447 if (theType == "sketch-start-label") {
448 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent, theWidgetApi, theParentId);
449 aLabelWgt->setWorkshop(aWorkshop);
450 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
451 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
453 } else if (theType == "sketch-2dpoint_selector") {
454 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, theWidgetApi, theParentId);
455 aPointWgt->setWorkshop(aWorkshop);
456 aPointWgt->setSketch(mySketchMgr->activeSketch());
457 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
459 } if (theType == "point2ddistance") {
460 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent, theWidgetApi, theParentId);
461 aDistanceWgt->setWorkshop(aWorkshop);
462 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
464 } if (theType == "sketch_shape_selector") {
465 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
466 new PartSet_WidgetShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
467 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
468 aWgt = aShapeSelectorWgt;
469 } if (theType == "sketch_constraint_shape_selector") {
470 PartSet_WidgetConstraintShapeSelector* aConstraintShapeSelectorWgt =
471 new PartSet_WidgetConstraintShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
472 aConstraintShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
473 aWgt = aConstraintShapeSelectorWgt;
478 void PartSet_Module::createActions()
482 anAction = new QAction(tr("Construction"), this);
483 anAction->setCheckable(true);
484 addAction("CONSTRUCTION_CMD", anAction);
487 QAction* PartSet_Module::action(const QString& theId) const
489 if (myActions.contains(theId))
490 return myActions[theId];
494 void PartSet_Module::addAction(const QString& theId, QAction* theAction)
496 if (myActions.contains(theId))
497 qCritical("A command with Id = '%s' already defined!", qPrintable(theId));
498 theAction->setData(theId);
499 connect(theAction, SIGNAL(triggered(bool)), this, SLOT(onAction(bool)));
500 myActions[theId] = theAction;
503 void PartSet_Module::onAction(bool isChecked)
505 QAction* aAction = static_cast<QAction*>(sender());
506 QString anId = aAction->data().toString();
508 if (anId == "CONSTRUCTION_CMD") {
509 mySketchMgr->setConstruction(isChecked);
513 bool PartSet_Module::deleteObjects()
515 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
516 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
517 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
518 if (!isSketchOp && !isNestedOp)
521 // sketch feature should be skipped, only sub-features can be removed
522 // when sketch operation is active
523 CompositeFeaturePtr aSketch = mySketchMgr->activeSketch();
525 // selected objects should be collected before the current operation abort because
526 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
527 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
528 XGUI_Workshop* aWorkshop = aConnector->workshop();
529 ModuleBase_ISelection* aSel = aConnector->selection();
530 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
532 // if there are no selected objects in the viewer, that means that the selection in another
533 // place cased this method. It is necessary to return the false value to understande in above
534 // method that delete is not processed
535 if (aSelectedObj.count() == 0)
539 anOperation->abort();
541 // the active nested sketch operation should be aborted unconditionally
542 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation))
543 anOperation->abort();
545 std::set<FeaturePtr> aRefFeatures;
546 foreach (ObjectPtr aObj, aSelectedObj)
548 //ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
550 // TODO: check for what there is this condition. It is placed here historicaly because
551 // ther is this condition during remove features.
553 FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
554 if (aFeature.get() != NULL) {
555 aObj->document()->refsToFeature(aFeature, aRefFeatures, false);
560 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
562 // according to #355 feature, it is not necessary to inform about dependencies during
563 // sketch delete operation
565 if (!aRefFeatures.empty()) {
566 QStringList aRefNames;
567 std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
568 aLast = aRefFeatures.end();
569 for (; anIt != aLast; anIt++) {
570 FeaturePtr aFeature = (*anIt);
571 if (aFeature == aSketch)
573 aRefNames.append((*anIt)->name().c_str());
575 if (!aRefNames.empty()) {
576 QString aNames = aRefNames.join(", ");
577 aDescription += aNames.prepend(" ");
579 QMainWindow* aDesktop = aWorkshop->desktop();
580 QMessageBox::StandardButton aRes = QMessageBox::warning(
581 aDesktop, tr("Delete features"),
582 QString(tr("Selected features are used in the following features: %1.\
583 These features will be deleted also. Would you like to continue?")).arg(aNames),
584 QMessageBox::No | QMessageBox::Yes, QMessageBox::No);
585 if (aRes != QMessageBox::Yes)
590 SessionPtr aMgr = ModelAPI_Session::get();
591 aMgr->startOperation(aDescription.toStdString());
592 std::set<FeaturePtr>::const_iterator anIt = aRefFeatures.begin(),
593 aLast = aRefFeatures.end();
594 for (; anIt != aLast; anIt++) {
595 FeaturePtr aRefFeature = (*anIt);
596 if (aRefFeature == aSketch)
598 aRefFeature->document()->removeFeature(aRefFeature);
601 foreach (ObjectPtr aObj, aSelectedObj)
603 DocumentPtr aDoc = aObj->document();
604 //ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
606 // if (aDoc == aMgr->activeDocument()) {
610 //FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
611 FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
612 if (aFeature.get() != NULL) {
613 aDoc->removeFeature(aFeature);
617 aWorkshop->displayer()->updateViewer();
618 //myDisplayer->updateViewer();
619 aMgr->finishOperation();