+bool PartSet_SketcherMgr::sketchSolverError()
+{
+ bool anError = false;
+ CompositeFeaturePtr aSketch = activeSketch();
+ if (aSketch.get()) {
+ AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
+ anError = !aAttributeString->value().empty();
+ }
+ return anError;
+}
+
+QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
+{
+ QString anError = "";
+ if (!theFeature.get() || !theFeature->data()->isValid())
+ return anError;
+
+ CompositeFeaturePtr aSketch = activeSketch();
+ if (aSketch.get() && aSketch == theFeature) {
+ AttributeStringPtr aAttributeString = aSketch->string(SketchPlugin_Sketch::SOLVER_ERROR());
+ anError = aAttributeString->value().c_str();
+ }
+ else if (myIsResetCurrentValue) { // this flag do not allow commit of the current operation
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
+ (getCurrentOperation());
+ if (aFOperation) {
+ FeaturePtr aFeature = aFOperation->feature();
+ if (aFeature.get() && aFeature == theFeature && isNestedCreateOperation(aFOperation)) {
+ QString anAttributeName = "";
+ ModuleBase_IPropertyPanel* aPanel = aFOperation->propertyPanel();
+ ModuleBase_ModelWidget* anActiveWgt = aPanel->activeWidget();
+ if (anActiveWgt) {
+ AttributePtr anAttr = aFeature->attribute(anActiveWgt->attributeID());
+ if (anAttr.get())
+ anAttributeName = anAttr->id().c_str();
+ }
+ anError = "Attribute \"" + anAttributeName + "\" is not initialized.";
+ }
+ }
+ }
+ return anError;
+}