mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-12 10:47:27 +05:00
Fix Shaper #2198 ExportToGeom's shape stream not being dump by GEOM RestoreShape
This commit is contained in:
parent
7c7eefda24
commit
d1b51d722f
@ -231,18 +231,39 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream
|
|||||||
//Set function value
|
//Set function value
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
|
||||||
//Special dump to avoid restored shapes publication.
|
//Real dump if the stream comes from Shaper
|
||||||
//See correcponding code in GEOM_Engine.cxx (method ProcessFunction)
|
std::string firstLine;
|
||||||
//GEOM::TPythonDump(aFunction) << "#";
|
std::string shaperPrefix = "FromShaperExportToGeom;";
|
||||||
|
std::size_t shaperPrefixSize = shaperPrefix.size();
|
||||||
|
|
||||||
bool ignore = false;
|
//Go back to the start of the istringstream
|
||||||
|
theStream.seekg(0);
|
||||||
|
|
||||||
if ( const char* env_var = getenv( "GEOM_IGNORE_RESTORE_SHAPE" ) )
|
//Get first line
|
||||||
ignore = atoi( env_var ) > 1;
|
std::getline(theStream, firstLine);
|
||||||
|
MESSAGE("firstLine: " << firstLine);
|
||||||
|
|
||||||
if ( !ignore ) {
|
if (firstLine.substr(0, shaperPrefixSize) == shaperPrefix) {
|
||||||
GEOM::TPythonDump(aFunction) << result
|
//Special dump for shape stream coming from Shaper
|
||||||
<< " = geompy.RestoreShape(\"\") # the shape string has not been dump for performance reason";
|
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) << "#";
|
||||||
|
|
||||||
|
bool ignore = false;
|
||||||
|
|
||||||
|
if ( const char* env_var = getenv( "GEOM_IGNORE_RESTORE_SHAPE" ) )
|
||||||
|
ignore = atoi( env_var ) > 1;
|
||||||
|
|
||||||
|
if ( !ignore ) {
|
||||||
|
GEOM::TPythonDump(aFunction) << result
|
||||||
|
<< " = geompy.RestoreShape(\"\") # the shape string has not been dump for performance reason";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetErrorCode(OK);
|
SetErrorCode(OK);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user