From: prascle Date: Thu, 14 Mar 2013 13:16:09 +0000 (+0000) Subject: PR: examples adaptation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2e7bfd1664a24af500518e251d7ff805eae36f86;p=modules%2Fsmesh.git PR: examples adaptation --- diff --git a/src/SMESH_SWIG/ex01_cube2build.py b/src/SMESH_SWIG/ex01_cube2build.py index 10ba3f33a..78ad17e8b 100644 --- a/src/SMESH_SWIG/ex01_cube2build.py +++ b/src/SMESH_SWIG/ex01_cube2build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -35,233 +41,233 @@ import smesh # Points # ------ -greatPoint111 = MakeVertex( 0, 0, 0) -greatPoint211 = MakeVertex(10, 0, 0) -greatPoint311 = MakeVertex(20, 0, 0) -greatPoint411 = MakeVertex(30, 0, 0) +greatPoint111 = geompy.MakeVertex( 0, 0, 0) +greatPoint211 = geompy.MakeVertex(10, 0, 0) +greatPoint311 = geompy.MakeVertex(20, 0, 0) +greatPoint411 = geompy.MakeVertex(30, 0, 0) -greatPoint121 = MakeVertex( 0, 10, 0) -greatPoint221 = MakeVertex(10, 10, 0) -greatPoint321 = MakeVertex(20, 10, 0) -greatPoint421 = MakeVertex(30, 10, 0) +greatPoint121 = geompy.MakeVertex( 0, 10, 0) +greatPoint221 = geompy.MakeVertex(10, 10, 0) +greatPoint321 = geompy.MakeVertex(20, 10, 0) +greatPoint421 = geompy.MakeVertex(30, 10, 0) -greatPoint112 = MakeVertex( 0, 0, 10) -greatPoint212 = MakeVertex(10, 0, 10) -greatPoint312 = MakeVertex(20, 0, 10) -greatPoint412 = MakeVertex(30, 0, 10) +greatPoint112 = geompy.MakeVertex( 0, 0, 10) +greatPoint212 = geompy.MakeVertex(10, 0, 10) +greatPoint312 = geompy.MakeVertex(20, 0, 10) +greatPoint412 = geompy.MakeVertex(30, 0, 10) -greatPoint122 = MakeVertex( 0, 10, 10) -greatPoint222 = MakeVertex(10, 10, 10) -greatPoint322 = MakeVertex(20, 10, 10) -greatPoint422 = MakeVertex(30, 10, 10) +greatPoint122 = geompy.MakeVertex( 0, 10, 10) +greatPoint222 = geompy.MakeVertex(10, 10, 10) +greatPoint322 = geompy.MakeVertex(20, 10, 10) +greatPoint422 = geompy.MakeVertex(30, 10, 10) -greatPoint113 = MakeVertex( 0, 0, 20) -greatPoint213 = MakeVertex(10, 0, 20) -greatPoint313 = MakeVertex(20, 0, 20) -greatPoint413 = MakeVertex(30, 0, 20) +greatPoint113 = geompy.MakeVertex( 0, 0, 20) +greatPoint213 = geompy.MakeVertex(10, 0, 20) +greatPoint313 = geompy.MakeVertex(20, 0, 20) +greatPoint413 = geompy.MakeVertex(30, 0, 20) -greatPoint123 = MakeVertex( 0, 10, 20) -greatPoint223 = MakeVertex(10, 10, 20) -greatPoint323 = MakeVertex(20, 10, 20) -greatPoint423 = MakeVertex(30, 10, 20) +greatPoint123 = geompy.MakeVertex( 0, 10, 20) +greatPoint223 = geompy.MakeVertex(10, 10, 20) +greatPoint323 = geompy.MakeVertex(20, 10, 20) +greatPoint423 = geompy.MakeVertex(30, 10, 20) -greatPoint114 = MakeVertex( 0, 0, 30) -greatPoint214 = MakeVertex(10, 0, 30) -greatPoint314 = MakeVertex(20, 0, 30) -greatPoint414 = MakeVertex(30, 0, 30) +greatPoint114 = geompy.MakeVertex( 0, 0, 30) +greatPoint214 = geompy.MakeVertex(10, 0, 30) +greatPoint314 = geompy.MakeVertex(20, 0, 30) +greatPoint414 = geompy.MakeVertex(30, 0, 30) -greatPoint124 = MakeVertex( 0, 10, 30) -greatPoint224 = MakeVertex(10, 10, 30) -greatPoint324 = MakeVertex(20, 10, 30) -greatPoint424 = MakeVertex(30, 10, 30) +greatPoint124 = geompy.MakeVertex( 0, 10, 30) +greatPoint224 = geompy.MakeVertex(10, 10, 30) +greatPoint324 = geompy.MakeVertex(20, 10, 30) +greatPoint424 = geompy.MakeVertex(30, 10, 30) smallPoint111 = greatPoint222 smallPoint211 = greatPoint322 -smallPoint121 = MakeVertex(10, 20, 10) -smallPoint221 = MakeVertex(20, 20, 10) +smallPoint121 = geompy.MakeVertex(10, 20, 10) +smallPoint221 = geompy.MakeVertex(20, 20, 10) smallPoint112 = greatPoint223 smallPoint212 = greatPoint323 -smallPoint122 = MakeVertex(10, 20, 20) -smallPoint222 = MakeVertex(20, 20, 20) +smallPoint122 = geompy.MakeVertex(10, 20, 20) +smallPoint222 = geompy.MakeVertex(20, 20, 20) # Edges # ----- -smallEdgeX11 = MakeEdge(smallPoint111, smallPoint211) -smallEdgeX21 = MakeEdge(smallPoint121, smallPoint221) -smallEdgeX12 = MakeEdge(smallPoint112, smallPoint212) -smallEdgeX22 = MakeEdge(smallPoint122, smallPoint222) - -smallEdgeY11 = MakeEdge(smallPoint111, smallPoint121) -smallEdgeY21 = MakeEdge(smallPoint211, smallPoint221) -smallEdgeY12 = MakeEdge(smallPoint112, smallPoint122) -smallEdgeY22 = MakeEdge(smallPoint212, smallPoint222) - -smallEdgeZ11 = MakeEdge(smallPoint111, smallPoint112) -smallEdgeZ21 = MakeEdge(smallPoint211, smallPoint212) -smallEdgeZ12 = MakeEdge(smallPoint121, smallPoint122) -smallEdgeZ22 = MakeEdge(smallPoint221, smallPoint222) - - -greatEdgeX111 = MakeEdge(greatPoint111, greatPoint211) -greatEdgeX211 = MakeEdge(greatPoint211, greatPoint311) -greatEdgeX311 = MakeEdge(greatPoint311, greatPoint411) -greatEdgeX121 = MakeEdge(greatPoint121, greatPoint221) -greatEdgeX221 = MakeEdge(greatPoint221, greatPoint321) -greatEdgeX321 = MakeEdge(greatPoint321, greatPoint421) - -greatEdgeX112 = MakeEdge(greatPoint112, greatPoint212) -greatEdgeX212 = MakeEdge(greatPoint212, greatPoint312) -greatEdgeX312 = MakeEdge(greatPoint312, greatPoint412) -greatEdgeX122 = MakeEdge(greatPoint122, greatPoint222) +smallEdgeX11 = geompy.MakeEdge(smallPoint111, smallPoint211) +smallEdgeX21 = geompy.MakeEdge(smallPoint121, smallPoint221) +smallEdgeX12 = geompy.MakeEdge(smallPoint112, smallPoint212) +smallEdgeX22 = geompy.MakeEdge(smallPoint122, smallPoint222) + +smallEdgeY11 = geompy.MakeEdge(smallPoint111, smallPoint121) +smallEdgeY21 = geompy.MakeEdge(smallPoint211, smallPoint221) +smallEdgeY12 = geompy.MakeEdge(smallPoint112, smallPoint122) +smallEdgeY22 = geompy.MakeEdge(smallPoint212, smallPoint222) + +smallEdgeZ11 = geompy.MakeEdge(smallPoint111, smallPoint112) +smallEdgeZ21 = geompy.MakeEdge(smallPoint211, smallPoint212) +smallEdgeZ12 = geompy.MakeEdge(smallPoint121, smallPoint122) +smallEdgeZ22 = geompy.MakeEdge(smallPoint221, smallPoint222) + + +greatEdgeX111 = geompy.MakeEdge(greatPoint111, greatPoint211) +greatEdgeX211 = geompy.MakeEdge(greatPoint211, greatPoint311) +greatEdgeX311 = geompy.MakeEdge(greatPoint311, greatPoint411) +greatEdgeX121 = geompy.MakeEdge(greatPoint121, greatPoint221) +greatEdgeX221 = geompy.MakeEdge(greatPoint221, greatPoint321) +greatEdgeX321 = geompy.MakeEdge(greatPoint321, greatPoint421) + +greatEdgeX112 = geompy.MakeEdge(greatPoint112, greatPoint212) +greatEdgeX212 = geompy.MakeEdge(greatPoint212, greatPoint312) +greatEdgeX312 = geompy.MakeEdge(greatPoint312, greatPoint412) +greatEdgeX122 = geompy.MakeEdge(greatPoint122, greatPoint222) greatEdgeX222 = smallEdgeX11 -greatEdgeX322 = MakeEdge(greatPoint322, greatPoint422) +greatEdgeX322 = geompy.MakeEdge(greatPoint322, greatPoint422) -greatEdgeX113 = MakeEdge(greatPoint113, greatPoint213) -greatEdgeX213 = MakeEdge(greatPoint213, greatPoint313) -greatEdgeX313 = MakeEdge(greatPoint313, greatPoint413) -greatEdgeX123 = MakeEdge(greatPoint123, greatPoint223) +greatEdgeX113 = geompy.MakeEdge(greatPoint113, greatPoint213) +greatEdgeX213 = geompy.MakeEdge(greatPoint213, greatPoint313) +greatEdgeX313 = geompy.MakeEdge(greatPoint313, greatPoint413) +greatEdgeX123 = geompy.MakeEdge(greatPoint123, greatPoint223) greatEdgeX223 = smallEdgeX12 -greatEdgeX323 = MakeEdge(greatPoint323, greatPoint423) - -greatEdgeX114 = MakeEdge(greatPoint114, greatPoint214) -greatEdgeX214 = MakeEdge(greatPoint214, greatPoint314) -greatEdgeX314 = MakeEdge(greatPoint314, greatPoint414) -greatEdgeX124 = MakeEdge(greatPoint124, greatPoint224) -greatEdgeX224 = MakeEdge(greatPoint224, greatPoint324) -greatEdgeX324 = MakeEdge(greatPoint324, greatPoint424) - -greatEdgeY11 = MakeEdge(greatPoint111, greatPoint121) -greatEdgeY21 = MakeEdge(greatPoint211, greatPoint221) -greatEdgeY31 = MakeEdge(greatPoint311, greatPoint321) -greatEdgeY41 = MakeEdge(greatPoint411, greatPoint421) - -greatEdgeY12 = MakeEdge(greatPoint112, greatPoint122) -greatEdgeY22 = MakeEdge(greatPoint212, greatPoint222) -greatEdgeY32 = MakeEdge(greatPoint312, greatPoint322) -greatEdgeY42 = MakeEdge(greatPoint412, greatPoint422) - -greatEdgeY13 = MakeEdge(greatPoint113, greatPoint123) -greatEdgeY23 = MakeEdge(greatPoint213, greatPoint223) -greatEdgeY33 = MakeEdge(greatPoint313, greatPoint323) -greatEdgeY43 = MakeEdge(greatPoint413, greatPoint423) - -greatEdgeY14 = MakeEdge(greatPoint114, greatPoint124) -greatEdgeY24 = MakeEdge(greatPoint214, greatPoint224) -greatEdgeY34 = MakeEdge(greatPoint314, greatPoint324) -greatEdgeY44 = MakeEdge(greatPoint414, greatPoint424) - -greatEdgeZ111 = MakeEdge(greatPoint111, greatPoint112) -greatEdgeZ211 = MakeEdge(greatPoint211, greatPoint212) -greatEdgeZ311 = MakeEdge(greatPoint311, greatPoint312) -greatEdgeZ411 = MakeEdge(greatPoint411, greatPoint412) - -greatEdgeZ121 = MakeEdge(greatPoint121, greatPoint122) -greatEdgeZ221 = MakeEdge(greatPoint221, greatPoint222) -greatEdgeZ321 = MakeEdge(greatPoint321, greatPoint322) -greatEdgeZ421 = MakeEdge(greatPoint421, greatPoint422) - -greatEdgeZ112 = MakeEdge(greatPoint112, greatPoint113) -greatEdgeZ212 = MakeEdge(greatPoint212, greatPoint213) -greatEdgeZ312 = MakeEdge(greatPoint312, greatPoint313) -greatEdgeZ412 = MakeEdge(greatPoint412, greatPoint413) - -greatEdgeZ122 = MakeEdge(greatPoint122, greatPoint123) +greatEdgeX323 = geompy.MakeEdge(greatPoint323, greatPoint423) + +greatEdgeX114 = geompy.MakeEdge(greatPoint114, greatPoint214) +greatEdgeX214 = geompy.MakeEdge(greatPoint214, greatPoint314) +greatEdgeX314 = geompy.MakeEdge(greatPoint314, greatPoint414) +greatEdgeX124 = geompy.MakeEdge(greatPoint124, greatPoint224) +greatEdgeX224 = geompy.MakeEdge(greatPoint224, greatPoint324) +greatEdgeX324 = geompy.MakeEdge(greatPoint324, greatPoint424) + +greatEdgeY11 = geompy.MakeEdge(greatPoint111, greatPoint121) +greatEdgeY21 = geompy.MakeEdge(greatPoint211, greatPoint221) +greatEdgeY31 = geompy.MakeEdge(greatPoint311, greatPoint321) +greatEdgeY41 = geompy.MakeEdge(greatPoint411, greatPoint421) + +greatEdgeY12 = geompy.MakeEdge(greatPoint112, greatPoint122) +greatEdgeY22 = geompy.MakeEdge(greatPoint212, greatPoint222) +greatEdgeY32 = geompy.MakeEdge(greatPoint312, greatPoint322) +greatEdgeY42 = geompy.MakeEdge(greatPoint412, greatPoint422) + +greatEdgeY13 = geompy.MakeEdge(greatPoint113, greatPoint123) +greatEdgeY23 = geompy.MakeEdge(greatPoint213, greatPoint223) +greatEdgeY33 = geompy.MakeEdge(greatPoint313, greatPoint323) +greatEdgeY43 = geompy.MakeEdge(greatPoint413, greatPoint423) + +greatEdgeY14 = geompy.MakeEdge(greatPoint114, greatPoint124) +greatEdgeY24 = geompy.MakeEdge(greatPoint214, greatPoint224) +greatEdgeY34 = geompy.MakeEdge(greatPoint314, greatPoint324) +greatEdgeY44 = geompy.MakeEdge(greatPoint414, greatPoint424) + +greatEdgeZ111 = geompy.MakeEdge(greatPoint111, greatPoint112) +greatEdgeZ211 = geompy.MakeEdge(greatPoint211, greatPoint212) +greatEdgeZ311 = geompy.MakeEdge(greatPoint311, greatPoint312) +greatEdgeZ411 = geompy.MakeEdge(greatPoint411, greatPoint412) + +greatEdgeZ121 = geompy.MakeEdge(greatPoint121, greatPoint122) +greatEdgeZ221 = geompy.MakeEdge(greatPoint221, greatPoint222) +greatEdgeZ321 = geompy.MakeEdge(greatPoint321, greatPoint322) +greatEdgeZ421 = geompy.MakeEdge(greatPoint421, greatPoint422) + +greatEdgeZ112 = geompy.MakeEdge(greatPoint112, greatPoint113) +greatEdgeZ212 = geompy.MakeEdge(greatPoint212, greatPoint213) +greatEdgeZ312 = geompy.MakeEdge(greatPoint312, greatPoint313) +greatEdgeZ412 = geompy.MakeEdge(greatPoint412, greatPoint413) + +greatEdgeZ122 = geompy.MakeEdge(greatPoint122, greatPoint123) greatEdgeZ222 = smallEdgeZ11 greatEdgeZ322 = smallEdgeZ21 -greatEdgeZ422 = MakeEdge(greatPoint422, greatPoint423) +greatEdgeZ422 = geompy.MakeEdge(greatPoint422, greatPoint423) -greatEdgeZ113 = MakeEdge(greatPoint113, greatPoint114) -greatEdgeZ213 = MakeEdge(greatPoint213, greatPoint214) -greatEdgeZ313 = MakeEdge(greatPoint313, greatPoint314) -greatEdgeZ413 = MakeEdge(greatPoint413, greatPoint414) +greatEdgeZ113 = geompy.MakeEdge(greatPoint113, greatPoint114) +greatEdgeZ213 = geompy.MakeEdge(greatPoint213, greatPoint214) +greatEdgeZ313 = geompy.MakeEdge(greatPoint313, greatPoint314) +greatEdgeZ413 = geompy.MakeEdge(greatPoint413, greatPoint414) -greatEdgeZ123 = MakeEdge(greatPoint123, greatPoint124) -greatEdgeZ223 = MakeEdge(greatPoint223, greatPoint224) -greatEdgeZ323 = MakeEdge(greatPoint323, greatPoint324) -greatEdgeZ423 = MakeEdge(greatPoint423, greatPoint424) +greatEdgeZ123 = geompy.MakeEdge(greatPoint123, greatPoint124) +greatEdgeZ223 = geompy.MakeEdge(greatPoint223, greatPoint224) +greatEdgeZ323 = geompy.MakeEdge(greatPoint323, greatPoint324) +greatEdgeZ423 = geompy.MakeEdge(greatPoint423, greatPoint424) # Faces # ----- -smallFaceX1 = MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12) -smallFaceX2 = MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22) -smallFaceY1 = MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21) -smallFaceY2 = MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22) -smallFaceZ1 = MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21) -smallFaceZ2 = MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22) - - -greatFaceX11 = MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121) -greatFaceX21 = MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221) -greatFaceX31 = MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321) -greatFaceX41 = MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421) - -greatFaceX12 = MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122) -greatFaceX22 = MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222) -greatFaceX32 = MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322) -greatFaceX42 = MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422) - -greatFaceX13 = MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123) -greatFaceX23 = MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223) -greatFaceX33 = MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323) -greatFaceX43 = MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423) - -greatFaceY111 = MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211) -greatFaceY211 = MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311) -greatFaceY311 = MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411) -greatFaceY121 = MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221) -greatFaceY221 = MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321) -greatFaceY321 = MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421) - -greatFaceY112 = MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212) -greatFaceY212 = MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312) -greatFaceY312 = MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412) -greatFaceY122 = MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222) +smallFaceX1 = geompy.MakeQuad(smallEdgeY11, smallEdgeZ11, smallEdgeY12, smallEdgeZ12) +smallFaceX2 = geompy.MakeQuad(smallEdgeY21, smallEdgeZ21, smallEdgeY22, smallEdgeZ22) +smallFaceY1 = geompy.MakeQuad(smallEdgeX11, smallEdgeZ11, smallEdgeX12, smallEdgeZ21) +smallFaceY2 = geompy.MakeQuad(smallEdgeX21, smallEdgeZ12, smallEdgeX22, smallEdgeZ22) +smallFaceZ1 = geompy.MakeQuad(smallEdgeX11, smallEdgeY11, smallEdgeX21, smallEdgeY21) +smallFaceZ2 = geompy.MakeQuad(smallEdgeX12, smallEdgeY12, smallEdgeX22, smallEdgeY22) + + +greatFaceX11 = geompy.MakeQuad(greatEdgeY11, greatEdgeZ111, greatEdgeY12, greatEdgeZ121) +greatFaceX21 = geompy.MakeQuad(greatEdgeY21, greatEdgeZ211, greatEdgeY22, greatEdgeZ221) +greatFaceX31 = geompy.MakeQuad(greatEdgeY31, greatEdgeZ311, greatEdgeY32, greatEdgeZ321) +greatFaceX41 = geompy.MakeQuad(greatEdgeY41, greatEdgeZ411, greatEdgeY42, greatEdgeZ421) + +greatFaceX12 = geompy.MakeQuad(greatEdgeY12, greatEdgeZ112, greatEdgeY13, greatEdgeZ122) +greatFaceX22 = geompy.MakeQuad(greatEdgeY22, greatEdgeZ212, greatEdgeY23, greatEdgeZ222) +greatFaceX32 = geompy.MakeQuad(greatEdgeY32, greatEdgeZ312, greatEdgeY33, greatEdgeZ322) +greatFaceX42 = geompy.MakeQuad(greatEdgeY42, greatEdgeZ412, greatEdgeY43, greatEdgeZ422) + +greatFaceX13 = geompy.MakeQuad(greatEdgeY13, greatEdgeZ113, greatEdgeY14, greatEdgeZ123) +greatFaceX23 = geompy.MakeQuad(greatEdgeY23, greatEdgeZ213, greatEdgeY24, greatEdgeZ223) +greatFaceX33 = geompy.MakeQuad(greatEdgeY33, greatEdgeZ313, greatEdgeY34, greatEdgeZ323) +greatFaceX43 = geompy.MakeQuad(greatEdgeY43, greatEdgeZ413, greatEdgeY44, greatEdgeZ423) + +greatFaceY111 = geompy.MakeQuad(greatEdgeX111, greatEdgeZ111, greatEdgeX112, greatEdgeZ211) +greatFaceY211 = geompy.MakeQuad(greatEdgeX211, greatEdgeZ211, greatEdgeX212, greatEdgeZ311) +greatFaceY311 = geompy.MakeQuad(greatEdgeX311, greatEdgeZ311, greatEdgeX312, greatEdgeZ411) +greatFaceY121 = geompy.MakeQuad(greatEdgeX121, greatEdgeZ121, greatEdgeX122, greatEdgeZ221) +greatFaceY221 = geompy.MakeQuad(greatEdgeX221, greatEdgeZ221, greatEdgeX222, greatEdgeZ321) +greatFaceY321 = geompy.MakeQuad(greatEdgeX321, greatEdgeZ321, greatEdgeX322, greatEdgeZ421) + +greatFaceY112 = geompy.MakeQuad(greatEdgeX112, greatEdgeZ112, greatEdgeX113, greatEdgeZ212) +greatFaceY212 = geompy.MakeQuad(greatEdgeX212, greatEdgeZ212, greatEdgeX213, greatEdgeZ312) +greatFaceY312 = geompy.MakeQuad(greatEdgeX312, greatEdgeZ312, greatEdgeX313, greatEdgeZ412) +greatFaceY122 = geompy.MakeQuad(greatEdgeX122, greatEdgeZ122, greatEdgeX123, greatEdgeZ222) greatFaceY222 = smallFaceY1 -greatFaceY322 = MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422) +greatFaceY322 = geompy.MakeQuad(greatEdgeX322, greatEdgeZ322, greatEdgeX323, greatEdgeZ422) -greatFaceY113 = MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213) -greatFaceY213 = MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313) -greatFaceY313 = MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413) -greatFaceY123 = MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223) -greatFaceY223 = MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323) -greatFaceY323 = MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423) +greatFaceY113 = geompy.MakeQuad(greatEdgeX113, greatEdgeZ113, greatEdgeX114, greatEdgeZ213) +greatFaceY213 = geompy.MakeQuad(greatEdgeX213, greatEdgeZ213, greatEdgeX214, greatEdgeZ313) +greatFaceY313 = geompy.MakeQuad(greatEdgeX313, greatEdgeZ313, greatEdgeX314, greatEdgeZ413) +greatFaceY123 = geompy.MakeQuad(greatEdgeX123, greatEdgeZ123, greatEdgeX124, greatEdgeZ223) +greatFaceY223 = geompy.MakeQuad(greatEdgeX223, greatEdgeZ223, greatEdgeX224, greatEdgeZ323) +greatFaceY323 = geompy.MakeQuad(greatEdgeX323, greatEdgeZ323, greatEdgeX324, greatEdgeZ423) -greatFaceZ11 = MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21) -greatFaceZ21 = MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31) -greatFaceZ31 = MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41) +greatFaceZ11 = geompy.MakeQuad(greatEdgeX111, greatEdgeY11, greatEdgeX121, greatEdgeY21) +greatFaceZ21 = geompy.MakeQuad(greatEdgeX211, greatEdgeY21, greatEdgeX221, greatEdgeY31) +greatFaceZ31 = geompy.MakeQuad(greatEdgeX311, greatEdgeY31, greatEdgeX321, greatEdgeY41) -greatFaceZ12 = MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22) -greatFaceZ22 = MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32) -greatFaceZ32 = MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42) +greatFaceZ12 = geompy.MakeQuad(greatEdgeX112, greatEdgeY12, greatEdgeX122, greatEdgeY22) +greatFaceZ22 = geompy.MakeQuad(greatEdgeX212, greatEdgeY22, greatEdgeX222, greatEdgeY32) +greatFaceZ32 = geompy.MakeQuad(greatEdgeX312, greatEdgeY32, greatEdgeX322, greatEdgeY42) -greatFaceZ13 = MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23) -greatFaceZ23 = MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33) -greatFaceZ33 = MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43) +greatFaceZ13 = geompy.MakeQuad(greatEdgeX113, greatEdgeY13, greatEdgeX123, greatEdgeY23) +greatFaceZ23 = geompy.MakeQuad(greatEdgeX213, greatEdgeY23, greatEdgeX223, greatEdgeY33) +greatFaceZ33 = geompy.MakeQuad(greatEdgeX313, greatEdgeY33, greatEdgeX323, greatEdgeY43) -greatFaceZ14 = MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24) -greatFaceZ24 = MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34) -greatFaceZ34 = MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44) +greatFaceZ14 = geompy.MakeQuad(greatEdgeX114, greatEdgeY14, greatEdgeX124, greatEdgeY24) +greatFaceZ24 = geompy.MakeQuad(greatEdgeX214, greatEdgeY24, greatEdgeX224, greatEdgeY34) +greatFaceZ34 = geompy.MakeQuad(greatEdgeX314, greatEdgeY34, greatEdgeX324, greatEdgeY44) # Solids # ------ -smallBlock = MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2) +smallBlock = geompy.MakeHexa(smallFaceX1, smallFaceX2, smallFaceY1, smallFaceY2, smallFaceZ1, smallFaceZ2) -greatBlock11 = MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12) -greatBlock21 = MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22) -greatBlock31 = MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32) +greatBlock11 = geompy.MakeHexa(greatFaceX11, greatFaceX21, greatFaceY111, greatFaceY121, greatFaceZ11, greatFaceZ12) +greatBlock21 = geompy.MakeHexa(greatFaceX21, greatFaceX31, greatFaceY211, greatFaceY221, greatFaceZ21, greatFaceZ22) +greatBlock31 = geompy.MakeHexa(greatFaceX31, greatFaceX41, greatFaceY311, greatFaceY321, greatFaceZ31, greatFaceZ32) -greatBlock12 = MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13) -greatBlock22 = MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23) -greatBlock32 = MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33) +greatBlock12 = geompy.MakeHexa(greatFaceX12, greatFaceX22, greatFaceY112, greatFaceY122, greatFaceZ12, greatFaceZ13) +greatBlock22 = geompy.MakeHexa(greatFaceX22, greatFaceX32, greatFaceY212, greatFaceY222, greatFaceZ22, greatFaceZ23) +greatBlock32 = geompy.MakeHexa(greatFaceX32, greatFaceX42, greatFaceY312, greatFaceY322, greatFaceZ32, greatFaceZ33) -greatBlock13 = MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14) -greatBlock23 = MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24) -greatBlock33 = MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34) +greatBlock13 = geompy.MakeHexa(greatFaceX13, greatFaceX23, greatFaceY113, greatFaceY123, greatFaceZ13, greatFaceZ14) +greatBlock23 = geompy.MakeHexa(greatFaceX23, greatFaceX33, greatFaceY213, greatFaceY223, greatFaceZ23, greatFaceZ24) +greatBlock33 = geompy.MakeHexa(greatFaceX33, greatFaceX43, greatFaceY313, greatFaceY323, greatFaceZ33, greatFaceZ34) # Compound # -------- @@ -278,18 +284,16 @@ c_l.append(greatBlock13) c_l.append(greatBlock23) c_l.append(greatBlock33) -piece = MakeCompound(c_l) +piece = geompy.MakeCompound(c_l) # Add in study # ------------ -piece_id = addToStudy(piece, "ex01_cube2build") +piece_id = geompy.addToStudy(piece, "ex01_cube2build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex02_cube2primitive.py b/src/SMESH_SWIG/ex02_cube2primitive.py index 9350199eb..cbfcc5bd9 100644 --- a/src/SMESH_SWIG/ex02_cube2primitive.py +++ b/src/SMESH_SWIG/ex02_cube2primitive.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # 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 # --------------------------------- diff --git a/src/SMESH_SWIG/ex03_cube2partition.py b/src/SMESH_SWIG/ex03_cube2partition.py index 1849895fe..e4131bc62 100644 --- a/src/SMESH_SWIG/ex03_cube2partition.py +++ b/src/SMESH_SWIG/ex03_cube2partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -49,45 +55,43 @@ g_trim = 1000 v_arete2 = g_arete*2 v_arete3 = g_arete*3 -v_1 = MakeVertex(g_ox , g_oy , g_oz ) -v_2 = MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3) +v_1 = geompy.MakeVertex(g_ox , g_oy , g_oz ) +v_2 = geompy.MakeVertex(g_ox+v_arete3, g_oy+g_arete , g_oz+v_arete3) -v_3 = MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete ) -v_4 = MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2) +v_3 = geompy.MakeVertex(g_ox+g_arete , g_oy+g_arete , g_oz+g_arete ) +v_4 = geompy.MakeVertex(g_ox+v_arete2, g_oy+v_arete2, g_oz+v_arete2) # Solids # ------ -s_base = MakeBoxTwoPnt(v_1, v_2) -s_haut = MakeBoxTwoPnt(v_3, v_4) +s_base = geompy.MakeBoxTwoPnt(v_1, v_2) +s_haut = geompy.MakeBoxTwoPnt(v_3, v_4) # Partition # --------- -p_dir1 = MakeVectorDXDYDZ(1, 0, 0) -p_dir2 = MakeVectorDXDYDZ(0, 0, 1) -p_dir3 = MakeVectorDXDYDZ(0, 1, 0) +p_dir1 = geompy.MakeVectorDXDYDZ(1, 0, 0) +p_dir2 = geompy.MakeVectorDXDYDZ(0, 0, 1) +p_dir3 = geompy.MakeVectorDXDYDZ(0, 1, 0) p_tools = [] -p_tools.append(MakePlane(v_3, p_dir1, g_trim)) -p_tools.append(MakePlane(v_4, p_dir1, g_trim)) -p_tools.append(MakePlane(v_3, p_dir2, g_trim)) -p_tools.append(MakePlane(v_4, p_dir2, g_trim)) -p_tools.append(MakePlane(v_3, p_dir3, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir1, g_trim)) +p_tools.append(geompy.MakePlane(v_4, p_dir1, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir2, g_trim)) +p_tools.append(geompy.MakePlane(v_4, p_dir2, g_trim)) +p_tools.append(geompy.MakePlane(v_3, p_dir3, g_trim)) -piece = MakePartition([s_base, s_haut], p_tools, [], [], ShapeType["SOLID"]) +piece = geompy.MakePartition([s_base, s_haut], p_tools, [], [], geompy.ShapeType["SOLID"]) # Study # ----- -piece_id = addToStudy(piece, "ex03_cube2partition") +piece_id = geompy.addToStudy(piece, "ex03_cube2partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create hexahedrical mesh on piece # --------------------------------- diff --git a/src/SMESH_SWIG/ex04_cube5tetraHexa.py b/src/SMESH_SWIG/ex04_cube5tetraHexa.py index 773aca145..2ba25abb1 100644 --- a/src/SMESH_SWIG/ex04_cube5tetraHexa.py +++ b/src/SMESH_SWIG/ex04_cube5tetraHexa.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -45,30 +51,28 @@ arete3 = arete*3 # Solids # ------ -box_tetra1 = MakeBox(arete0, arete0, 0, arete1, arete1, arete) +box_tetra1 = geompy.MakeBox(arete0, arete0, 0, arete1, arete1, arete) -box_ijk1 = MakeBox(arete1, arete0, 0, arete2, arete1, arete) +box_ijk1 = geompy.MakeBox(arete1, arete0, 0, arete2, arete1, arete) -box_hexa = MakeBox(arete1, arete1, 0, arete2, arete2, arete) +box_hexa = geompy.MakeBox(arete1, arete1, 0, arete2, arete2, arete) -box_ijk2 = MakeBox(arete2, arete1, 0, arete3, arete2, arete) +box_ijk2 = geompy.MakeBox(arete2, arete1, 0, arete3, arete2, arete) -box_tetra2 = MakeBox(arete2, arete2, 0, arete3 ,arete3, arete) +box_tetra2 = geompy.MakeBox(arete2, arete2, 0, arete3 ,arete3, arete) # Piece # ----- -piece_cpd = MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2]) +piece_cpd = geompy.MakeCompound([box_tetra1, box_ijk1, box_hexa, box_ijk2, box_tetra2]) -piece = MakeGlueFaces(piece_cpd, 1e-4) +piece = geompy.MakeGlueFaces(piece_cpd, 1e-4) -piece_id = addToStudy(piece, "ex04_cube5tetraHexa") +piece_id = geompy.addToStudy(piece, "ex04_cube5tetraHexa") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ @@ -86,8 +90,8 @@ mixed.Hexahedron() # ---------------------- def localMesh(b, hyp): - box = GetInPlace(piece, b) - faces = SubShapeAll(box, ShapeType["FACE"]) + box = geompy.GetInPlace(piece, b) + faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) i = 0 n = len(faces) @@ -99,7 +103,7 @@ def localMesh(b, hyp): algo.LengthFromEdges() i = i + 1 - algo = mixed.Tetrahedron(smesh.NETGEN, box) + algo = mixed.Tetrahedron(smeshBuilder.NETGEN, box) algo.MaxElementVolume(400) localMesh(box_tetra1, 1) diff --git a/src/SMESH_SWIG/ex05_hole1build.py b/src/SMESH_SWIG/ex05_hole1build.py index 231c3f1d4..7fe13f706 100644 --- a/src/SMESH_SWIG/ex05_hole1build.py +++ b/src/SMESH_SWIG/ex05_hole1build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math @@ -50,10 +56,10 @@ rayon = 10 # Points # ------ -basePoint111 = MakeVertex(ox , oy, oz) -basePoint211 = MakeVertex(ox+longueur, oy, oz) -basePoint112 = MakeVertex(ox , oy, oz+largeur) -basePoint212 = MakeVertex(ox+longueur, oy, oz+largeur) +basePoint111 = geompy.MakeVertex(ox , oy, oz) +basePoint211 = geompy.MakeVertex(ox+longueur, oy, oz) +basePoint112 = geompy.MakeVertex(ox , oy, oz+largeur) +basePoint212 = geompy.MakeVertex(ox+longueur, oy, oz+largeur) cx = ox+longueur/2 cy = oy @@ -64,46 +70,46 @@ ll = ll*ll dx = rayon/math.sqrt(1+ll) dz = rayon/math.sqrt(1+1/ll) -circlePoint1 = MakeVertex(cx-dx, cy, cz-dz) -circlePoint2 = MakeVertex(cx+dx, cy, cz-dz) -circlePoint3 = MakeVertex(cx+dx, cy, cz+dz) -circlePoint4 = MakeVertex(cx-dx, cy, cz+dz) +circlePoint1 = geompy.MakeVertex(cx-dx, cy, cz-dz) +circlePoint2 = geompy.MakeVertex(cx+dx, cy, cz-dz) +circlePoint3 = geompy.MakeVertex(cx+dx, cy, cz+dz) +circlePoint4 = geompy.MakeVertex(cx-dx, cy, cz+dz) # Edges # ----- -squareEdge1 = MakeEdge(basePoint111, basePoint211) -squareEdge2 = MakeEdge(basePoint211, basePoint212) -squareEdge3 = MakeEdge(basePoint212, basePoint112) -squareEdge4 = MakeEdge(basePoint112, basePoint111) +squareEdge1 = geompy.MakeEdge(basePoint111, basePoint211) +squareEdge2 = geompy.MakeEdge(basePoint211, basePoint212) +squareEdge3 = geompy.MakeEdge(basePoint212, basePoint112) +squareEdge4 = geompy.MakeEdge(basePoint112, basePoint111) -diagEdge1 = MakeEdge(basePoint111, circlePoint1) -diagEdge2 = MakeEdge(basePoint211, circlePoint2) -diagEdge3 = MakeEdge(basePoint212, circlePoint3) -diagEdge4 = MakeEdge(basePoint112, circlePoint4) +diagEdge1 = geompy.MakeEdge(basePoint111, circlePoint1) +diagEdge2 = geompy.MakeEdge(basePoint211, circlePoint2) +diagEdge3 = geompy.MakeEdge(basePoint212, circlePoint3) +diagEdge4 = geompy.MakeEdge(basePoint112, circlePoint4) -arcEdge1 = MakeArc(circlePoint1, MakeVertex(cx , cy, cz-rayon), circlePoint2) -arcEdge2 = MakeArc(circlePoint2, MakeVertex(cx+rayon, cy, cz ), circlePoint3) -arcEdge3 = MakeArc(circlePoint3, MakeVertex(cx , cy, cz+rayon), circlePoint4) -arcEdge4 = MakeArc(circlePoint4, MakeVertex(cx-rayon, cy, cz ), circlePoint1) +arcEdge1 = geompy.MakeArc(circlePoint1, geompy.MakeVertex(cx , cy, cz-rayon), circlePoint2) +arcEdge2 = geompy.MakeArc(circlePoint2, geompy.MakeVertex(cx+rayon, cy, cz ), circlePoint3) +arcEdge3 = geompy.MakeArc(circlePoint3, geompy.MakeVertex(cx , cy, cz+rayon), circlePoint4) +arcEdge4 = geompy.MakeArc(circlePoint4, geompy.MakeVertex(cx-rayon, cy, cz ), circlePoint1) # Faces # ----- -baseFace1 = MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1) -baseFace2 = MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2) -baseFace3 = MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3) -baseFace4 = MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4) +baseFace1 = geompy.MakeQuad(squareEdge1, diagEdge2, arcEdge1, diagEdge1) +baseFace2 = geompy.MakeQuad(squareEdge2, diagEdge3, arcEdge2, diagEdge2) +baseFace3 = geompy.MakeQuad(squareEdge3, diagEdge4, arcEdge3, diagEdge3) +baseFace4 = geompy.MakeQuad(squareEdge4, diagEdge1, arcEdge4, diagEdge4) # Solids # ------ -baseVector = MakeVectorDXDYDZ(0, 1, 0) +baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur) -baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur) -baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur) -baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur) +baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur) +baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur) +baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur) +baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur) # Compound # -------- @@ -114,19 +120,17 @@ c_l.append(baseSolid2) c_l.append(baseSolid3) c_l.append(baseSolid4) -c_cpd = MakeCompound(c_l) -piece = MakeGlueFaces(c_cpd, 1.e-5) +c_cpd = geompy.MakeCompound(c_l) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex05_hole1build") +piece_id = geompy.addToStudy(piece, "ex05_hole1build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex06_hole1boolean.py b/src/SMESH_SWIG/ex06_hole1boolean.py index 0335c3357..0d703070c 100644 --- a/src/SMESH_SWIG/ex06_hole1boolean.py +++ b/src/SMESH_SWIG/ex06_hole1boolean.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -54,21 +60,21 @@ rayon = 10 def triangle(p1, p2, p3): l = [] - l.append(MakeEdge(p1, p2)) - l.append(MakeEdge(p2, p3)) - l.append(MakeEdge(p3, p1)) - w = MakeWire(l) - return MakeFace(w, 1) + l.append(geompy.MakeEdge(p1, p2)) + l.append(geompy.MakeEdge(p2, p3)) + l.append(geompy.MakeEdge(p3, p1)) + w = geompy.MakeWire(l) + return geompy.MakeFace(w, 1) # Points # ------ -basePoint111 = MakeVertex(ox-longueur1, oy, oz-largeur1) -basePoint211 = MakeVertex(ox+longueur2, oy, oz-largeur1) -basePoint112 = MakeVertex(ox-longueur1, oy, oz+largeur2) -basePoint212 = MakeVertex(ox+longueur2, oy, oz+largeur2) +basePoint111 = geompy.MakeVertex(ox-longueur1, oy, oz-largeur1) +basePoint211 = geompy.MakeVertex(ox+longueur2, oy, oz-largeur1) +basePoint112 = geompy.MakeVertex(ox-longueur1, oy, oz+largeur2) +basePoint212 = geompy.MakeVertex(ox+longueur2, oy, oz+largeur2) -holePoint = MakeVertex(ox, oy, oz) +holePoint = geompy.MakeVertex(ox, oy, oz) # Faces # ----- @@ -81,22 +87,22 @@ baseFace4 = triangle(basePoint112, basePoint111, holePoint) # Solids # ------ -baseVector = MakeVectorDXDYDZ(0, 1, 0) +baseVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -baseSolid1 = MakePrismVecH(baseFace1, baseVector, hauteur) -baseSolid2 = MakePrismVecH(baseFace2, baseVector, hauteur) -baseSolid3 = MakePrismVecH(baseFace3, baseVector, hauteur) -baseSolid4 = MakePrismVecH(baseFace4, baseVector, hauteur) +baseSolid1 = geompy.MakePrismVecH(baseFace1, baseVector, hauteur) +baseSolid2 = geompy.MakePrismVecH(baseFace2, baseVector, hauteur) +baseSolid3 = geompy.MakePrismVecH(baseFace3, baseVector, hauteur) +baseSolid4 = geompy.MakePrismVecH(baseFace4, baseVector, hauteur) -holeSolid = MakeCylinder(holePoint, baseVector, rayon, hauteur) +holeSolid = geompy.MakeCylinder(holePoint, baseVector, rayon, hauteur) # Boolean operations # ------------------ -baseHexa1 = MakeCut(baseSolid1, holeSolid) -baseHexa2 = MakeCut(baseSolid2, holeSolid) -baseHexa3 = MakeCut(baseSolid3, holeSolid) -baseHexa4 = MakeCut(baseSolid4, holeSolid) +baseHexa1 = geompy.MakeCut(baseSolid1, holeSolid) +baseHexa2 = geompy.MakeCut(baseSolid2, holeSolid) +baseHexa3 = geompy.MakeCut(baseSolid3, holeSolid) +baseHexa4 = geompy.MakeCut(baseSolid4, holeSolid) # Compound, glue and repair # ------------------------- @@ -107,20 +113,18 @@ c_l.append(baseHexa2) c_l.append(baseHexa3) c_l.append(baseHexa4) -c_cpd = MakeCompound(c_l) -c_glu = MakeGlueFaces(c_cpd, 1.e-5) -piece = RemoveExtraEdges(c_glu, doUnionFaces=True) +c_cpd = geompy.MakeCompound(c_l) +c_glu = geompy.MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.RemoveExtraEdges(c_glu, doUnionFaces=True) # Add in study # ------------ -piece_id = addToStudy(piece, "ex06_hole1boolean") +piece_id = geompy.addToStudy(piece, "ex06_hole1boolean") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ @@ -137,22 +141,22 @@ hexa.Hexahedron() # Create local hypothesis # ----------------------- -edge1 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz-largeur1)) +edge1 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz-largeur1)) algo1 = hexa.Segment(edge1) algo1.NumberOfSegments(3) algo1.Propagation() -edge2 = GetEdgeNearPoint(piece, MakeVertex(ox-longueur1, oy, oz)) +edge2 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox-longueur1, oy, oz)) algo2 = hexa.Segment(edge2) algo2.NumberOfSegments(5) algo2.Propagation() -edge3 = GetEdgeNearPoint(piece, MakeVertex(ox, oy, oz+largeur2)) +edge3 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox, oy, oz+largeur2)) algo3 = hexa.Segment(edge3) algo3.NumberOfSegments(7) algo3.Propagation() -edge4 = GetEdgeNearPoint(piece, MakeVertex(ox+longueur2, oy, oz)) +edge4 = geompy.GetEdgeNearPoint(piece, geompy.MakeVertex(ox+longueur2, oy, oz)) algo4 = hexa.Segment(edge4) algo4.NumberOfSegments(9) algo4.Propagation() diff --git a/src/SMESH_SWIG/ex07_hole1partition.py b/src/SMESH_SWIG/ex07_hole1partition.py index 84a4326d6..9c3cb1fc9 100644 --- a/src/SMESH_SWIG/ex07_hole1partition.py +++ b/src/SMESH_SWIG/ex07_hole1partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -50,41 +56,39 @@ g_trim = 1000 # Box # --- -b_boite = MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur) +b_boite = geompy.MakeBox(g_x-g_longueur, g_y-g_hauteur, g_z-g_largeur, g_x+g_longueur, g_y+g_hauteur, g_z+g_largeur) # Cylinder # -------- -c_axe = MakeVectorDXDYDZ(0, 1, 0) +c_axe = geompy.MakeVectorDXDYDZ(0, 1, 0) -c_cyl = MakeCylinder(MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2) +c_cyl = geompy.MakeCylinder(geompy.MakeVertex(g_x, g_y-g_hauteur, g_z), c_axe, g_rayon, g_hauteur*2) -c_piece = MakeCut(b_boite, c_cyl) +c_piece = geompy.MakeCut(b_boite, c_cyl) # Partition and reperation # ------------------------ -p_centre = MakeVertex(g_x, g_y, g_z) +p_centre = geompy.MakeVertex(g_x, g_y, g_z) p_tools = [] -p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim)) -p_tools.append(MakePlane(p_centre, MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim)) +p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ( g_largeur, 0, g_longueur), g_trim)) +p_tools.append(geompy.MakePlane(p_centre, geompy.MakeVectorDXDYDZ(-g_largeur, 0, g_longueur), g_trim)) -p_part = MakePartition([c_piece], p_tools, [], [], ShapeType["SOLID"]) +p_part = geompy.MakePartition([c_piece], p_tools, [], [], geompy.ShapeType["SOLID"]) -p_blocs = RemoveExtraEdges(p_part, doUnionFaces=True) -piece = MakeGlueFaces(p_blocs, 1.e-5) +p_blocs = geompy.RemoveExtraEdges(p_part, doUnionFaces=True) +piece = geompy.MakeGlueFaces(p_blocs, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex07_hole1partition") +piece_id = geompy.addToStudy(piece, "ex07_hole1partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex08_hole2build.py b/src/SMESH_SWIG/ex08_hole2build.py index 0bc58f133..a343376e1 100644 --- a/src/SMESH_SWIG/ex08_hole2build.py +++ b/src/SMESH_SWIG/ex08_hole2build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -50,74 +56,72 @@ rayon = 20 # Points # ------ -piecePoint1 = MakeVertex(ox , oy, oz) -piecePoint2 = MakeVertex(ox+longueur, oy, oz) -piecePoint3 = MakeVertex(ox+longueur, oy, oz+largeur) -piecePoint4 = MakeVertex(ox , oy, oz+largeur) +piecePoint1 = geompy.MakeVertex(ox , oy, oz) +piecePoint2 = geompy.MakeVertex(ox+longueur, oy, oz) +piecePoint3 = geompy.MakeVertex(ox+longueur, oy, oz+largeur) +piecePoint4 = geompy.MakeVertex(ox , oy, oz+largeur) cz = oz+largeur/2 -cylPoint1 = MakeVertex(ox+cylindre , oy, cz-rayon) -cylPoint2 = MakeVertex(ox+longueur-cylindre, oy, cz-rayon) -cylPoint3 = MakeVertex(ox+longueur-cylindre, oy, cz+rayon) -cylPoint4 = MakeVertex(ox+cylindre , oy, cz+rayon) +cylPoint1 = geompy.MakeVertex(ox+cylindre , oy, cz-rayon) +cylPoint2 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz-rayon) +cylPoint3 = geompy.MakeVertex(ox+longueur-cylindre, oy, cz+rayon) +cylPoint4 = geompy.MakeVertex(ox+cylindre , oy, cz+rayon) # Edges # ----- -pieceEdge1 = MakeEdge(piecePoint1, piecePoint4) -pieceEdge2 = MakeEdge(piecePoint1, cylPoint1) -pieceEdge3 = MakeEdge(piecePoint4, cylPoint4) +pieceEdge1 = geompy.MakeEdge(piecePoint1, piecePoint4) +pieceEdge2 = geompy.MakeEdge(piecePoint1, cylPoint1) +pieceEdge3 = geompy.MakeEdge(piecePoint4, cylPoint4) -pieceEdge4 = MakeEdge(piecePoint2, piecePoint3) -pieceEdge5 = MakeEdge(piecePoint2, cylPoint2) -pieceEdge6 = MakeEdge(piecePoint3, cylPoint3) +pieceEdge4 = geompy.MakeEdge(piecePoint2, piecePoint3) +pieceEdge5 = geompy.MakeEdge(piecePoint2, cylPoint2) +pieceEdge6 = geompy.MakeEdge(piecePoint3, cylPoint3) -pieceEdge7 = MakeEdge(cylPoint1, cylPoint2) -pieceEdge8 = MakeEdge(cylPoint3, cylPoint4) +pieceEdge7 = geompy.MakeEdge(cylPoint1, cylPoint2) +pieceEdge8 = geompy.MakeEdge(cylPoint3, cylPoint4) -cylEdge1 = MakeArc(cylPoint1, MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4) -cylEdge2 = MakeArc(cylPoint1, MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4) -cylEdge3 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3) -cylEdge4 = MakeArc(cylPoint2, MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3) +cylEdge1 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre-rayon , oy, cz), cylPoint4) +cylEdge2 = geompy.MakeArc(cylPoint1, geompy.MakeVertex(ox+cylindre+rayon , oy, cz), cylPoint4) +cylEdge3 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre-rayon, oy, cz), cylPoint3) +cylEdge4 = geompy.MakeArc(cylPoint2, geompy.MakeVertex(ox+longueur-cylindre+rayon, oy, cz), cylPoint3) # Faces # ----- -pieceFace1 = MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 ) -pieceFace2 = MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3) -pieceFace3 = MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 ) -pieceFace4 = MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6) -pieceFace5 = MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 ) +pieceFace1 = geompy.MakeQuad4Vertices(piecePoint1, piecePoint2, cylPoint2 , cylPoint1 ) +pieceFace2 = geompy.MakeQuad (pieceEdge1 , pieceEdge2 , cylEdge1 , pieceEdge3) +pieceFace3 = geompy.MakeQuad4Vertices(piecePoint3, piecePoint4, cylPoint4 , cylPoint3 ) +pieceFace4 = geompy.MakeQuad (pieceEdge4 , pieceEdge5 , cylEdge4 , pieceEdge6) +pieceFace5 = geompy.MakeQuad (pieceEdge7 , cylEdge3 , pieceEdge8, cylEdge2 ) # Solids # ------ -pieceVector = MakeVectorDXDYDZ(0, 1, 0) +pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur) -pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur) -pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur) -pieceSolid4 = MakePrismVecH(pieceFace4, pieceVector, hauteur) -pieceSolid5 = MakePrismVecH(pieceFace5, pieceVector, hauteur) +pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur) +pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur) +pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur) +pieceSolid4 = geompy.MakePrismVecH(pieceFace4, pieceVector, hauteur) +pieceSolid5 = geompy.MakePrismVecH(pieceFace5, pieceVector, hauteur) # Compound and glue # ----------------- -c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5]) +c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3, pieceSolid4, pieceSolid5]) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex08_hole2build") +piece_id = geompy.addToStudy(piece, "ex08_hole2build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex09_grid4build.py b/src/SMESH_SWIG/ex09_grid4build.py index cbbec434c..2fd559389 100644 --- a/src/SMESH_SWIG/ex09_grid4build.py +++ b/src/SMESH_SWIG/ex09_grid4build.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) import math @@ -52,75 +58,73 @@ r3 = demi*math.sqrt(3) # Points # ------ -piecePoint111 = MakeVertex(ox+rayon , oy, oz) -piecePoint211 = MakeVertex(ox+arete-rayon, oy, oz) -piecePoint112 = MakeVertex(ox , oy, oz+rayon) -piecePoint212 = MakeVertex(ox+arete , oy, oz+rayon) -piecePoint113 = MakeVertex(ox , oy, oz+arete-rayon) -piecePoint213 = MakeVertex(ox+arete , oy, oz+arete-rayon) -piecePoint114 = MakeVertex(ox+rayon , oy, oz+arete) -piecePoint214 = MakeVertex(ox+arete-rayon, oy, oz+arete) - -pieceCenter1 = MakeVertex(ox , oy, oz) -pieceCenter2 = MakeVertex(ox+arete , oy, oz) -pieceCenter3 = MakeVertex(ox , oy, oz+arete) -pieceCenter4 = MakeVertex(ox+arete , oy, oz+arete) - -piecePass1 = MakeVertex(ox+demi , oy, oz+r3) -piecePass2 = MakeVertex(ox+arete-demi , oy, oz+r3) -piecePass3 = MakeVertex(ox+arete-demi , oy, oz+arete-r3) -piecePass4 = MakeVertex(ox+demi , oy, oz+arete-r3) +piecePoint111 = geompy.MakeVertex(ox+rayon , oy, oz) +piecePoint211 = geompy.MakeVertex(ox+arete-rayon, oy, oz) +piecePoint112 = geompy.MakeVertex(ox , oy, oz+rayon) +piecePoint212 = geompy.MakeVertex(ox+arete , oy, oz+rayon) +piecePoint113 = geompy.MakeVertex(ox , oy, oz+arete-rayon) +piecePoint213 = geompy.MakeVertex(ox+arete , oy, oz+arete-rayon) +piecePoint114 = geompy.MakeVertex(ox+rayon , oy, oz+arete) +piecePoint214 = geompy.MakeVertex(ox+arete-rayon, oy, oz+arete) + +pieceCenter1 = geompy.MakeVertex(ox , oy, oz) +pieceCenter2 = geompy.MakeVertex(ox+arete , oy, oz) +pieceCenter3 = geompy.MakeVertex(ox , oy, oz+arete) +pieceCenter4 = geompy.MakeVertex(ox+arete , oy, oz+arete) + +piecePass1 = geompy.MakeVertex(ox+demi , oy, oz+r3) +piecePass2 = geompy.MakeVertex(ox+arete-demi , oy, oz+r3) +piecePass3 = geompy.MakeVertex(ox+arete-demi , oy, oz+arete-r3) +piecePass4 = geompy.MakeVertex(ox+demi , oy, oz+arete-r3) # Edges # ----- -pieceEdgeSquare1 = MakeEdge(piecePoint111, piecePoint211) -pieceEdgeSquare2 = MakeEdge(piecePoint114, piecePoint214) -pieceEdgeSquare3 = MakeEdge(piecePoint112, piecePoint113) -pieceEdgeSquare4 = MakeEdge(piecePoint212, piecePoint213) +pieceEdgeSquare1 = geompy.MakeEdge(piecePoint111, piecePoint211) +pieceEdgeSquare2 = geompy.MakeEdge(piecePoint114, piecePoint214) +pieceEdgeSquare3 = geompy.MakeEdge(piecePoint112, piecePoint113) +pieceEdgeSquare4 = geompy.MakeEdge(piecePoint212, piecePoint213) -pieceEdgeDiagonal1 = MakeEdge(piecePoint111, piecePoint213) -pieceEdgeDiagonal2 = MakeEdge(piecePoint112, piecePoint214) +pieceEdgeDiagonal1 = geompy.MakeEdge(piecePoint111, piecePoint213) +pieceEdgeDiagonal2 = geompy.MakeEdge(piecePoint112, piecePoint214) -pieceEdgeArc1 = MakeArc(piecePoint111, piecePass1, piecePoint112) -pieceEdgeArc2 = MakeArc(piecePoint211, piecePass2, piecePoint212) -pieceEdgeArc3 = MakeArc(piecePoint213, piecePass3, piecePoint214) -pieceEdgeArc4 = MakeArc(piecePoint113, piecePass4, piecePoint114) +pieceEdgeArc1 = geompy.MakeArc(piecePoint111, piecePass1, piecePoint112) +pieceEdgeArc2 = geompy.MakeArc(piecePoint211, piecePass2, piecePoint212) +pieceEdgeArc3 = geompy.MakeArc(piecePoint213, piecePass3, piecePoint214) +pieceEdgeArc4 = geompy.MakeArc(piecePoint113, piecePass4, piecePoint114) # Faces # ----- -pieceFace1 = MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1) -pieceFace2 = MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2) +pieceFace1 = geompy.MakeQuad(pieceEdgeSquare1, pieceEdgeArc2, pieceEdgeSquare4, pieceEdgeDiagonal1) +pieceFace2 = geompy.MakeQuad(pieceEdgeSquare2, pieceEdgeArc4, pieceEdgeSquare3, pieceEdgeDiagonal2) -pieceFace3 = MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2) +pieceFace3 = geompy.MakeQuad(pieceEdgeArc1, pieceEdgeDiagonal1, pieceEdgeArc3, pieceEdgeDiagonal2) # Solids # ------ -pieceVector = MakeVectorDXDYDZ(0, 1, 0) +pieceVector = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceSolid1 = MakePrismVecH(pieceFace1, pieceVector, hauteur) -pieceSolid2 = MakePrismVecH(pieceFace2, pieceVector, hauteur) -pieceSolid3 = MakePrismVecH(pieceFace3, pieceVector, hauteur) +pieceSolid1 = geompy.MakePrismVecH(pieceFace1, pieceVector, hauteur) +pieceSolid2 = geompy.MakePrismVecH(pieceFace2, pieceVector, hauteur) +pieceSolid3 = geompy.MakePrismVecH(pieceFace3, pieceVector, hauteur) # Compound and glue # ----------------- -c_cpd = MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3]) +c_cpd = geompy.MakeCompound([pieceSolid1, pieceSolid2, pieceSolid3]) -piece = MakeGlueFaces(c_cpd, 1.e-5) +piece = geompy.MakeGlueFaces(c_cpd, 1.e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex09_grid4build") +piece_id = geompy.addToStudy(piece, "ex09_grid4build") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex10_grid4geometry.py b/src/SMESH_SWIG/ex10_grid4geometry.py index 1679e4b5f..470189368 100644 --- a/src/SMESH_SWIG/ex10_grid4geometry.py +++ b/src/SMESH_SWIG/ex10_grid4geometry.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -48,41 +54,39 @@ g_trim = 1000 # Box # --- -piecePoint = MakeVertex(ox, oy, oz) +piecePoint = geompy.MakeVertex(ox, oy, oz) -pieceBox = MakeBoxTwoPnt(piecePoint, MakeVertex(ox+arete, oy+hauteur, oz+arete)) +pieceBox = geompy.MakeBoxTwoPnt(piecePoint, geompy.MakeVertex(ox+arete, oy+hauteur, oz+arete)) # Cut by cylinders # ---------------- -dirUp = MakeVectorDXDYDZ(0, 1, 0) +dirUp = geompy.MakeVectorDXDYDZ(0, 1, 0) -pieceCut1 = MakeCut(pieceBox , MakeCylinder(piecePoint , dirUp, rayon, hauteur)) -pieceCut2 = MakeCut(pieceCut1, MakeCylinder(MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur)) -pieceCut3 = MakeCut(pieceCut2, MakeCylinder(MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur)) -pieceCut4 = MakeCut(pieceCut3, MakeCylinder(MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur)) +pieceCut1 = geompy.MakeCut(pieceBox , geompy.MakeCylinder(piecePoint , dirUp, rayon, hauteur)) +pieceCut2 = geompy.MakeCut(pieceCut1, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz ), dirUp, rayon, hauteur)) +pieceCut3 = geompy.MakeCut(pieceCut2, geompy.MakeCylinder(geompy.MakeVertex(ox , oy, oz+arete), dirUp, rayon, hauteur)) +pieceCut4 = geompy.MakeCut(pieceCut3, geompy.MakeCylinder(geompy.MakeVertex(ox+arete, oy, oz+arete), dirUp, rayon, hauteur)) # Compound by make a partition of a solid # --------------------------------------- -dir = MakeVectorDXDYDZ(-1, 0, 1) +dir = geompy.MakeVectorDXDYDZ(-1, 0, 1) tools = [] -tools.append(MakePlane(MakeVertex(ox+rayon, oy, oz ), dir, g_trim)) -tools.append(MakePlane(MakeVertex(ox , oy, oz+rayon), dir, g_trim)) +tools.append(geompy.MakePlane(geompy.MakeVertex(ox+rayon, oy, oz ), dir, g_trim)) +tools.append(geompy.MakePlane(geompy.MakeVertex(ox , oy, oz+rayon), dir, g_trim)) -piece = MakePartition([pieceCut4], tools, [], [], ShapeType["SOLID"]) +piece = geompy.MakePartition([pieceCut4], tools, [], [], geompy.ShapeType["SOLID"]) # Add in study # ------------ -piece_id = addToStudy(piece, "ex10_grid4geometry") +piece_id = geompy.addToStudy(piece, "ex10_grid4geometry") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------ diff --git a/src/SMESH_SWIG/ex11_grid3partition.py b/src/SMESH_SWIG/ex11_grid3partition.py index 252aa5563..7e04a2e13 100644 --- a/src/SMESH_SWIG/ex11_grid3partition.py +++ b/src/SMESH_SWIG/ex11_grid3partition.py @@ -23,9 +23,15 @@ # ======================================= # -from geompy import * +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) -import smesh +import SMESH, SALOMEDS +from salome.smesh import smeshBuilder +smesh = smeshBuilder.New(salome.myStudy) # Geometry # ======== @@ -58,52 +64,50 @@ g_trim = 1000 # Element # ------- -e_boite = MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) +e_boite = geompy.MakeBox(g_x-g_arete, g_y-g_hauteur, g_z-g_arete, g_x+g_arete, g_y+g_hauteur, g_z+g_arete) e_hauteur = 2*g_hauteur -e_centre = MakeVertex(g_x, g_y-g_hauteur, g_z) -e_dir = MakeVectorDXDYDZ(0, 1, 0) +e_centre = geompy.MakeVertex(g_x, g_y-g_hauteur, g_z) +e_dir = geompy.MakeVectorDXDYDZ(0, 1, 0) -e_cyl1 = MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) +e_cyl1 = geompy.MakeCylinder(e_centre, e_dir, g_rayon3, e_hauteur) -e_blo1 = MakeCut(e_boite, e_cyl1) +e_blo1 = geompy.MakeCut(e_boite, e_cyl1) -e_cyl2 = MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) +e_cyl2 = geompy.MakeCylinder(e_centre, e_dir, g_rayon2, e_hauteur) -e_blo2 = MakeCut(e_cyl1, e_cyl2) +e_blo2 = geompy.MakeCut(e_cyl1, e_cyl2) -e_cyl3 = MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) +e_cyl3 = geompy.MakeCylinder(e_centre, e_dir, g_rayon1, e_hauteur) -e_blo3 = MakeCut(e_cyl2, e_cyl3) +e_blo3 = geompy.MakeCut(e_cyl2, e_cyl3) # Partition and repair # -------------------- p_tools = [] -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ( 1, 0, 1), g_trim)) -p_tools.append(MakePlane(e_centre, MakeVectorDXDYDZ(-1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ( 1, 0, 1), g_trim)) +p_tools.append(geompy.MakePlane(e_centre, geompy.MakeVectorDXDYDZ(-1, 0, 1), g_trim)) -p_part = MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], ShapeType["SOLID"]) +p_part = geompy.MakePartition([e_blo1, e_blo2, e_blo3], p_tools, [], [], geompy.ShapeType["SOLID"]) -p_element = RemoveExtraEdges(p_part, doUnionFaces=True) +p_element = geompy.RemoveExtraEdges(p_part, doUnionFaces=True) # Grid and glue # ------------- -grid = MakeMultiTranslation2D(p_element, MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) +grid = geompy.MakeMultiTranslation2D(p_element, geompy.MakeVectorDXDYDZ(1, 0, 0), 2*g_arete, g_grid, geompy.MakeVectorDXDYDZ(0, 0, 1), 2*g_arete, g_grid) -piece = MakeGlueFaces(grid, 1e-5) +piece = geompy.MakeGlueFaces(grid, 1e-5) # Add in study # ------------ -piece_id = addToStudy(piece, "ex11_grid3partition") +piece_id = geompy.addToStudy(piece, "ex11_grid3partition") # Meshing # ======= -smesh.SetCurrentStudy(salome.myStudy) - # Create a hexahedral mesh # ------------------------