Back to index

salome-smesh  6.5.0
Functions
Segments around Vertex
Defining Algorithms
Collaboration diagram for Segments around Vertex:

Functions

def StdMeshersDC.StdMeshersDC_Segment.LengthNearVertex
 Defines "SegmentLengthAroundVertex" hypothesis.

Function Documentation

def StdMeshersDC.StdMeshersDC_Segment.LengthNearVertex (   self,
  length,
  vertex = 0,
  UseExisting = 0 
)

Defines "SegmentLengthAroundVertex" hypothesis.

Parameters:
lengthfor the segment length
vertexfor the length localization: the vertex index [0,1] | vertex object. Any other integer value means that the hypothesis will be set on the whole 1D shape, where Mesh_Segment algorithm is assigned.
UseExistingif ==true - searches for an existing hypothesis created with the same parameters, else (default) - creates a new one

Definition at line 272 of file StdMeshersDC.py.

00272 
00273     def LengthNearVertex(self, length, vertex=0, UseExisting=0):
00274         import types
00275         store_geom = self.geom
00276         if type(vertex) is types.IntType:
00277             if vertex == 0 or vertex == 1:
00278                 import geompyDC
00279                 vertex = self.mesh.geompyD.ExtractShapes(self.geom, geompyDC.ShapeType["VERTEX"],True)[vertex]
00280                 self.geom = vertex
00281                 pass
00282             pass
00283         else:
00284             self.geom = vertex
00285             pass
00286         ### 0D algorithm
00287         if self.geom is None:
00288             raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
00289         AssureGeomPublished( self.mesh, self.geom )
00290         name = GetName(self.geom)
00291 
00292         algo = self.FindAlgorithm("SegmentAroundVertex_0D", self.mesh.smeshpyD)
00293         if algo is None:
00294             algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
00295             pass
00296         status = self.mesh.mesh.AddHypothesis(self.geom, algo)
00297         TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True)
00298         ###
00299         comFun = lambda hyp, args: IsEqual(hyp.GetLength(), args[0])
00300         hyp = self.Hypothesis("SegmentLengthAroundVertex", [length], UseExisting=UseExisting,
00301                               CompareMethod=comFun)
00302         self.geom = store_geom
00303         hyp.SetLength( length )
00304         return hyp