mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
Customize behavior of RestoreShape() function - to optionally suppress its dumping into Python script with DumpStudy functionality.
This commit is contained in:
parent
b014700d7c
commit
6bc36af9f0
@ -235,8 +235,15 @@ Handle(GEOM_Object) GEOMImpl_IInsertOperations::RestoreShape (std::istringstream
|
||||
//See correcponding code in GEOM_Engine.cxx (method ProcessFunction)
|
||||
//GEOM::TPythonDump(aFunction) << "#";
|
||||
|
||||
GEOM::TPythonDump(aFunction) << result
|
||||
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);
|
||||
|
||||
|
@ -11684,8 +11684,14 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
return self.ImportFile(theFileName, theFormatName, theName)
|
||||
|
||||
## Read a shape from the binary stream, containing its bounding representation (BRep).
|
||||
# @note This method will not be dumped to the python script by DumpStudy functionality.
|
||||
# @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
|
||||
#
|
||||
# @note As the byte-stream representing the shape data can be quite large, this method
|
||||
# is not automatically dumped to the Python script with the DumpStudy functionality;
|
||||
# so please use this method carefully, only for strong reasons.
|
||||
#
|
||||
# @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's
|
||||
# data stream.
|
||||
#
|
||||
# @param theStream The BRep binary stream.
|
||||
# @param theName Object name; when specified, this parameter is used
|
||||
# for result publication in the study. Otherwise, if automatic
|
||||
@ -11712,6 +11718,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM_Object, containing the shape, read from theStream.
|
||||
"""
|
||||
# Example: see GEOM_TestOthers.py
|
||||
if not theStream:
|
||||
# this is the workaround to ignore invalid case when data stream is empty
|
||||
if int(os.getenv("GEOM_IGNORE_RESTORE_SHAPE", "0")) > 0:
|
||||
print "WARNING: Result of RestoreShape is a NULL shape!"
|
||||
return None
|
||||
anObj = self.InsertOp.RestoreShape(theStream)
|
||||
RaiseIfFailed("RestoreShape", self.InsertOp)
|
||||
self._autoPublish(anObj, theName, "restored")
|
||||
|
Loading…
Reference in New Issue
Block a user