-# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+# Copyright (C) 2014-2022 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
import os
-def getTmpFileName(ext):
- import tempfile
- tempdir = tempfile.gettempdir()
- tmp_file = tempfile.NamedTemporaryFile(suffix=".%s"%ext, prefix='shaper_', dir=tempdir, delete=False)
- tmp_filename = tmp_file.name
- if os.name == "nt":
- tmp_filename.replace("\\", "/")
- return tmp_filename
-
## @ingroup Plugins
# Feature to export all shapes and groups into the GEOM module
class ExportFeature(ModelAPI.ModelAPI_Feature):
for aResIndex in range(self.Part.size(aResultType)):
anObject = self.Part.object(aResultType, aResIndex)
aResult = model.objectToResult(anObject)
+ # do not export picture
+ if aResult.hasTexture() is True:
+ continue
if not aResult is None:
if (not aResult.shape() or aResult.shape().isNull()) and isPart:
aPart = model.modelAPI_ResultPart(aResult)
if not aResult.shape() or aResult.shape().isNull():
continue
- tmpXAOFile = getTmpFileName("xao")
+ tmpXAOFile = model.getTmpFileName("shaper_", ".xao")
self.tmpXAOFile = tmpXAOFile
#print "Export to %s"%tmpXAOFile
exportXAO = ExchangeAPI.exportToXAO(self.Part, tmpXAOFile, model.selection(aResult), "automatic_shaper_export_to_XAO")