data()->addAttribute(VARIABLE_ID(), ModelAPI_AttributeString::typeId());
data()->addAttribute(EXPRESSION_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(COMMENT_ID(), ModelAPI_AttributeString::typeId());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), COMMENT_ID());
+
data()->addAttribute(EXPRESSION_ERROR_ID(), ModelAPI_AttributeString::typeId());
data()->string(EXPRESSION_ERROR_ID())->setIsArgument(false);
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EXPRESSION_ERROR_ID());
{
if (theID == EXPRESSION_ID())
updateExpression();
+
+ data()->execState(ModelAPI_StateMustBeUpdated);
}
void ParametersPlugin_Parameter::updateName()
for ( ; it != anExprParams.end(); it++) {
std::string& aVariableName = *it;
- // parameter with the same name should be searched in the parent document
- // currently there is no way to get parent document, so we get PartSet doc
+ // Parameter with the same name should be searched in the parent document.
+ // For the PartSet assume that the parameter is absent.
+ // Currently there is no way to get parent document, so we get PartSet for all.
DocumentPtr aDocument = document();
- if (data()->name() == aVariableName)
+ if (data()->name() == aVariableName) {
+ if (aDocument == ModelAPI_Session::get()->moduleDocument())
+ continue;
aDocument = ModelAPI_Session::get()->moduleDocument();
+ }
double aValue;
ResultParameterPtr aParamRes;
- if (!ModelAPI_Tools::findVariable(aVariableName, aValue, aParamRes, aDocument)) continue;
+ if (!ModelAPI_Tools::findVariable(std::dynamic_pointer_cast<ModelAPI_Feature>(data()->owner()),
+ aVariableName, aValue, aParamRes, aDocument)) continue;
aParamsList.push_back(aParamRes);
std::ostringstream sstream;
sstream << aValue;
std::string aParamValue = sstream.str();
- aContext.push_back(*it + "=" + aParamValue);
+ size_t aPos = aParamValue.find(".");
+ std::string aPnt = "";
+ if (aPos == std::string::npos)
+ aPnt = ".";
+ aContext.push_back(*it + "=" + aParamValue + aPnt);
}
// compare the list of parameters to store if changed
AttributeRefListPtr aParams = reflist(ARGUMENTS_ID());
bool ParametersPlugin_Parameter::isPreviewNeeded() const
{
- return false;
+ return true;
}