X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fsmesh.py;h=d2ae49598cd6d0d2646acbc24dc741b6eb0d869d;hp=da30bd82a8e6ceeefa3834650ee8cf40f24210c9;hb=84cf6c491178cc4cea1be9c8b2ba4d13750d02a3;hpb=85f8b0f4495dc625b45b44c8c44c4969230d6065 diff --git a/src/SMESH_SWIG/smesh.py b/src/SMESH_SWIG/smesh.py index da30bd82a..d2ae49598 100644 --- a/src/SMESH_SWIG/smesh.py +++ b/src/SMESH_SWIG/smesh.py @@ -1,479 +1,122 @@ -# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-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. +# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS # -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. +# 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, or (at your option) any later version. # -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. # -# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + # File : smesh.py # Author : Francis KLOSS, OCC # Module : SMESH - -""" - \namespace smesh +# +"""@package smesh \brief Module smesh """ import salome -import geompy -import StdMeshers -import SMESH - -# Public variables -# ---------------- - -REGULAR = 1 -PYTHON = 2 - -NETGEN = 3 -GHS3D = 4 - -smesh = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH") -smesh.SetCurrentStudy(salome.myStudy) - -# Private functions -# ----------------- - -def GetName(obj): - ior = salome.orb.object_to_string(obj) - sobj = salome.myStudy.FindObjectIOR(ior) - attr = sobj.FindAttribute("AttributeName")[1] - return attr.Value() - -def SetName(obj, name): - ior = salome.orb.object_to_string(obj) - sobj = salome.myStudy.FindObjectIOR(ior) - attr = sobj.FindAttribute("AttributeName")[1] - attr.SetValue(name) - -# Algorithms and hypothesis -# ========================= - -# Private class: Mesh_Algorithm -# ----------------------------- - -class Mesh_Algorithm: - """ - Mother class to define algorithm, recommended to don't use directly - """ - - mesh = 0 - geom = 0 - subm = 0 - - def GetSubMesh(self): - """ - If the algorithm is global, return 0 - else return the submesh associated to this algorithm - """ - return self.subm - - def Create(self, mesh, geom, hypo, so="libStdMeshersEngine.so"): - """ - Private method - """ - self.mesh = mesh - piece = mesh.geom - if geom==0: - self.geom = piece - name = GetName(piece) - else: - self.geom = geom - name = geompy.SubShapeName(geom, piece) - geompy.addToStudyInFather(piece, geom, name) - self.subm = mesh.mesh.GetSubMesh(geom, hypo) - - algo = smesh.CreateHypothesis(hypo, so) - SetName(algo, name + "/" + hypo) - mesh.mesh.AddHypothesis(self.geom, algo) - - def Hypothesis(self, hyp, args=[], so="libStdMeshersEngine.so"): - """ - Private method - """ - hypo = smesh.CreateHypothesis(hyp, so) - a = "" - s = "=" - i = 0 - n = len(args) - while i algo=smeshBuilder.xxxx - def ExportDAT(self, f): - """ - Export the mesh in a file with the DAT format - \param f is the file name - """ - self.mesh.ExportDAT(f) +See also SMESH User's Guide for more details - def ExportUNV(self, f): - """ - Export the mesh in a file with the UNV format - \param f is the file name - """ - self.mesh.ExportUNV(f) +WARNING: +The smesh.py module works correctly only in the first created study. +It does not work in the second, third, etc studies! - def ExportSTL(self, f, ascii=1): - """ - Export the mesh in a file with the STL format - \param f is the file name - \param ascii defined the kind of file contents - """ - self.mesh.ExportSTL(f, ascii) +=============================================================================== +"""