ok, sphere_xao, sub_shapes, groups, fields = geompy.ImportXAO(f_xao)
# import XAO data from memory buffer (bytes array)
-ok, sphere_xao, sub_shapes, groups, fields = geompy.ImportXAOMem(buff_xao)
+ok_mem, sphere_xao_mem, sub_shapes_mem, groups_mem, fields_mem = geompy.ImportXAOMem(buff_xao)
# clean up
for f in f_brep, f_iges, f_step, f_stl1, f_stl2, f_vtk1, f_vtk2, f_xao:
RaiseIfFailed("ExportXAO", anOp)
return res
-## Export a shape to XAO format
+## Export a shape to XAO format in byte array
# @param shape The shape to export
# @param groups The list of groups to export
# @param fields The list of fields to export
# @ingroup l2_import_export
def ExportXAOMem(self, shape, groups, fields, author):
"""
- Export a shape to XAO format
+ Export a shape to XAO format in byte array
Parameters:
shape The shape to export
"""
from salome.geom.geomBuilder import RaiseIfFailed
anOp = GetXAOPluginOperations(self)
- res = anOp.ImportXAO(fileName)
+ (res, shape, subShapes, groups, fields) = anOp.ImportXAO(fileName)
RaiseIfFailed("ImportXAO", anOp)
- self._autoPublish(res[1], theName, "imported")
- return res
+ if res:
+ # publish imported shape
+ self._autoPublish(shape, theName, "imported")
+ # publish imported sub shapes, groups and fields
+ if theName or self.myMaxNbSubShapesAllowed:
+ for ss in (subShapes + groups + fields):
+ self.addToStudyInFather(shape, ss, ss.GetName())
+ if isinstance( ss, GEOM._objref_GEOM_Field ):
+ listStepIDs = ss.GetSteps()
+ for stepID in listStepIDs:
+ step = ss.GetStep(stepID)
+ self.addToStudyInFather(ss, step, step.GetName())
+ pass
+ pass
+ pass
+ pass
+ pass
+ return (res, shape, subShapes, groups, fields)
## Import a shape from XAO format byte array
# @param byteArray byte array with XAO data
# @ingroup l2_import_export
def ImportXAOMem(self, byteArray, theName=None):
"""
- Import a shape from XAO format
+ Import a shape from XAO format byte array
Parameters:
byteArray byte array with XAO data
* \param groups The list of groups to export
* \param fields The list of fields to export
* \param author The author of the export
+ * \param toFile Export to file if true, otherwise export to memory buffer (the returned string)
* \param fileName The name of the exported file
* \param shapeFileName If not empty, save the BREP shape to this external file
- * \return boolean indicating if export was successful.
+ * \return string The exported buffer if toFile=false, otherwise an empty string
*/
//=============================================================================
std::string XAOPlugin_IOperations_i::exportXAO( GEOM::GEOM_Object_ptr shape,
//=============================================================================
/*!
- * Import a shape from XAO format
+ * Import a shape from XAO format memory buffer
* \param fileName The name of the file to import
* \param shape The imported shape
* \param subShapes The list of imported subShapes
//=============================================================================
/*!
* Import a shape from XAO format
- * \param fileName The name of the file to import
+ * \param isFile Boolean flag to switch between import from file or from buffer
+ * \param fileName The name of the file to import from if isFile=true
+ * \param theBuff The buffer to import from if isFile=false
* \param shape The imported shape
* \param subShapes The list of imported subShapes
* \param groups The list of imported groups