Fix the wrong script generation if a group contains filters.
return fabs(anAttribute->value()) < 1.e-12;
}
+bool ModelHighAPI_Dumper::dumpCommentBeforeFeature(const FeaturePtr& theFeature) const
+{
+ // currently, the comment should not be dumped only before the filters
+ FiltersFeaturePtr aFilters = std::dynamic_pointer_cast<ModelAPI_FiltersFeature>(theFeature);
+ if (aFilters)
+ return false;
+ // all other features should be commented before the dump
+ return true;
+}
+
ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(const char theChar)
{
*myDumpStorage << theChar;
MODELHIGHAPI_EXPORT virtual void exportVariable(
const std::string& theEntry, const std::string& theVarName) const {}
+ /// Returns \c true if the special comment line to improve the readability
+ /// should be printed before the feature of the given kind.
+ MODELHIGHAPI_EXPORT bool dumpCommentBeforeFeature(const FeaturePtr& theFeature) const;
+
protected:
/// Dump "setName" command if last entity had user-defined name
MODELHIGHAPI_EXPORT void dumpEntitySetName();
if theForce or theFeature.isInHistory() or aFeatureKind=="Export" or aFeatureKind=="RemoveResults":
aDumper = self.myFeatures[aFeatureKind](theFeature)
# Dump comment for the operation before the dumping of the feature to improve the readability of a script.
- self.__print__("\n### Create " + theFeature.getKind())
- self.newline()
+ if self.dumpCommentBeforeFeature(theFeature):
+ self.__print__("\n### Create " + theFeature.getKind())
+ self.newline()
else:
self.name(theFeature)
self.clearNotDumped()