From: eap Date: Thu, 27 Aug 2009 11:56:45 +0000 (+0000) Subject: 0020108: EDF 852 SMESH : Add examples in projection algorithm doc X-Git-Tag: V5_1_3rc1~96 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a483ff55f4c36f04d5be0e53eb7774bd3ef8b113;p=modules%2Fsmesh.git 0020108: EDF 852 SMESH : Add examples in projection algorithm doc +\anchor tui_projection +

Projection algorithms

+ +\code + ... --- diff --git a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc index ce75e3ae8..b195b12c6 100644 --- a/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc +++ b/doc/salome/gui/SMESH/input/tui_defining_hypotheses.doc @@ -386,9 +386,76 @@ n23_params = algo3D.Parameters() tetraN.Compute() \endcode +
+\anchor tui_projection +

Projection algorithms

+ +\code +# Project pentahedrons from one meshed box to another mesh on the same box + +from smesh import * + +# Prepare geometry + +# Create a parallelepiped +box = geompy.MakeBoxDXDYDZ(200, 100, 70) +geompy.addToStudy( box, "box" ) + +# Get geom faces to mesh with triangles in the 1ts and 2nd meshes +faces = geompy.SubShapeAll(box, geompy.ShapeType["FACE"]) +# 2 adjacent faces of the box +f1 = faces[2] +f2 = faces[0] +# face opposite to f2 +f2opp = faces[1] + +# Get vertices used to specify how to associate sides of faces at projection +[v1F1, v2F1] = geompy.SubShapeAll(f1, geompy.ShapeType["VERTEX"])[:2] +[v1F2, v2F2] = geompy.SubShapeAll(f2, geompy.ShapeType["VERTEX"])[:2] +geompy.addToStudyInFather( box, v1F1, "v1F1" ) +geompy.addToStudyInFather( box, v2F1, "v2F1" ) +geompy.addToStudyInFather( box, v1F2, "v1F2" ) +geompy.addToStudyInFather( box, v2F2, "v2F2" ) + + +# Make the source mesh with prisms +src_mesh = Mesh(box, "Source mesh") +src_mesh.Segment().NumberOfSegments(9,10) +src_mesh.Quadrangle() +src_mesh.Hexahedron() +src_mesh.Triangle(f1) # triangular sumbesh +src_mesh.Compute() + + +# Mesh the box using 2D and 3D projection algoritms + +# Define the same global 1D and 2D hypotheses +tgt_mesh = Mesh(box, "Target mesh") +tgt_mesh.Segment().NumberOfSegments(9,10,UseExisting=True) +tgt_mesh.Quadrangle() + +# Define hypotheses to project triangles from f1 face of the source mesh to +# f2 face in the target mesh. Vertices specify how to associate sides of faces +proj2D = tgt_mesh.Projection2D( f2 ) +proj2D.SourceFace( f1, src_mesh, v1F1, v1F2, v2F1, v2F2 ) + +# Hypotheses to project triangles from f2 of target mesh to the face opposite to f2. +# Association of face sides is default +proj2D = tgt_mesh.Projection2D( f2opp ) +proj2D.SourceFace( f2 ) + +# Hypotheses to project prisms from the source to the target mesh +proj3D = tgt_mesh.Projection3D() +proj3D.SourceShape3D( box, src_mesh, v1F1, v1F2, v2F1, v2F2 ) +tgt_mesh.Compute() + +# Move the source mesh to visualy compare the two meshes +src_mesh.TranslateObject( src_mesh, MakeDirStruct( 210, 0, 0 ), Copy=False) +\endcode + \n Other meshing algorithms: -*/ \ No newline at end of file +*/