X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FMeshCut%2Fmeshcut_plugin.py;h=018c6bf8a2bd85cf59e1ee2dd046bb92800dc578;hb=21b39b999745333dff21ad9b309270722f59a36d;hp=c5abe768acb477e58d2a1bd835d11b71f7347623;hpb=0b191577fc9ae12c2f265a4507e4dab72e385162;p=modules%2Fsmesh.git diff --git a/src/Tools/MeshCut/meshcut_plugin.py b/src/Tools/MeshCut/meshcut_plugin.py index c5abe768a..018c6bf8a 100644 --- a/src/Tools/MeshCut/meshcut_plugin.py +++ b/src/Tools/MeshCut/meshcut_plugin.py @@ -1,4 +1,4 @@ -# Copyright (C) 2006-2016 EDF R&D +# Copyright (C) 2006-2021 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 @@ -20,10 +20,11 @@ # if you already have plugins defined in a salome_plugins.py file, add this file at the end. # if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py +import sys + def MeshCut(context): - # get context study, studyId, salomeGui + # get context study, salomeGui study = context.study - studyId = context.studyId sg = context.sg import os @@ -50,9 +51,9 @@ def MeshCut(context): if fd.exec_(): infile = fd.selectedFiles()[0] self.ui.le_origMeshFile.setText(infile) - insplit = os.path.splitext(unicode(infile).encode()) - outfile = insplit[0] + '_cut' + insplit[1] - self.ui.le_cutMeshFile.setText(outfile) + insplit = os.path.splitext(str(infile).encode()) + outfile = insplit[0] + '_cut'.encode() + insplit[1] + self.ui.le_cutMeshFile.setText(outfile.decode()) pass def setOutputFile(self): @@ -97,11 +98,18 @@ and T the tolerance. if result: # dialog accepted args = ['MeshCut'] - args += [unicode(window.ui.le_origMeshFile.text()).encode()] - args += [unicode(window.ui.le_cutMeshFile.text()).encode()] - args += [unicode(window.ui.le_outMeshName.text()).encode()] - args += [unicode(window.ui.le_groupAbove.text()).encode()] - args += [unicode(window.ui.le_groupBelow.text()).encode()] + if sys.platform == "win32": + args += [str(window.ui.le_origMeshFile.text())] + args += [str(window.ui.le_cutMeshFile.text())] + args += [str(window.ui.le_outMeshName.text())] + args += [str(window.ui.le_groupAbove.text())] + args += [str(window.ui.le_groupBelow.text())] + else: + args += [str(window.ui.le_origMeshFile.text()).encode()] + args += [str(window.ui.le_cutMeshFile.text()).encode()] + args += [str(window.ui.le_outMeshName.text()).encode()] + args += [str(window.ui.le_groupAbove.text()).encode()] + args += [str(window.ui.le_groupBelow.text()).encode()] args += [str(window.ui.dsb_normX.value())] args += [str(window.ui.dsb_normY.value())] args += [str(window.ui.dsb_normZ.value())]