From: rnv Date: Tue, 16 Jan 2018 12:03:05 +0000 (+0300) Subject: Rebase 'rnv/sphinx_doc' branch on the top of the 'master' branch. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=88c554eeb0dabe6123c363adaf2c2274c16bcc8b;p=modules%2Fsmesh.git Rebase 'rnv/sphinx_doc' branch on the top of the 'master' branch. --- 88c554eeb0dabe6123c363adaf2c2274c16bcc8b diff --cc src/SMESH_SWIG/smeshBuilder.py index f4f48a1a0,0553145f3..78f85f93c --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@@ -1354,18 -1354,6 +1354,22 @@@ class smeshBuilder(object, SMESH._objre aMeasurements.UnRegister() return value - ## Get gravity center of all nodes of the mesh object. - # @param obj mesh, submesh or group - # @return three components of the gravity center: x,y,z - # @ingroup l1_measurements + def GetGravityCenter(self, obj): ++ """ ++ Get gravity center of all nodes of the mesh object. ++ ++ Parameters: ++ obj: mesh, submesh or group ++ Returns: ++ Three components of the gravity center: x,y,z ++ """ + if isinstance(obj, Mesh): obj = obj.mesh + if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh() + aMeasurements = self.CreateMeasurements() + pointStruct = aMeasurements.GravityCenter(obj) + aMeasurements.UnRegister() + return pointStruct.x, pointStruct.y, pointStruct.z + pass # end of class smeshBuilder import omniORB @@@ -6443,37 -6431,6 +6447,37 @@@ class Mesh """ return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords ) + def MakePolyLine(self, segments, groupName='', isPreview=False ): + """ + Create a polyline consisting of 1D mesh elements each lying on a 2D element of + the initial mesh. Positions of new nodes are found by cutting the mesh by the + plane passing through pairs of points specified by each PolySegment structure. + If there are several paths connecting a pair of points, the shortest path is + selected by the module. Position of the cutting plane is defined by the two + points and an optional vector lying on the plane specified by a PolySegment. + By default the vector is defined by Mesh module as following. A middle point + of the two given points is computed. The middle point is projected to the mesh. + The vector goes from the middle point to the projection point. In case of planar + mesh, the vector is normal to the mesh. + + Parameters: - segments - PolySegment's defining positions of cutting planes. - groupName - optional name of a group where created mesh segments will ++ segments: PolySegment's defining positions of cutting planes. ++ groupName: optional name of a group where created mesh segments will + be added. + + Returns: + The used vector which goes from the middle point to its projection. + """ + editor = self.editor + if isPreview: + editor = self.mesh.GetMeshEditPreviewer() + segmentsRes = editor.MakePolyLine( segments, groupName ) + for i, seg in enumerate( segmentsRes ): + segments[i].vector = seg.vector + if isPreview: + return editor.GetPreviewData() + return None + def GetFunctor(self, funcType ): """ Return a cached numerical functor by its type.