diff --git a/src/libs/ifc/xml/vtoolrecord.cpp b/src/libs/ifc/xml/vtoolrecord.cpp index 789198185..4741a432b 100644 --- a/src/libs/ifc/xml/vtoolrecord.cpp +++ b/src/libs/ifc/xml/vtoolrecord.cpp @@ -66,3 +66,15 @@ VToolRecord &VToolRecord::operator=(const VToolRecord &record) VToolRecord::VToolRecord(const VToolRecord &record) :id(record.getId()), typeTool(record.getTypeTool()), nameDraw(record.getNameDraw()) {} + +//--------------------------------------------------------------------------------------------------------------------- +bool VToolRecord::IsMandatory() const +{ + return typeTool != Tool::Pin + && typeTool != Tool::NodePoint + && typeTool != Tool::NodeArc + && typeTool != Tool::NodeElArc + && typeTool != Tool::NodeSpline + && typeTool != Tool::NodeSplinePath + && typeTool != Tool::PiecePath; +} diff --git a/src/libs/ifc/xml/vtoolrecord.h b/src/libs/ifc/xml/vtoolrecord.h index d9f623eb2..5a388d25a 100644 --- a/src/libs/ifc/xml/vtoolrecord.h +++ b/src/libs/ifc/xml/vtoolrecord.h @@ -56,6 +56,8 @@ public: QString getNameDraw() const; void setNameDraw(const QString &value); + bool IsMandatory() const; + private: /** @brief id tool id. */ quint32 id; diff --git a/src/libs/vformat/vpatternrecipe.cpp b/src/libs/vformat/vpatternrecipe.cpp index 6d1b768ab..57f86b31d 100644 --- a/src/libs/vformat/vpatternrecipe.cpp +++ b/src/libs/vformat/vpatternrecipe.cpp @@ -286,7 +286,7 @@ QDomElement VPatternRecipe::Step(const VToolRecord &tool) Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 55, "Not all tools were used in history."); const QDomElement domElem = m_pattern->elementById(tool.getId()); - if (not domElem.isElement()) + if (not domElem.isElement() && tool.IsMandatory()) { throw VExceptionInvalidHistory(tr("Can't find element by id '%1'").arg(tool.getId())); }