X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSalomeApp%2Fpluginsdemo%2Ftubebuilder.py;h=cd231842ef4a8a4163573698260fcf07b4e8c300;hb=482b5567b678861418c3fbe7bef618f3c72299d9;hp=be8a01f8e79dfcda419e7931fd5aefa98607ed17;hpb=bb8609caf7881d966fbb88dec0a7822736da93f5;p=modules%2Fgui.git diff --git a/src/SalomeApp/pluginsdemo/tubebuilder.py b/src/SalomeApp/pluginsdemo/tubebuilder.py index be8a01f8e..cd231842e 100644 --- a/src/SalomeApp/pluginsdemo/tubebuilder.py +++ b/src/SalomeApp/pluginsdemo/tubebuilder.py @@ -1,10 +1,10 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2010-2013 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either -# version 2.1 of the License. +# version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,7 +32,7 @@ def createGeometry(study, radius=DEFAULT_RADIUS, length=DEFAULT_LENGTH, width=DE This function creates the geometry on the specified study and with given parameters. ''' - print "TUBE: creating the geometry ..." + print("TUBE: creating the geometry ...") studyId = study._get_StudyId() geompy = geomtools.getGeompy(studyId) @@ -56,7 +56,7 @@ def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LEN studyId = study._get_StudyId() geompy = geomtools.getGeompy(studyId) - print "TUBE: creating a partition ..." + print("TUBE: creating a partition ...") toolPlane = geompy.MakeFaceHW(2.1*length,2.1*radius,3) partition = geompy.MakePartition([shape], [toolPlane], [], [], geompy.ShapeType["SOLID"], 0, [], 0) entry = geompy.addToStudy( partition, "TubeWithPartition" ) @@ -64,10 +64,11 @@ def createGeometryWithPartition(study, radius=DEFAULT_RADIUS, length=DEFAULT_LEN def createMesh(study, shape): '''This function creates the mesh of the specified shape on the specified study''' - print "TUBE: creating the mesh ..." - import smesh + print("TUBE: creating the mesh ...") + import SMESH + from salome.smesh import smeshBuilder + smesh = smeshBuilder.New(study) - smesh.SetCurrentStudy(study) mesh = smesh.Mesh(shape) Regular_1D = mesh.Segment() Nb_Segments = Regular_1D.NumberOfSegments(10) @@ -83,7 +84,7 @@ def createMesh(study, shape): smesh.SetName(Nb_Segments, 'Nb. Segments_1') smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D') smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D') - salome.sg.updateObjBrowser(0) + salome.sg.updateObjBrowser(False) return mesh @@ -103,7 +104,7 @@ def exportModel(mesh, filename): ''' This exports the mesh to the specified filename in the med format ''' - print "TUBE: exporting mesh to file %s ..."%filename + print("TUBE: exporting mesh to file %s ..."%filename) import SMESH mesh.ExportMED(filename, 0, SMESH.MED_V2_2, 1 )