Fix Shaper #2198 ExportToGeom's shape stream not being dump by GEOM RestoreShape

This commit is contained in:
Christophe Bourcier 2017-07-11 14:11:06 +02:00
parent 7c7eefda24
commit d1b51d722f

View File

@ -231,6 +231,26 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream
//Set function value
aFunction->SetValue(aShape);
//Real dump if the stream comes from Shaper
std::string firstLine;
std::string shaperPrefix = "FromShaperExportToGeom;";
std::size_t shaperPrefixSize = shaperPrefix.size();
//Go back to the start of the istringstream
theStream.seekg(0);
//Get first line
std::getline(theStream, firstLine);
MESSAGE("firstLine: " << firstLine);
if (firstLine.substr(0, shaperPrefixSize) == shaperPrefix) {
//Special dump for shape stream coming from Shaper
std::string partName = firstLine.substr(shaperPrefixSize);
MESSAGE("Part from Shaper: " << partName);
GEOM::TPythonDump(aFunction) << result << " = geompy.RestoreShape(model.makeShape("
<< partName.c_str() << ".document()).getShapeStream())";
}
else {
//Special dump to avoid restored shapes publication.
//See correcponding code in GEOM_Engine.cxx (method ProcessFunction)
//GEOM::TPythonDump(aFunction) << "#";
@ -244,6 +264,7 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream
GEOM::TPythonDump(aFunction) << result
<< " = geompy.RestoreShape(\"\") # the shape string has not been dump for performance reason";
}
}
SetErrorCode(OK);