]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_WidgetSketchCreator.cpp
Salome HOME
Make Name of result the same as for feature
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchCreator.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include "PartSet_WidgetSketchCreator.h"
22 #include "PartSet_Module.h"
23 #include "PartSet_WidgetSketchLabel.h"
24 #include "PartSet_PreviewPlanes.h"
25
26 #include <Config_Keywords.h>
27
28 #include <XGUI_ModuleConnector.h>
29 #include <XGUI_Workshop.h>
30 #include <XGUI_Displayer.h>
31 #include <XGUI_SelectionMgr.h>
32 #include <XGUI_OperationMgr.h>
33 #include <XGUI_PropertyPanel.h>
34 #include <XGUI_Tools.h>
35 #include <XGUI_ViewerProxy.h>
36
37 #include <GeomAPI_Face.h>
38
39 #include <Events_InfoMessage.h>
40
41 #include <ModelAPI_Session.h>
42 #include <ModelAPI_ResultBody.h>
43 #include <ModelAPI_AttributeSelection.h>
44 #include <ModelAPI_AttributeSelectionList.h>
45 #include <ModelAPI_Validator.h>
46 #include <ModelAPI_Events.h>
47 #include <ModelAPI_ResultConstruction.h>
48
49 #include <SketchPlugin_SketchEntity.h>
50 #include <FeaturesPlugin_CompositeBoolean.h>
51
52 #include <ModuleBase_Tools.h>
53 #include <ModuleBase_Operation.h>
54 #include <ModuleBase_IPropertyPanel.h>
55 #include <ModuleBase_OperationFeature.h>
56 #include <ModuleBase_ViewerPrs.h>
57
58 #include <Config_WidgetAPI.h>
59
60 #include <Events_Loop.h>
61
62 #include <QLabel>
63 #include <QLineEdit>
64 #include <QDoubleValidator>
65 //#include <QFormLayout>
66 #include <QVBoxLayout>
67 #include <QMessageBox>
68 #include <QMainWindow>
69
70 #define DEBUG_UNDO_INVALID_SKETCH
71
72 PartSet_WidgetSketchCreator::PartSet_WidgetSketchCreator(QWidget* theParent,
73                                                          PartSet_Module* theModule,
74                                                          const Config_WidgetAPI* theData)
75 : ModuleBase_WidgetSelector(theParent, theModule->workshop(), theData),
76   myModule(theModule), myIsCustomAttribute(false)
77 {
78   myAttributeListID = theData->getProperty("attribute_list_id");
79
80   //QFormLayout* aLayout = new QFormLayout(this);
81   QVBoxLayout* aLayout = new QVBoxLayout(this);
82   ModuleBase_Tools::zeroMargins(aLayout);
83
84   ModuleBase_Tools::adjustMargins(aLayout);
85
86   QString aLabelText = QString::fromStdString(theData->widgetLabel());
87   QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
88
89   // Size of the View control
90   mySizeOfViewWidget = new QWidget(this);
91   QHBoxLayout* aSizeLayout = new QHBoxLayout(mySizeOfViewWidget);
92   aSizeLayout->addWidget(new QLabel("Size of the view", mySizeOfViewWidget));
93   mySizeOfView = new QLineEdit(mySizeOfViewWidget);
94
95   QDoubleValidator* aValidator = new QDoubleValidator(0, DBL_MAX, 12, mySizeOfView);
96   aValidator->setLocale(ModuleBase_Tools::doubleLocale());
97   aValidator->setNotation(QDoubleValidator::StandardNotation);
98   mySizeOfView->setValidator(aValidator);
99   aSizeLayout->addWidget(mySizeOfView);
100
101   myLabel = new QLabel(aLabelText, this);
102   myLabel->setWordWrap(true);
103
104   aLayout->addWidget(mySizeOfViewWidget);
105   aLayout->addWidget(myLabel);
106   aLayout->addStretch(1);
107
108   std::string aTypes = theData->getProperty("shape_types");
109   myShapeTypes = QString(aTypes.c_str()).split(' ', QString::SkipEmptyParts);
110
111   myPreviewPlanes = new PartSet_PreviewPlanes();
112 }
113
114 PartSet_WidgetSketchCreator::~PartSet_WidgetSketchCreator()
115 {
116   // we need to deactivate here in order to hide preview planes if the selection mode is
117   // active
118   deactivate();
119 }
120
121 QList<QWidget*> PartSet_WidgetSketchCreator::getControls() const
122 {
123   QList<QWidget*> aControls;
124   aControls.append(myLabel);
125   return aControls;
126 }
127
128 bool PartSet_WidgetSketchCreator::restoreValueCustom()
129 {
130   return true;
131 }
132
133 bool PartSet_WidgetSketchCreator::storeValueCustom()
134 {
135   return true;
136 }
137
138 AttributePtr PartSet_WidgetSketchCreator::attribute() const
139 {
140   AttributePtr anAttribute;
141   if (myIsCustomAttribute)
142     anAttribute = myFeature->attribute(myAttributeListID);
143   else
144     anAttribute = ModuleBase_WidgetSelector::attribute();
145
146   return anAttribute;
147 }
148
149 //********************************************************************
150 void PartSet_WidgetSketchCreator::openExtrusionTransaction()
151 {
152   SessionPtr aMgr = ModelAPI_Session::get();
153   bool aIsOp = aMgr->isOperation();
154   if (!aIsOp) {
155     const static std::string aNestedOpID("Parameters modification");
156     aMgr->startOperation(aNestedOpID, true);
157   }
158 }
159
160 //********************************************************************
161 bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue)
162 {
163   bool aValid = false;
164   if (myIsCustomAttribute) {
165     // check only suiting of the value to custom attribute (myAttributeListID)
166     // do not cash of validation to avoid using states, stored for XML attribute
167     // there is an alternative is to call clearValidatedCash() in setSelection()
168     aValid = isValidSelectionForAttribute(theValue, attribute());
169   }
170   else { /// if the validated attribute is already custom
171     if (getValidState(theValue, aValid)) {
172       return aValid;
173     }
174     aValid = isValidSelectionCustom(theValue);
175     if (!aValid)
176       // check selection to create new sketh (XML current attribute)
177       aValid = isValidSelectionForAttribute(theValue, attribute());
178     if (!aValid) {
179       // check selection to fill list attribute (myAttributeListID)
180       bool isCustomAttribute = myIsCustomAttribute;
181       myIsCustomAttribute = true;
182       aValid = isValidSelectionForAttribute(theValue, attribute());
183       myIsCustomAttribute = isCustomAttribute;
184     }
185   }
186   storeValidState(theValue, aValid);
187   return aValid;
188 }
189
190 //********************************************************************
191 bool PartSet_WidgetSketchCreator::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
192 {
193   return PartSet_WidgetSketchLabel::canFillSketch(theValue);
194 }
195
196 void PartSet_WidgetSketchCreator::activateSelectionControl()
197 {
198   // reset previously set size of view needed on restart extrusion after Sketch
199   if (myModule->sketchMgr()->previewSketchPlane()->isUseSizeOfView())
200     myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(0, false);
201
202   // we need to call activate here as the widget has no focus accepted controls
203   // if these controls are added here, activate will happens automatically after focusIn()
204   XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
205   XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
206   aPanel->activateWidget(this, false);
207 }
208
209 void PartSet_WidgetSketchCreator::setVisibleSelectionControl(const bool theSelectionControl)
210 {
211   // hide current widget, activate the next widget
212   XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
213   XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
214   const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
215   foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
216     if (theSelectionControl) { // hide other controls
217       if (aWidget != this)
218         aWidget->setVisible(false);
219     }
220     else { // hide current control
221       if (aWidget == this)
222         aWidget->setVisible(false);
223       else {
224         aWidget->setVisible(true);
225         if (aWidget->attributeID() == myAttributeListID)
226           setEnabledModelWidget(aWidget, !hasSubObjects());
227       }
228     }
229   }
230
231   if (theSelectionControl) {
232     bool aBodyIsVisualized = myPreviewPlanes->hasVisualizedBodies(myWorkshop);
233     bool aSketchIsVisualized = myPreviewPlanes->hasVisualizedSketch(myWorkshop);
234     if (!aBodyIsVisualized && !aSketchIsVisualized) {
235       // We have to select a plane before any operation
236       myPreviewPlanes->showPreviewPlanes(myWorkshop);
237       mySizeOfViewWidget->setVisible(true);
238     }
239     else {
240       mySizeOfViewWidget->setVisible(false);
241     }
242
243   } else {
244     bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
245     myPreviewPlanes->erasePreviewPlanes(myWorkshop);
246     if (aHidePreview)
247       aWorkshop->viewer()->update();
248   }
249 }
250
251 QIntList PartSet_WidgetSketchCreator::shapeTypes() const
252 {
253   QIntList aShapeTypes;
254   foreach(QString aType, myShapeTypes) {
255     aShapeTypes.append(ModuleBase_Tools::shapeType(aType));
256   }
257   return aShapeTypes;
258 }
259
260 void PartSet_WidgetSketchCreator::setEditingMode(bool isEditing)
261 {
262   ModuleBase_ModelWidget::setEditingMode(isEditing);
263   if (isEditing) {
264     setVisibleSelectionControl(false);
265
266     ModuleBase_ModelWidget* anAttributeListWidget = 0;
267     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
268     XGUI_PropertyPanel* aPanel = aWorkshop->propertyPanel();
269     const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
270     foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
271       if (aWidget->attributeID() == myAttributeListID) {
272         anAttributeListWidget = aWidget;
273         break;
274       }
275     }
276     if (anAttributeListWidget)
277       setEnabledModelWidget(anAttributeListWidget, !hasSubObjects());
278   }
279 }
280
281 bool PartSet_WidgetSketchCreator::isSelectionMode() const
282 {
283   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
284   bool aHasValueInList = anAttrList.get() && anAttrList->size() > 0;
285
286   return !aHasValueInList;
287 }
288
289 bool PartSet_WidgetSketchCreator::hasSubObjects() const
290 {
291   bool aHasSubObjects = false;
292
293   bool aCanSetFocus = true;
294   CompositeFeaturePtr aComposite = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
295   if (aComposite.get())
296     aHasSubObjects = aComposite->numberOfSubs() > 0;
297   return aHasSubObjects;
298 }
299
300 bool PartSet_WidgetSketchCreator::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
301                                                const bool theToValidate)
302 {
303   bool aDone = false;
304   if (!startSketchOperation(theValues)) {
305     myIsCustomAttribute = true;
306     QList<ModuleBase_ViewerPrsPtr>::const_iterator
307       anIt = theValues.begin(), aLast = theValues.end();
308     bool aProcessed = false;
309     for (; anIt != aLast; anIt++) {
310       ModuleBase_ViewerPrsPtr aValue = *anIt;
311       if (!theToValidate || isValidInFilters(aValue))
312         aProcessed = setSelectionCustom(aValue) || aProcessed;
313     }
314     myIsCustomAttribute = false;
315     aDone = aProcessed;
316     if (aProcessed) {
317       emit valuesChanged();
318       updateObject(myFeature);
319       setVisibleSelectionControl(false);
320       // manually deactivation because the widget was
321       // not activated as has no focus acceptin controls
322       deactivate();
323       emit focusOutWidget(this);
324     }
325   }
326   return aDone;
327 }
328
329 //********************************************************************
330 void PartSet_WidgetSketchCreator::onSelectionChanged()
331 {
332   QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
333   bool isDone = setSelection(aSelected, true/*false*/);
334 }
335
336 //********************************************************************
337 void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone)
338 {
339 }
340
341 bool PartSet_WidgetSketchCreator::startSketchOperation(
342                               const QList<ModuleBase_ViewerPrsPtr>& theValues)
343 {
344   bool aSketchStarted = false;
345
346   if (theValues.size() != 1)
347     return aSketchStarted;
348
349   ModuleBase_ViewerPrsPtr aValue = theValues.front();
350   if (!aValue.get() || !PartSet_WidgetSketchLabel::canFillSketch(aValue))
351     return aSketchStarted;
352
353   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aValue->object());
354   /// sketch should not started by object(face) selected as global. If Local face is selected,
355   /// sketch is started
356   if (aResult.get() && aValue->shape().get() && aResult->shape()->isEqual(aValue->shape())) {
357     ResultConstructionPtr aConstruction =
358       std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aResult);
359     if (!aConstruction.get() || !aConstruction->isInfinite())
360       return aSketchStarted;
361   }
362   aSketchStarted = true;
363   // Set View size if a plane is selected
364   if (myPreviewPlanes->isPreviewDisplayed() &&
365       myPreviewPlanes->isPreviewShape(aValue->shape())) {
366     // set default plane size
367     bool isSetSizeOfView = false;
368     double aSizeOfView = 0;
369     QString aSizeOfViewStr = mySizeOfView->text();
370     if (!aSizeOfViewStr.isEmpty()) {
371       aSizeOfView = aSizeOfViewStr.toDouble(&isSetSizeOfView);
372       if (isSetSizeOfView && aSizeOfView <= 0) {
373         isSetSizeOfView = false;
374       }
375     }
376     if (isSetSizeOfView)
377       myModule->sketchMgr()->previewSketchPlane()->setSizeOfView(aSizeOfView, true);
378   }
379   // manually deactivation because the widget was not activated as has no focus acceptin controls
380   deactivate();
381   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
382   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
383
384   // Launch Sketch operation
385   CompositeFeaturePtr aCompFeature =
386     std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
387
388   // start edit operation for the sketch
389   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
390                                                             (myModule->createOperation("Sketch"));
391   QList<ModuleBase_ViewerPrsPtr> aValues;
392   aValues.push_back(aValue);
393   aFOperation->setPreselection(aValues);
394
395   myWorkshop->processLaunchOperation(aFOperation);
396
397   return aSketchStarted;
398 }
399
400 bool PartSet_WidgetSketchCreator::focusTo()
401 {
402   // this method is called only in creation mode. In Edition mode this widget is hidden
403   if (isSelectionMode() && !hasSubObjects()) {
404     setVisibleSelectionControl(true);
405     activateSelectionControl();
406     openExtrusionTransaction();
407     return true;
408   }
409   else
410     connect(myModule, SIGNAL(resumed(ModuleBase_Operation*)),
411             SLOT(onResumed(ModuleBase_Operation*)));
412
413   return true;
414 }
415
416 void PartSet_WidgetSketchCreator::deactivate()
417 {
418   ModuleBase_WidgetSelector::deactivate();
419
420   bool aHidePreview = myPreviewPlanes->isPreviewDisplayed();
421   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
422   if (aHidePreview)
423     XGUI_Tools::workshop(myWorkshop)->viewer()->update();
424
425 }
426
427 void PartSet_WidgetSketchCreator::onResumed(ModuleBase_Operation* theOp)
428 {
429   SessionPtr aMgr = ModelAPI_Session::get();
430   bool aIsOp = aMgr->isOperation();
431   if (aIsOp) {
432     // in current implementation, all transactions are closed when resume happens
433     // so, this is a wrong case, which is not checked.
434     // To provide it, make correction in later rows about abort/undo transactions
435     return;
436   }
437   // Set visible only selection control
438   setVisibleSelectionControl(true);
439
440   // Validate the created sketch. If it is valid, it is set into the composite feature selection
441   // list, otherwise it is removed
442   CompositeFeaturePtr aCompFeature =
443     std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
444   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
445   if (aCompFeature->numberOfSubs() > 0) {
446     // set the sub feature to attribute selection list and check whether sketch is valid
447     SessionPtr aMgr = ModelAPI_Session::get();
448     const static std::string aNestedOpID("Set Sketch result into Selection list");
449     aMgr->startOperation(aNestedOpID, false); // false to not attach to Extrusion operation
450     setSketchObjectToList(aCompFeature, anAttrList);
451     aMgr->finishOperation();
452
453     if (!validateSelectionList()) {
454 #ifdef DEBUG_UNDO_INVALID_SKETCH
455       aMgr->undo(); // Extrusion modification parameters: setSketchObjectToList()
456       aMgr->undo(); /// Sketch creation
457 #else
458       aMgr->startOperation("Delete invalid Sketch feature", false);
459
460       // delete invalid sketch
461       CompositeFeaturePtr aSketchFeature =
462               std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
463       QObjectPtrList anObjects;
464       anObjects.append(aSketchFeature);
465
466       XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
467       aWorkshop->deleteFeatures(anObjects);
468
469       aMgr->finishOperation();
470 #endif
471     }
472   }
473   openExtrusionTransaction();
474
475   if (aCompFeature->numberOfSubs() == 0) {
476     // call activateWidget() of the parent to connect to the viewer seleciton
477     activateSelectionControl();
478   }
479   else {
480     // check if the created sketch is valid. If it is invalid, it will be deleted with warning else
481     /// the attribute selection list will be filled by result of this sketch.
482     setVisibleSelectionControl(false);
483
484     // Update value in attribute selection list
485     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
486     XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
487     const QList<ModuleBase_ModelWidget*>& aWidgets = aPropertyPanel->modelWidgets();
488     ModuleBase_ModelWidget* aListWidget = 0;
489     foreach(ModuleBase_ModelWidget* aWidget, aWidgets) {
490       if (aWidget->attributeID() == myAttributeListID) {
491         aListWidget = aWidget;
492         break;
493       }
494     }
495     if (aListWidget) {
496       aListWidget->restoreValue();
497       aPropertyPanel->activateNextWidget(aListWidget);
498     }
499
500     // Hide sketcher result
501     CompositeFeaturePtr aSketchFeature =
502       std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aCompFeature->subFeature(0));
503     std::list<ResultPtr> aResults = aSketchFeature->results();
504     std::list<ResultPtr>::const_iterator aIt;
505     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
506       (*aIt)->setDisplayed(false);
507     }
508     aSketchFeature->setDisplayed(false);
509     static Events_Loop* aLoop = Events_Loop::loop();
510     aLoop->flush(aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY));
511
512     // Add Selected body were created the sketcher to list of selected objects
513     std::string anObjectsAttribute = FeaturesPlugin_CompositeBoolean::OBJECTS_ID();
514     AttributeSelectionListPtr aSelList = aCompFeature->data()->selectionList(anObjectsAttribute);
515     if (aSelList.get()) {
516       DataPtr aData = aSketchFeature->data();
517       AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
518                                     (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
519       ResultPtr aRes = aSelAttr.get() ? aSelAttr->context() : ResultPtr();
520       if (aRes.get()) {
521         SessionPtr aMgr = ModelAPI_Session::get();
522         ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
523         AttributePtr anAttribute = myFeature->attribute(anObjectsAttribute);
524         std::string aValidatorID;
525         Events_InfoMessage anError;
526         aSelList->append(aRes, GeomShapePtr());
527         if (aFactory->validate(anAttribute, aValidatorID, anError))
528           updateObject(aCompFeature);
529         else
530           aSelList->clear();
531       }
532     }
533   }
534   restoreValue();
535 }
536
537 bool PartSet_WidgetSketchCreator::validateSelectionList() const
538 {
539   AttributeSelectionListPtr anAttrList = myFeature->data()->selectionList(myAttributeListID);
540
541   SessionPtr aMgr = ModelAPI_Session::get();
542   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
543   std::string aValidatorID;
544   Events_InfoMessage anError;
545   bool isValidPComposite = aFactory->validate(anAttrList, aValidatorID, anError);
546   if (!isValidPComposite) {
547     XGUI_Workshop* aWorkshop = XGUI_Tools::workshop(myModule->workshop());
548     // TODO(spo): translate
549     QMessageBox::question(aWorkshop->desktop(), tr("Apply current feature"),
550                   tr("Sketch is invalid and will be deleted.\nError: %1")
551                   .arg(anError.messageString().c_str()),
552                   QMessageBox::Ok);
553   }
554   return isValidPComposite;
555 }
556
557 void PartSet_WidgetSketchCreator::setSketchObjectToList(
558                             const CompositeFeaturePtr& theCompositeFeature,
559                             const AttributePtr& theAttribute)
560 {
561   if (!theCompositeFeature.get() || theCompositeFeature->numberOfSubs() != 1)
562     return;
563
564   AttributeSelectionListPtr aBaseObjectsSelectionList =
565                      std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
566   if(!aBaseObjectsSelectionList.get() || aBaseObjectsSelectionList->isInitialized()) {
567     return;
568   }
569
570   FeaturePtr aSketchFeature = theCompositeFeature->subFeature(0);
571   if(!aSketchFeature.get() || aSketchFeature->results().empty()) {
572     return;
573   }
574
575   ResultPtr aSketchRes = aSketchFeature->results().front();
576   ResultConstructionPtr aConstruction =
577     std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aSketchRes);
578   if(!aConstruction.get()) {
579     return;
580   }
581
582   if(aBaseObjectsSelectionList->size() == 0) {
583     aBaseObjectsSelectionList->append(aSketchRes, GeomShapePtr());
584   }
585 }
586
587 void PartSet_WidgetSketchCreator::setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget,
588                                                         const bool theEnabled)
589 {
590   QList<QWidget*> aMyControls = theModelWidget->getControls();
591   foreach(QWidget*  eachControl, aMyControls) {
592     eachControl->setEnabled(theEnabled);
593   }
594 }