## Get summarized length of all wires,
# area of surface and volume of the given shape.
# @param theShape Shape to define properties of.
+ # @param theTolerance maximal relative error of area
+ # and volume computation.
# @return [theLength, theSurfArea, theVolume]\n
# theLength: Summarized length of all wires of the given shape.\n
# theSurfArea: Area of surface of the given shape.\n
#
# @ref tui_basic_properties_page "Example"
@ManageTransactions("MeasuOp")
- def BasicProperties(self,theShape):
+ def BasicProperties(self,theShape, theTolerance=1.e-6):
"""
Get summarized length of all wires,
area of surface and volume of the given shape.
Parameters:
theShape Shape to define properties of.
+ theTolerance maximal relative error of area
+ and volume computation.
Returns:
[theLength, theSurfArea, theVolume]
theVolume: Volume of the given shape.
"""
# Example: see GEOM_TestMeasures.py
- aTuple = self.MeasuOp.GetBasicProperties(theShape)
+ aTuple = self.MeasuOp.GetBasicProperties(theShape, theTolerance)
RaiseIfFailed("GetBasicProperties", self.MeasuOp)
return aTuple
RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp)
return IsValid
+ ## Check boolean and partition operations agruments.
+ # @param theShape the agrument of an operation to be checked
+ # @return TRUE if the agrument is valid for a boolean or partition
+ # operation; FALSE otherwise.
+ @ManageTransactions("MeasuOp")
+ def CheckBOPArguments(self, theShape):
+ """
+ Check boolean and partition operations agruments.
+
+ Parameters:
+ theShape the agrument of an operation to be checked
+
+ Returns:
+ TRUE if the agrument is valid for a boolean or partition
+ operation; FALSE otherwise.
+ """
+ return self.MeasuOp.CheckBOPArguments(theShape)
+
## Detect intersections of the given shapes with algorithm based on mesh intersections.
# @param theShape1 First source object
# @param theShape2 Second source object
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
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")