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
"""
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
- segments - PolySegment's defining positions of cutting planes.
- groupName - optional name of a group where created mesh segments will
+ 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
+ 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.