1 # Copyright (C) 2007-2014 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # @package BLSURFPluginBuilder
22 # Python API for the BLSURF meshing plug-in module.
24 from salome.smesh.smesh_algorithm import Mesh_Algorithm
26 # Topology treatment way of BLSURF
27 FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3
29 # Element size flag of BLSURF
30 DefaultSize, DefaultGeom, BLSURF_GlobalSize, BLSURF_LocalSize = 0,0,1,2
32 BLSURF_Custom, SizeMap = BLSURF_GlobalSize, BLSURF_LocalSize
35 # import BLSURFPlugin module if possible
43 #----------------------------
44 # Mesh algo type identifiers
45 #----------------------------
47 ## Algorithm type: BLSurf triangle 2D algorithm, see BLSURF_Algorithm
49 MG_CADSurf = "MG_CADSurf"
51 #----------------------
53 #----------------------
55 ## BLSurf 2D algorithm.
57 # It can be created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.BLSURF,geom=0)
59 class BLSURF_Algorithm(Mesh_Algorithm):
61 ## name of the dynamic method in smeshBuilder.Mesh class
63 meshMethod = "Triangle"
64 ## type of algorithm used with helper function in smeshBuilder.Mesh class
67 ## doc string of the method
69 docHelper = "Creates triangle 2D algorithm for faces"
71 _anisotropic_ratio = 0
72 _bad_surface_element_aspect_ratio = 1000
73 _geometric_approximation = 22
76 _remove_tiny_edges = 0
78 ## Private constructor.
79 # @param mesh parent mesh object algorithm is assigned to
80 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
81 # if it is @c 0 (default), the algorithm is assigned to the main shape
82 def __init__(self, mesh, geom=0):
83 Mesh_Algorithm.__init__(self)
85 print "Warning: BLSURFPlugin module unavailable"
86 self.Create(mesh, geom, BLSURF, "libBLSURFEngine.so")
88 self.geompyD = mesh.geompyD
89 #self.SetPhysicalMesh() - PAL19680
92 ## Sets a way to define size of mesh elements to generate.
93 # @param thePhysicalMesh is: DefaultSize, BLSURF_Custom or SizeMap.
94 def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
95 physical_size_mode = thePhysicalMesh
96 if self.Parameters().GetGeometricMesh() == DefaultGeom:
97 if physical_size_mode == DefaultSize:
98 physical_size_mode = BLSURF_GlobalSize
99 self.Parameters().SetPhysicalMesh(physical_size_mode)
102 ## Sets a way to define maximum angular deflection of mesh from CAD model.
103 # @param theGeometricMesh is: DefaultGeom (0)) or BLSURF_GlobalSize (1))
104 def SetGeometricMesh(self, theGeometricMesh=DefaultGeom):
105 geometric_size_mode = theGeometricMesh
106 if self.Parameters().GetPhysicalMesh() == DefaultSize:
107 if geometric_size_mode == DefaultGeom:
108 geometric_size_mode = BLSURF_GlobalSize
109 self.Parameters().SetGeometricMesh(geometric_size_mode)
112 ## Sets size of mesh elements to generate.
113 # @param theVal : constant global size when using a global physical size.
114 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
115 def SetPhySize(self, theVal, isRelative = False):
116 if self.Parameters().GetPhysicalMesh() == DefaultSize:
117 self.SetPhysicalMesh(BLSURF_GlobalSize)
119 self.Parameters().SetPhySizeRel(theVal)
121 self.Parameters().SetPhySize(theVal)
124 ## Sets lower boundary of mesh element size.
125 # @param theVal : global minimal cell size desired.
126 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
127 def SetMinSize(self, theVal=-1, isRelative = False):
129 self.Parameters().SetMinSizeRel(theVal)
131 self.Parameters().SetMinSize(theVal)
134 ## Sets upper boundary of mesh element size.
135 # @param theVal : global maximal cell size desired.
136 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
137 def SetMaxSize(self, theVal=-1, isRelative = False):
139 self.Parameters().SetMaxSizeRel(theVal)
141 self.Parameters().SetMaxSize(theVal)
144 ## Sets angular deflection (in degrees) from CAD surface.
145 # @param theVal value of angular deflection
146 def SetAngleMesh(self, theVal=_geometric_approximation):
147 if self.Parameters().GetGeometricMesh() == DefaultGeom:
148 self.SetGeometricMesh(BLSURF_GlobalSize)
149 self.Parameters().SetAngleMesh(theVal)
152 ## Sets maximal allowed ratio between the lengths of two adjacent edges.
153 # @param theVal value of maximal length ratio
154 def SetGradation(self, theVal=_gradation):
155 if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
156 self.Parameters().SetGradation(theVal)
159 ## Sets topology usage way.
160 # @param way defines how mesh conformity is assured <ul>
161 # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
162 # <li>PreProcess or PreProcessPlus - by pre-processing a CAD model (OBSOLETE: FromCAD will be used)</li>
163 # <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
164 def SetTopology(self, way):
166 print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
168 self.Parameters().SetTopology(way)
171 ## To respect geometrical edges or not.
172 # @param toIgnoreEdges "ignore edges" flag value
173 def SetDecimesh(self, toIgnoreEdges=False):
175 self.SetOptionValue("respect_geometry","0")
177 self.SetOptionValue("respect_geometry","1")
180 ## Sets verbosity level in the range 0 to 100.
181 # @param level verbosity level
182 def SetVerbosity(self, level):
183 self.Parameters().SetVerbosity(level)
186 ## To optimize merges edges.
187 # @param toMergeEdges "merge edges" flag value
188 def SetPreCADMergeEdges(self, toMergeEdges=False):
189 if self.Parameters().GetTopology() != PreCAD:
190 self.SetTopology(PreCAD)
191 self.Parameters().SetPreCADMergeEdges(toMergeEdges)
194 ## To process 3D topology.
195 # @param toProcess "PreCAD process 3D" flag value
196 def SetPreCADProcess3DTopology(self, toProcess=False):
197 if self.Parameters().GetTopology() != PreCAD:
198 self.SetTopology(PreCAD)
199 self.Parameters().SetPreCADProcess3DTopology(toProcess)
202 ## To remove nano edges.
203 # @param toRemoveNanoEdges "remove nano edges" flag value
204 def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False):
205 if toRemoveNanoEdges:
206 self.SetPreCADOptionValue("remove_tiny_edges","1")
208 self.SetPreCADOptionValue("remove_tiny_edges","0")
211 ## To compute topology from scratch
212 # @param toDiscardInput "discard input" flag value
213 def SetPreCADDiscardInput(self, toDiscardInput=False):
214 if self.Parameters().GetTopology() != PreCAD:
215 self.SetTopology(PreCAD)
216 self.Parameters().SetPreCADDiscardInput(toDiscardInput)
219 ## Sets the length below which an edge is considered as nano
220 # for the topology processing.
221 # @param epsNano nano edge length threshold value
222 def SetPreCADEpsNano(self, epsNano):
223 self.SetPreCADOptionValue("tiny_edge_length","%f"%epsNano)
226 ## Sets advanced option value.
227 # @param optionName advanced option name
228 # @param level advanced option value
229 def SetOptionValue(self, optionName, level):
230 self.Parameters().SetOptionValue(optionName,level)
233 ## Sets advanced PreCAD option value.
234 # @param optionName name of the option
235 # @param optionValue value of the option
236 def SetPreCADOptionValue(self, optionName, optionValue):
237 if self.Parameters().GetTopology() != PreCAD:
238 self.SetTopology(PreCAD)
239 self.Parameters().SetPreCADOptionValue(optionName,optionValue)
242 ## Sets GMF file for export at computation
243 # @param fileName GMF file name
244 def SetGMFFile(self, fileName):
245 self.Parameters().SetGMFFile(fileName)
248 #-----------------------------------------
249 # Enforced vertices (BLSURF)
250 #-----------------------------------------
252 ## To get all the enforced vertices
253 def GetAllEnforcedVertices(self):
254 return self.Parameters().GetAllEnforcedVertices()
256 ## To get all the enforced vertices sorted by face (or group, compound)
257 def GetAllEnforcedVerticesByFace(self):
258 return self.Parameters().GetAllEnforcedVerticesByFace()
260 ## To get all the enforced vertices sorted by coords of input vertices
261 def GetAllEnforcedVerticesByCoords(self):
262 return self.Parameters().GetAllEnforcedVerticesByCoords()
264 ## To get all the coords of input vertices sorted by face (or group, compound)
265 def GetAllCoordsByFace(self):
266 return self.Parameters().GetAllCoordsByFace()
268 ## To get all the enforced vertices on a face (or group, compound)
269 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
270 def GetEnforcedVertices(self, theFace):
271 from salome.smesh.smeshBuilder import AssureGeomPublished
272 AssureGeomPublished( self.mesh, theFace )
273 return self.Parameters().GetEnforcedVertices(theFace)
275 ## To clear all the enforced vertices
276 def ClearAllEnforcedVertices(self):
277 return self.Parameters().ClearAllEnforcedVertices()
279 ## To set an enforced vertex on a face (or group, compound) given the coordinates of a point. If the point is not on the face, it will projected on it. If there is no projection, no enforced vertex is created.
280 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
281 # @param x : x coordinate
282 # @param y : y coordinate
283 # @param z : z coordinate
284 # @param vertexName : name of the enforced vertex
285 # @param groupName : name of the group
286 def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""):
287 from salome.smesh.smeshBuilder import AssureGeomPublished
288 AssureGeomPublished( self.mesh, theFace )
291 return self.Parameters().SetEnforcedVertex(theFace, x, y, z)
293 return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName)
297 return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName)
299 return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName)
303 ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound.
304 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
305 # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
306 # @param groupName : name of the group
307 def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""):
308 from salome.smesh.smeshBuilder import AssureGeomPublished
309 AssureGeomPublished( self.mesh, theFace )
310 AssureGeomPublished( self.mesh, theVertex )
312 return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex)
314 return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName)
317 ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates.
318 # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
319 # @param x : x coordinate
320 # @param y : y coordinate
321 # @param z : z coordinate
322 def UnsetEnforcedVertex(self, theFace, x, y, z):
323 from salome.smesh.smeshBuilder import AssureGeomPublished
324 AssureGeomPublished( self.mesh, theFace )
325 return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z)
327 ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound.
328 # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
329 # @param theVertex : GEOM vertex (or group, compound) to remove.
330 def UnsetEnforcedVertexGeom(self, theFace, theVertex):
331 from salome.smesh.smeshBuilder import AssureGeomPublished
332 AssureGeomPublished( self.mesh, theFace )
333 AssureGeomPublished( self.mesh, theVertex )
334 return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex)
336 ## To remove all enforced vertices on a given face.
337 # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices
338 def UnsetEnforcedVertices(self, theFace):
339 from salome.smesh.smeshBuilder import AssureGeomPublished
340 AssureGeomPublished( self.mesh, theFace )
341 return self.Parameters().UnsetEnforcedVertices(theFace)
343 ## To tell BLSURF to add a node on internal vertices
344 # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices
345 def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices):
346 return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices)
348 ## To know if BLSURF will add a node on internal vertices
349 def GetInternalEnforcedVertexAllFaces(self):
350 return self.Parameters().GetInternalEnforcedVertexAllFaces()
352 ## To define a group for the nodes of internal vertices
353 # @param groupName : string; name of the group
354 def SetInternalEnforcedVertexAllFacesGroup(self, groupName):
355 return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName)
357 ## To get the group name of the nodes of internal vertices
358 def GetInternalEnforcedVertexAllFacesGroup(self):
359 return self.Parameters().GetInternalEnforcedVertexAllFacesGroup()
361 #-----------------------------------------
363 #-----------------------------------------
365 ## Sets an attractor on the chosen face. The mesh size will decrease exponentially with the distance from theAttractor, following the rule h(d) = theEndSize - (theEndSize - theStartSize) * exp [ - ( d / theInfluenceDistance ) ^ 2 ]
366 # @param theFace : face on which the attractor will be defined
367 # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially
368 # @param theStartSize : mesh size on theAttractor
369 # @param theEndSize : maximum size that will be reached on theFace
370 # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high)
371 # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace
372 def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance):
373 from salome.smesh.smeshBuilder import AssureGeomPublished
374 AssureGeomPublished( self.mesh, theFace )
375 AssureGeomPublished( self.mesh, theAttractor )
376 self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance)
379 ## Unsets an attractor on the chosen face.
380 # @param theFace : face on which the attractor has to be removed
381 def UnsetAttractorGeom(self, theFace):
382 from salome.smesh.smeshBuilder import AssureGeomPublished
383 AssureGeomPublished( self.mesh, theFace )
384 self.Parameters().SetAttractorGeom(theFace)
387 #-----------------------------------------
389 #-----------------------------------------
391 ## To set a size map on a face, edge or vertex (or group, compound) given Python function.
392 # If theObject is a face, the function can be: def f(u,v): return u+v
393 # If theObject is an edge, the function can be: def f(t): return t/2
394 # If theObject is a vertex, the function can be: def f(): return 10
395 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
396 # @param theSizeMap : Size map defined as a string
397 def SetSizeMap(self, theObject, theSizeMap):
398 from salome.smesh.smeshBuilder import AssureGeomPublished
399 AssureGeomPublished( self.mesh, theObject )
400 self.Parameters().SetSizeMap(theObject, theSizeMap)
403 ## To set a constant size map on a face, edge or vertex (or group, compound).
404 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
405 # @param theSizeMap : Size map defined as a double
406 def SetConstantSizeMap(self, theObject, theSizeMap):
407 from salome.smesh.smeshBuilder import AssureGeomPublished
408 AssureGeomPublished( self.mesh, theObject )
409 self.Parameters().SetConstantSizeMap(theObject, theSizeMap)
411 ## To remove a size map defined on a face, edge or vertex (or group, compound)
412 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
413 def UnsetSizeMap(self, theObject):
414 from salome.smesh.smeshBuilder import AssureGeomPublished
415 AssureGeomPublished( self.mesh, theObject )
416 self.Parameters().UnsetSizeMap(theObject)
419 ## To remove all the size maps
420 def ClearSizeMaps(self):
421 self.Parameters().ClearSizeMaps()
424 ## Sets QuadAllowed flag.
425 # @param toAllow "allow quadrangles" flag value
426 def SetQuadAllowed(self, toAllow=True):
427 self.Parameters().SetQuadAllowed(toAllow)
430 ## Defines hypothesis having several parameters
431 # @return hypothesis object
432 def Parameters(self):
434 self.params = self.Hypothesis("MG_CADSurf_Parameters", [],
435 "libBLSURFEngine.so", UseExisting=0)
439 #-----------------------------------------
440 # Periodicity (BLSURF with PreCAD)
441 #-----------------------------------------
443 ## Defines periodicity between two groups of faces, using PreCAD
444 # @param theFace1 : GEOM face (or group, compound) to associate with theFace2
445 # @param theFace2 : GEOM face (or group, compound) associated with theFace1
446 # @param theSourceVertices (optionnal): list of GEOM vertices on theFace1 defining the transformation from theFace1 to theFace2.
447 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
448 # @param theTargetVertices (optionnal): list of GEOM vertices on theFace2 defining the transformation from theFace1 to theFace2.
449 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
450 def AddPreCadFacesPeriodicity(self, theFace1, theFace2, theSourceVertices=[], theTargetVertices=[]):
451 """calls preCad function:
452 status_t cad_add_face_multiple_periodicity_with_transformation_function(cad t *cad,
453 integer *fid1, integer size1, integer *fid2, integer size2,
454 periodicity_transformation_t transf, void *user data);
456 if theSourceVertices and theTargetVertices:
457 self.Parameters().AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices)
459 self.Parameters().AddPreCadFacesPeriodicity(theFace1, theFace2)
462 ## Defines periodicity between two groups of edges, using PreCAD
463 # @param theEdge1 : GEOM edge (or group, compound) to associate with theEdge2
464 # @param theEdge2 : GEOM edge (or group, compound) associated with theEdge1
465 # @param theSourceVertices (optionnal): list of GEOM vertices on theEdge1 defining the transformation from theEdge1 to theEdge2.
466 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
467 # @param theTargetVertices (optionnal): list of GEOM vertices on theEdge2 defining the transformation from theEdge1 to theEdge2.
468 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
469 def AddPreCadEdgesPeriodicity(self, theEdge1, theEdge2, theSourceVertices=[], theTargetVertices=[]):
470 """calls preCad function:
471 status_t cad_add_edge_multiple_periodicity_with_transformation_function(cad t *cad,
472 integer *eid1, integer size1, integer *eid2, integer size2,
473 periodicity_transformation_t transf, void *user data);
475 if theSourceVertices and theTargetVertices:
476 self.Parameters().AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices)
478 self.Parameters().AddPreCadEdgesPeriodicity(theEdge1, theEdge2)
482 #-----------------------------------------
483 # Periodicity (BLSURF without PreCAD)
484 #-----------------------------------------
487 ## Defines periodicity between two faces, without using PreCAD.
488 # User has to call AddEdgePeriodicity with the edges of the face,
489 # and AddVertexPeriodicity with the vertices of each edge.
490 # @param theFace1 : GEOM face to associate with theFace2
491 # @param theFace2 : GEOM face associated with theFace1
492 def AddFacePeriodicity(self, theFace1, theFace2):
493 self.Parameters().AddFacePeriodicity(theFace1, theFace2)
496 ## Defines periodicity between two edges belonging to two periodic faces, without using PreCAD.
497 # To be used with AddFacePeriodicity.
498 # User has to call AddVertexPeriodicity with the vertices of each edge
499 # @param theFace1 : GEOM face to associate with theFace2
500 # @param theEdge1 : GEOM edge to associate with theEdge2
501 # @param theFace2 : GEOM face associated with theFace1
502 # @param theEdge2 : GEOM edge associated with theEdge1
503 # @param theEdgeOrientation : -1 (reversed), 0 (unknown) or 1 (forward)
504 def AddEdgePeriodicity(self, theFace1, theEdge1, theFace2, theEdge2, theEdgeOrientation=0):
505 self.Parameters().AddEdgePeriodicity(theFace1, theEdge1, theFace2, theEdge2, theEdgeOrientation)
508 ## Defines periodicity between two edges without face periodicity, without using PreCAD.
509 # User has to call AddVertexPeriodicity with the vertices of each edge.
510 # @param theEdge1 : GEOM edge to associate with theEdge2
511 # @param theEdge2 : GEOM edge associated with theEdge1
512 # @param theEdgeOrientation : -1 (reversed), 0 (unknown) or 1 (forward)
513 def AddEdgePeriodicityWithoutFaces(self, theEdge1, theEdge2, theEdgeOrientation=0):
514 self.Parameters().AddEdgePeriodicityWithoutFaces(theEdge1, theEdge2, theEdgeOrientation)
517 ## Defines periodicity between two vertices.
518 # To be used with AddFacePeriodicity and AddEdgePeriodicity.
519 # @param theEdge1 : GEOM edge to associate with theEdge2
520 # @param theVertex1 : GEOM face to associate with theVertex2
521 # @param theEdge2 : GEOM edge associated with theEdge1
522 # @param theVertex2 : GEOM face associated with theVertex1
523 def AddVertexPeriodicity(self, theEdge1, theVertex1, theEdge2, theVertex2):
524 self.Parameters().AddVertexPeriodicity(theEdge1, theVertex1, theEdge2, theVertex2)
527 ## Define periodicity between two groups of faces, given a transformation function.
528 # This uses the basic BLSURF API for each face, each edge, and each vertex.
529 # @param theFace1 : GEOM face (or group, compound) to associate with theFace2
530 # @param theFace2 : GEOM face (or group, compound) associated with theFace1
531 # @param f_transf : python function defining the transformation between an object of theFace1
532 # into an object of theFace2
533 def AddAdvancedFacesPeriodicity(self, theFace1, theFace2, f_transf):
534 source_faces = self.geompyD.SubShapeAll(theFace1, self.geompyD.ShapeType["FACE"])
538 for source_face in source_faces:
539 self.geompyD.addToStudyInFather(theFace1, source_face, "source_face_%i"%i)
540 p_source = self.geompyD.MakeVertexInsideFace(source_face)
541 p_target = f_transf(p_source)
542 target_face = self.geompyD.GetFaceNearPoint(theFace2, p_target)
543 self.geompyD.addToStudyInFather(theFace2, target_face, "target_face_%i"%i)
544 self.AddFacePeriodicity(source_face, target_face)
547 source_edges = self.geompyD.SubShapeAll(source_face, self.geompyD.ShapeType["EDGE"])
548 for source_edge in source_edges:
549 self.geompyD.addToStudyInFather(theFace1, source_edge, "source_edge_%i"%(j))
550 p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
551 p_target = f_transf(p_source)
552 target_edge = self.geompyD.GetEdgeNearPoint(theFace2, p_target)
553 self.geompyD.addToStudyInFather(theFace2, target_edge, "target_edge_%i"%(j))
554 self.AddEdgePeriodicity(source_face, source_edge, target_face, target_edge, 1)
557 source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
558 for source_vertex in source_vertices:
559 self.geompyD.addToStudyInFather(theFace1, source_vertex, "source_vertex_%i"%(k))
560 target_vertex_tmp = f_transf(source_vertex)
561 target_vertex = self.geompyD.GetSame(theFace2, target_vertex_tmp)
562 self.geompyD.addToStudyInFather(theFace2, target_vertex, "target_vertex_%i"%(k))
563 self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
567 ## Define periodicity between two groups of edges, without faces, given a transformation function.
568 # This uses the basic BLSURF API for each edge and each vertex.
569 # @param theFace1 : GEOM edge (or group, compound) to associate with theEdge2
570 # @param theFace2 : GEOM edge (or group, compound) associated with theEdge1
571 # @param f_transf : python function defining the transformation between an object of theEdge1
572 # into an object of theFace2
573 def AddAdvancedEdgesPeriodicity(self, theEdge1, theEdge2, f_transf):
574 source_edges = self.geompyD.SubShapeAll(theEdge1, self.geompyD.ShapeType["EDGE"])
577 for source_edge in source_edges:
578 self.geompyD.addToStudyInFather(theEdge1, source_edge, "source_edge_%i"%j)
579 p_source = self.geompyD.MakeVertexOnCurve(source_edge, 0.5)
580 p_target = f_transf(p_source)
581 target_edge = self.geompyD.GetEdgeNearPoint(theEdge2, p_target)
582 self.geompyD.addToStudyInFather(theEdge2, target_edge, "target_edge_%i"%j)
583 self.AddEdgePeriodicityWithoutFaces(source_edge, target_edge)
587 source_vertices = self.geompyD.SubShapeAll(source_edge, self.geompyD.ShapeType["VERTEX"])
588 for source_vertex in source_vertices:
589 self.geompyD.addToStudyInFather(theEdge1, source_vertex, "source_vertex_%i"%k)
590 target_vertex_tmp = f_transf(source_vertex)
591 target_vertex = self.geompyD.GetSame(theEdge2, target_vertex_tmp)
592 self.geompyD.addToStudyInFather(theEdge2, target_vertex, "target_vertex_%i"%k)
593 self.AddVertexPeriodicity(source_edge, source_vertex, target_edge, target_vertex)
598 #=====================
600 #=====================
605 ## Sets lower boundary of mesh element size (PhySize).
606 def SetPhyMin(self, theVal=-1):
608 Obsolete function. Use SetMinSize.
610 print "Warning: SetPhyMin is obsolete. Please use SetMinSize"
611 self.SetMinSize(theVal)
614 ## Sets upper boundary of mesh element size (PhySize).
615 def SetPhyMax(self, theVal=-1):
617 Obsolete function. Use SetMaxSize.
619 print "Warning: SetPhyMax is obsolete. Please use SetMaxSize"
620 self.SetMaxSize(theVal)
623 ## Sets angular deflection (in degrees) of a mesh face from CAD surface.
624 def SetAngleMeshS(self, theVal=_geometric_approximation):
626 Obsolete function. Use SetAngleMesh.
628 print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh"
629 self.SetAngleMesh(theVal)
632 ## Sets angular deflection (in degrees) of a mesh edge from CAD curve.
633 def SetAngleMeshC(self, theVal=_geometric_approximation):
635 Obsolete function. Use SetAngleMesh.
637 print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh"
638 self.SetAngleMesh(theVal)
641 ## Sets lower boundary of mesh element size computed to respect angular deflection.
642 def SetGeoMin(self, theVal=-1):
644 Obsolete function. Use SetMinSize.
646 print "Warning: SetGeoMin is obsolete. Please use SetMinSize"
647 self.SetMinSize(theVal)
650 ## Sets upper boundary of mesh element size computed to respect angular deflection.
651 def SetGeoMax(self, theVal=-1):
653 Obsolete function. Use SetMaxSize.
655 print "Warning: SetGeoMax is obsolete. Please use SetMaxSize"
656 self.SetMaxSize(theVal)
660 pass # end of BLSURF_Algorithm class