Salome HOME
0022616: [CEA 1038] Improve the quality of stl and vtk exports
[modules/geom.git] / src / GEOM_SWIG / XAOPluginBuilder.py
1 #  -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 from GEOM import IXAOOperations
22
23 # Engine Library Name
24 __libraryName__ = "XAOPluginEngine"
25
26 def GetXAOPluginOperations(self):
27     anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
28     return anOp._narrow(IXAOOperations)
29
30 ## Export a shape to XAO format
31 #  @param shape The shape to export
32 #  @param groups The list of groups to export
33 #  @param fields The list of fields to export
34 #  @param author The author of the export
35 #  @param fileName The name of the file to export
36 #  @return boolean
37 #
38 #  @ingroup l2_import_export
39 def ExportXAO(self, shape, groups, fields, author, fileName):
40     from salome.geom.geomBuilder import RaiseIfFailed
41     anOp = GetXAOPluginOperations(self)
42     res = anOp.ExportXAO(shape, groups, fields, author, fileName)
43     RaiseIfFailed("ExportXAO", anOp)
44     return res
45
46 ## Import a shape from XAO format
47 #  @param fileName The name of the file to import
48 #  @return tuple (res, shape, subShapes, groups, fields)
49 #       res Flag indicating if the import was successful
50 #       shape The imported shape
51 #       subShapes The list of imported subShapes
52 #       groups The list of imported groups
53 #       fields The list of imported fields
54 #
55 #  @ingroup l2_import_export
56 def ImportXAO(self, fileName):
57     from salome.geom.geomBuilder import RaiseIfFailed
58     anOp = GetXAOPluginOperations(self)
59     res = anOp.ImportXAO(fileName)
60     RaiseIfFailed("ImportXAO", anOp)
61     return res