X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2Fex02_cube2primitive.py;h=9344c246214bf26d6f2de8a789d371cc980f916c;hp=9350199ebf17b1e1ce973d5ab095df5446b6ab8b;hb=499f29d24922cec66e41b41a0039a954993bc6df;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6 diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py index 9350199eb..9344c2462 100644 --- a/src/SMESH_SWIG/ex02_cube2primitive.py +++ b/src/SMESH_SWIG/ex02_cube2primitive.py @@ -1,5 +1,5 @@ # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -7,7 +7,7 @@ # 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 @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New() -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New() # Geometry # ======== @@ -44,33 +50,33 @@ arete = 10 # Points # ------ -blockPoint111 = MakeVertex(ox , oy, oz) -blockPoint211 = MakeVertex(ox+arete, oy, oz) -blockPoint112 = MakeVertex(ox , oy, oz+arete) -blockPoint212 = MakeVertex(ox+arete, oy, oz+arete) +blockPoint111 = geompy.MakeVertex(ox , oy, oz) +blockPoint211 = geompy.MakeVertex(ox+arete, oy, oz) +blockPoint112 = geompy.MakeVertex(ox , oy, oz+arete) +blockPoint212 = geompy.MakeVertex(ox+arete, oy, oz+arete) # Face and solid # -------------- -blockFace1 = MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112) +blockFace1 = geompy.MakeQuad4Vertices(blockPoint111, blockPoint211, blockPoint212, blockPoint112) -blockSolid11 = MakePrismVecH(blockFace1, MakeVectorDXDYDZ(0, 1, 0), arete) +blockSolid11 = geompy.MakePrismVecH(blockFace1, geompy.MakeVectorDXDYDZ(0, 1, 0), arete) # Translations # ------------ -blockSolid21 = MakeTranslation(blockSolid11, arete, 0, 0) -blockSolid31 = MakeTranslation(blockSolid21, arete, 0, 0) +blockSolid21 = geompy.MakeTranslation(blockSolid11, arete, 0, 0) +blockSolid31 = geompy.MakeTranslation(blockSolid21, arete, 0, 0) -blockSolid12 = MakeTranslation(blockSolid11, 0, 0, arete) -blockSolid22 = MakeTranslation(blockSolid12, arete, 0, 0) -blockSolid32 = MakeTranslation(blockSolid22, arete, 0, 0) +blockSolid12 = geompy.MakeTranslation(blockSolid11, 0, 0, arete) +blockSolid22 = geompy.MakeTranslation(blockSolid12, arete, 0, 0) +blockSolid32 = geompy.MakeTranslation(blockSolid22, arete, 0, 0) -blockSolid13 = MakeTranslation(blockSolid12, 0, 0, arete) -blockSolid23 = MakeTranslation(blockSolid13, arete, 0, 0) -blockSolid33 = MakeTranslation(blockSolid23, arete, 0, 0) +blockSolid13 = geompy.MakeTranslation(blockSolid12, 0, 0, arete) +blockSolid23 = geompy.MakeTranslation(blockSolid13, arete, 0, 0) +blockSolid33 = geompy.MakeTranslation(blockSolid23, arete, 0, 0) -blockSolid111 = MakeTranslation(blockSolid22, 0, arete, 0) +blockSolid111 = geompy.MakeTranslation(blockSolid22, 0, arete, 0) # Compound and glue # ----------------- @@ -87,20 +93,18 @@ c_l.append(blockSolid23) c_l.append(blockSolid33) c_l.append(blockSolid111) -c_cpd = MakeCompound(c_l) +c_cpd = geompy.MakeCompound(c_l) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex02_cube2primitive") +piece_id = geompy.addToStudy(piece, "ex02_cube2primitive") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- @@ -117,3 +121,8 @@ hexa.Hexahedron() # ---------------- hexa.Compute() + +# Update object browser +# --------------------- + +salome.sg.updateObjBrowser()