From c28b4480afaecf7d55f8166e0019df8ef14eec92 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 29 Jun 2012 13:56:13 +0000 Subject: [PATCH] 0021542: EDF 1699 SMESH: Reorient a group of faces + def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ): --- src/SMESH_SWIG/smeshDC.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index f79bd99e8..18614b8e9 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -1780,7 +1780,7 @@ class Mesh: return self.mesh.GetMeshEditor() ## Wrap a list of IDs of elements or nodes into SMESH_IDSource which - # can be passed as argument to accepting mesh, group or sub-mesh + # can be passed as argument to a method accepting mesh, group or sub-mesh # @return an instance of SMESH_IDSource # @ingroup l1_auxiliary def GetIDSource(self, ids, elemType): @@ -2542,6 +2542,41 @@ class Mesh: theObject = theObject.GetMesh() return self.editor.ReorientObject(theObject) + ## Reorient faces contained in \a the2DObject. + # @param the2DObject is a mesh, sub-mesh, group or list of IDs of 2D elements + # @param theDirection is a desired direction of normal of \a theFace. + # It can be either a GEOM vector or a list of coordinates [x,y,z]. + # @param theFaceOrPoint defines a face of \a the2DObject whose normal will be + # compared with theDirection. It can be either ID of face or a point + # by which the face will be found. The point can be given as either + # a GEOM vertex or a list of point coordinates. + # @return number of reoriented faces + # @ingroup l2_modif_changori + def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ): + # check the2DObject + if isinstance( the2DObject, Mesh ): + the2DObject = the2DObject.GetMesh() + if isinstance( the2DObject, list ): + the2DObject = self.GetIDSource( the2DObject, SMESH.FACE ) + # check theDirection + if isinstance( theDirection, geompyDC.GEOM._objref_GEOM_Object): + theDirection = self.smeshpyD.GetDirStruct( theDirection ) + if isinstance( theDirection, list ): + theDirection = self.smeshpyD.MakeDirStruct( *theDirection ) + # prepare theFace and thePoint + theFace = theFaceOrPoint + thePoint = PointStruct(0,0,0) + if isinstance( theFaceOrPoint, geompyDC.GEOM._objref_GEOM_Object): + thePoint = self.smeshpyD.GetPointStruct( theFaceOrPoint ) + theFace = -1 + if isinstance( theFaceOrPoint, list ): + thePoint = PointStruct( *theFaceOrPoint ) + theFace = -1 + if isinstance( theFaceOrPoint, PointStruct ): + thePoint = theFaceOrPoint + theFace = -1 + return self.editor.Reorient2D( the2DObject, theDirection, theFace, thePoint ) + ## Fuses the neighbouring triangles into quadrangles. # @param IDsOfElements The triangles to be fused, # @param theCriterion is FT_...; used to choose a neighbour to fuse with. -- 2.39.2