1 # Copyright (C) 2007-2016 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 MG-CADSurf meshing plug-in module.
24 from salome.smesh.smesh_algorithm import Mesh_Algorithm
26 LIBRARY = "libBLSURFEngine.so"
28 # Topology treatment way of MG-CADSurf
29 FromCAD, PreProcess, PreProcessPlus, PreCAD = 0,1,2,3
31 # Element size flag of MG-CADSurf
32 DefaultSize, DefaultGeom, MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize = 0,0,1,2
34 MG_CADSURF_Custom, SizeMap = MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize
35 BLSURF_Custom, BLSURF_GlobalSize, BLSURF_LocalSize = MG_CADSURF_Custom, MG_CADSURF_GlobalSize, MG_CADSURF_LocalSize
37 # import BLSURFPlugin module if possible
45 #----------------------------
46 # Mesh algo type identifiers
47 #----------------------------
49 ## Algorithm type: MG-CADSurf triangle algorithm, see BLSURF_Algorithm
50 MG_CADSurf = "MG-CADSurf"
53 #----------------------
55 #----------------------
57 ## MG-CADSurf 2D algorithm.
59 # It can be created by calling smeshBuilder.Mesh.Triangle(smeshBuilder.MG-CADSurf,geom=0)
61 class BLSURF_Algorithm(Mesh_Algorithm):
63 ## name of the dynamic method in smeshBuilder.Mesh class
65 meshMethod = "Triangle"
66 ## type of algorithm used with helper function in smeshBuilder.Mesh class
69 ## doc string of the method
71 docHelper = "Creates triangle algorithm for faces"
73 _anisotropic_ratio = 0
74 _bad_surface_element_aspect_ratio = 1000
75 _geometric_approximation = 22
79 _remove_tiny_edges = 0
81 ## Private constructor.
82 # @param mesh parent mesh object algorithm is assigned to
83 # @param geom geometry (shape/sub-shape) algorithm is assigned to;
84 # if it is @c 0 (default), the algorithm is assigned to the main shape
85 def __init__(self, mesh, geom=0):
86 Mesh_Algorithm.__init__(self)
88 print "Warning: BLSURFPlugin module unavailable"
89 self.Create(mesh, geom, BLSURF, LIBRARY)
91 self.geompyD = mesh.geompyD
92 #self.SetPhysicalMesh() - PAL19680
95 ## Sets a way to define size of mesh elements to generate.
96 # @param thePhysicalMesh is: DefaultSize, MG_CADSURF_Custom or SizeMap.
97 def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
98 physical_size_mode = thePhysicalMesh
99 if self.Parameters().GetGeometricMesh() == DefaultGeom:
100 if physical_size_mode == DefaultSize:
101 physical_size_mode = MG_CADSURF_GlobalSize
102 self.Parameters().SetPhysicalMesh(physical_size_mode)
105 ## Sets a way to define maximum angular deflection of mesh from CAD model.
106 # @param theGeometricMesh is: DefaultGeom (0)) or MG_CADSURF_GlobalSize (1))
107 def SetGeometricMesh(self, theGeometricMesh=DefaultGeom):
108 geometric_size_mode = theGeometricMesh
109 if self.Parameters().GetPhysicalMesh() == DefaultSize:
110 if geometric_size_mode == DefaultGeom:
111 geometric_size_mode = MG_CADSURF_GlobalSize
112 self.Parameters().SetGeometricMesh(geometric_size_mode)
115 ## Sets size of mesh elements to generate.
116 # @param theVal : constant global size when using a global physical size.
117 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
118 def SetPhySize(self, theVal, isRelative = False):
119 if self.Parameters().GetPhysicalMesh() == DefaultSize:
120 self.SetPhysicalMesh(MG_CADSURF_GlobalSize)
122 self.Parameters().SetPhySizeRel(theVal)
124 self.Parameters().SetPhySize(theVal)
127 ## Sets lower boundary of mesh element size.
128 # @param theVal : global minimal cell size desired.
129 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
130 def SetMinSize(self, theVal=-1, isRelative = False):
132 self.Parameters().SetMinSizeRel(theVal)
134 self.Parameters().SetMinSize(theVal)
137 ## Sets upper boundary of mesh element size.
138 # @param theVal : global maximal cell size desired.
139 # @param isRelative : if True, the value is relative to the length of the diagonal of the bounding box
140 def SetMaxSize(self, theVal=-1, isRelative = False):
142 self.Parameters().SetMaxSizeRel(theVal)
144 self.Parameters().SetMaxSize(theVal)
147 ## Sets angular deflection (in degrees) from CAD surface.
148 # @param theVal value of angular deflection
149 def SetAngleMesh(self, theVal=_geometric_approximation):
150 if self.Parameters().GetGeometricMesh() == DefaultGeom:
151 self.SetGeometricMesh(MG_CADSURF_GlobalSize)
152 self.Parameters().SetAngleMesh(theVal)
155 ## Sets the maximum desired distance between a triangle and its supporting CAD surface
156 # @param distance the distance between a triangle and a surface
157 def SetChordalError(self, distance):
158 self.Parameters().SetChordalError(distance)
161 ## Sets maximal allowed ratio between the lengths of two adjacent edges.
162 # @param toUseGradation to use gradation
163 # @param theVal value of maximal length ratio
164 def SetGradation(self, toUseGradation=True, theVal=_gradation):
165 if isinstance( toUseGradation, float ): ## backward compatibility
166 toUseGradation, theVal = True, toUseGradation
167 if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
168 self.Parameters().SetUseGradation(toUseGradation)
169 self.Parameters().SetGradation(theVal)
172 ## Sets maximal allowed ratio between the lengths of two adjacent edges in 3D mesh.
173 # @param toUseGradation to use gradation
174 # @param theVal value of maximal length ratio
175 def SetVolumeGradation(self, toUseGradation=True, theVal=_gradation):
176 if self.Parameters().GetGeometricMesh() == 0: theVal = self._volume_gradation
177 self.Parameters().SetUseVolumeGradation(toUseGradation)
178 self.Parameters().SetVolumeGradation(theVal)
181 ## Sets topology usage way.
182 # @param way defines how mesh conformity is assured <ul>
183 # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
184 # <li>PreProcess or PreProcessPlus - by pre-processing a CAD model (OBSOLETE: FromCAD will be used)</li>
185 # <li>PreCAD - by pre-processing with PreCAD a CAD model</li></ul>
186 def SetTopology(self, way):
187 if way != PreCAD and way != FromCAD:
188 print "Warning: topology mode %d is no longer supported. Mode FromCAD is used."%way
190 self.Parameters().SetTopology(way)
193 ## To respect geometrical edges or not.
194 # @param toIgnoreEdges "ignore edges" flag value
195 def SetDecimesh(self, toIgnoreEdges=False):
197 self.SetOptionValue("respect_geometry","0")
199 self.SetOptionValue("respect_geometry","1")
202 ## Sets verbosity level in the range 0 to 100.
203 # @param level verbosity level
204 def SetVerbosity(self, level):
205 self.Parameters().SetVerbosity(level)
208 ## Set enforce_cad_edge_sizes parameter
210 # Relaxes the given sizemap constraint around CAD edges to allow a better
211 # element quality and a better geometric approximation. It is only useful in
212 # combination with the gradation option.
214 def SetEnforceCadEdgesSize( self, toEnforce ):
215 self.Parameters().SetEnforceCadEdgesSize( toEnforce )
217 ## Set jacobian_rectification_respect_geometry parameter
219 # While making the mesh quadratic, allows to lose the CAD-mesh associativity in order
220 # to correct elements with nagative Jacobian
222 def SetJacobianRectificationRespectGeometry( self, allowRectification ):
223 self.Parameters().SetJacobianRectificationRespectGeometry( allowRectification )
225 ## Set rectify_jacobian parameter
227 # While making the mesh quadratic, allow to fix nagative Jacobian surface elements
229 def SetJacobianRectification( self, allowRectification ):
230 self.Parameters().SetJacobianRectification( allowRectification )
232 ## Set respect_geometry parameter
234 # This patch independent option can be deactivated to allow MeshGems-CADSurf
235 # to lower the geometry accuracy in its patch independent process.
237 def SetRespectGeometry( self, toRespect ):
238 self.Parameters().SetRespectGeometry( toRespect )
240 ## Set max_number_of_points_per_patch parameter
242 # This parameter controls the maximum amount of points MeshGems-CADSurf is allowed
243 # to generate on a single CAD patch. For an automatic gestion of the memory, one
244 # can set this parameter to 0
246 def SetMaxNumberOfPointsPerPatch( self, nb ):
247 self.Parameters().SetMaxNumberOfPointsPerPatch( nb )
249 ## Set respect_geometry parameter
251 # This patch independent option can be deactivated to allow MeshGems-CADSurf
252 # to lower the geometry accuracy in its patch independent process.
254 def SetRespectGeometry( self, toRespect ):
255 self.Parameters().SetRespectGeometry( toRespect )
257 ## Set tiny_edges_avoid_surface_intersections parameter
259 # This option defines the priority between the tiny feature
260 # suppression and the surface intersection prevention.
262 def SetTinyEdgesAvoidSurfaceIntersections( self, toAvoidIntersection ):
263 self.Parameters().SetTinyEdgesAvoidSurfaceIntersections( toAvoidIntersection )
265 ## Set closed_geometry parameter parameter
267 # Describes whether the geometry is expected to be closed or not.
268 # When activated, this option helps MeshGems-PreCAD to treat the dirtiest geometries.
270 def SetClosedGeometry( self, isClosed ):
271 self.Parameters().SetClosedGeometry( isClosed )
273 ## Set debug parameter
275 # Make MeshGems-CADSurf will be very verbose and will output some intermediate
276 # files in the working directory. This option is mainly meant for Distene support issues.
278 def SetDebug( self, isDebug ):
279 self.Parameters().SetDebug( isDebug )
281 ## Set periodic_tolerance parameter
283 # This parameter defines the maximum size difference between two periodic edges
284 # and also the maximum distance error between two periodic entities.
286 def SetPeriodicTolerance( self, tol ):
287 self.Parameters().SetPeriodicTolerance( tol )
289 ## Set required_entities parameter
291 # The required entities control the correction operations.
292 # Accepted values for this parameter are :
293 # - "respect" : MeshGems-CADSurf is not allowed to alter any required entity,
294 # even for correction purposes,
295 # - "ignore" : MeshGems-CADSurf will ignore the required entities in its processing,
296 # - "clear" : MeshGems-CADSurf will clear any required status for the entities.
297 # There will not be any entity marked as required in the generated mesh.
299 def SetRequiredEntities( self, howToTreat ):
300 self.Parameters().SetRequiredEntities( howToTreat )
302 ## Set sewing_tolerance parameter
304 # This parameter is the tolerance of the assembly.
306 def SetSewingTolerance( self, tol ):
307 self.Parameters().SetSewingTolerance( tol )
309 ## Set tags parameter
311 # The tag (attribute) system controls the optimisation process.
312 # Accepted values for this parameter are :
313 # - "respect" : the CAD tags will be preserved and unaltered by the optimisation operations,
314 # - "ignore" : the CAD tags will be ignored by the optimisation operations
315 # but they will still be present in the output mesh,
316 # - "clear" : MeshGems-CADSurf will clear any tag on any entity and optimise accordingly.
317 # There will not be any tag in the generated mesh.
319 def SetTags( self, howToTreat ):
320 self.Parameters().SetTags( howToTreat )
322 ## Activate removal of the tiny edges from the generated
323 # mesh when it improves the local mesh quality, without taking into account the
324 # tags (attributes) specifications.
325 # @param toOptimise "to optimize" flag value
326 # @param length minimal length under which an edge is considered to be a tiny
327 def SetOptimiseTinyEdges(self, toOptimise, length=-1):
328 self.Parameters().SetOptimiseTinyEdges( toOptimise )
330 self.Parameters().SetTinyEdgeOptimisationLength( length )
332 ## Activate correction of all surface intersections
333 # @param toCorrect "to correct" flag value
334 # @param maxCost the time the user is ready to spend in the intersection prevention process
335 # For example, maxCost = 3 means that MeshGems-CADSurf will not spend more time
336 # in the intersection removal process than 3 times the time required to mesh
337 # without processing the intersections.
338 def SetCorrectSurfaceIntersection(self, toCorrect, maxCost ):
339 self.Parameters().SetCorrectSurfaceIntersection( toCorrect )
341 self.Parameters().SetCorrectSurfaceIntersectionMaxCost( maxCost )
343 ## To optimize merges edges.
344 # @param toMergeEdges "merge edges" flag value
345 def SetPreCADMergeEdges(self, toMergeEdges=False):
346 self.Parameters().SetPreCADMergeEdges(toMergeEdges)
349 ## To remove tiny UV edges.
350 # @param toRemoveTinyUVEdges "remove_tiny_uv_edges" flag value
351 def SetPreCADRemoveTinyUVEdges(self, toRemoveTinyUVEdges=False):
352 self.Parameters().SetPreCADRemoveTinyUVEdges(toRemoveTinyUVEdges)
355 ## To remove duplicate CAD Faces
356 # @param toRemoveDuplicateCADFaces "remove_duplicate_cad_faces" flag value
357 def SetPreCADRemoveDuplicateCADFaces(self, toRemoveDuplicateCADFaces=False):
358 self.Parameters().SetPreCADRemoveDuplicateCADFaces(toRemoveDuplicateCADFaces)
361 ## To process 3D topology.
362 # @param toProcess "PreCAD process 3D" flag value
363 def SetPreCADProcess3DTopology(self, toProcess=False):
364 self.Parameters().SetPreCADProcess3DTopology(toProcess)
367 ## To remove nano edges.
368 # @param toRemoveNanoEdges "remove nano edges" flag value
369 def SetPreCADRemoveNanoEdges(self, toRemoveNanoEdges=False):
370 if toRemoveNanoEdges:
371 self.SetPreCADOptionValue("remove_tiny_edges","1")
373 self.SetPreCADOptionValue("remove_tiny_edges","0")
376 ## To compute topology from scratch
377 # @param toDiscardInput "discard input" flag value
378 def SetPreCADDiscardInput(self, toDiscardInput=False):
379 self.Parameters().SetPreCADDiscardInput(toDiscardInput)
382 ## Sets the length below which an edge is considered as nano
383 # for the topology processing.
384 # @param epsNano nano edge length threshold value
385 def SetPreCADEpsNano(self, epsNano):
386 self.SetPreCADOptionValue("tiny_edge_length","%f"%epsNano)
389 ## Sets advanced option value.
390 # @param optionName advanced option name
391 # @param level advanced option value
392 def SetOptionValue(self, optionName, level):
393 self.Parameters().SetOptionValue(optionName,level)
396 ## Sets advanced PreCAD option value.
397 # @param optionName name of the option
398 # @param optionValue value of the option
399 def SetPreCADOptionValue(self, optionName, optionValue):
400 self.Parameters().SetPreCADOptionValue(optionName,optionValue)
403 ## Adds custom advanced option values
404 # @param optionsAndValues options and values in a form "option_1 v1 option_2 v2'"
405 def SetAdvancedOption(self, optionsAndValues):
406 self.Parameters().SetAdvancedOption(optionsAndValues)
409 ## Adds custom advanced option value.
410 # @param optionName custom advanced option name
411 # @param level custom advanced option value
412 def AddOption(self, optionName, level):
413 self.Parameters().AddOption(optionName,level)
416 ## Adds custom advanced PreCAD option value.
417 # @param optionName custom name of the option
418 # @param optionValue value of the option
419 def AddPreCADOption(self, optionName, optionValue):
420 self.Parameters().AddPreCADOption(optionName,optionValue)
423 ## Sets GMF file for export at computation
424 # @param fileName GMF file name
425 def SetGMFFile(self, fileName):
426 self.Parameters().SetGMFFile(fileName)
429 #-----------------------------------------
430 # Enforced vertices (BLSURF)
431 #-----------------------------------------
433 ## To get all the enforced vertices
434 def GetAllEnforcedVertices(self):
435 return self.Parameters().GetAllEnforcedVertices()
437 ## To get all the enforced vertices sorted by face (or group, compound)
438 def GetAllEnforcedVerticesByFace(self):
439 return self.Parameters().GetAllEnforcedVerticesByFace()
441 ## To get all the enforced vertices sorted by coords of input vertices
442 def GetAllEnforcedVerticesByCoords(self):
443 return self.Parameters().GetAllEnforcedVerticesByCoords()
445 ## To get all the coords of input vertices sorted by face (or group, compound)
446 def GetAllCoordsByFace(self):
447 return self.Parameters().GetAllCoordsByFace()
449 ## To get all the enforced vertices on a face (or group, compound)
450 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
451 def GetEnforcedVertices(self, theFace):
452 from salome.smesh.smeshBuilder import AssureGeomPublished
453 AssureGeomPublished( self.mesh, theFace )
454 return self.Parameters().GetEnforcedVertices(theFace)
456 ## To clear all the enforced vertices
457 def ClearAllEnforcedVertices(self):
458 return self.Parameters().ClearAllEnforcedVertices()
460 ## 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.
461 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
462 # @param x : x coordinate
463 # @param y : y coordinate
464 # @param z : z coordinate
465 # @param vertexName : name of the enforced vertex
466 # @param groupName : name of the group
467 def SetEnforcedVertex(self, theFace, x, y, z, vertexName = "", groupName = ""):
468 from salome.smesh.smeshBuilder import AssureGeomPublished
469 AssureGeomPublished( self.mesh, theFace )
472 return self.Parameters().SetEnforcedVertex(theFace, x, y, z)
474 return self.Parameters().SetEnforcedVertexWithGroup(theFace, x, y, z, groupName)
478 return self.Parameters().SetEnforcedVertexNamed(theFace, x, y, z, vertexName)
480 return self.Parameters().SetEnforcedVertexNamedWithGroup(theFace, x, y, z, vertexName, groupName)
484 ## To set an enforced vertex on a face (or group, compound) given a GEOM vertex, group or compound.
485 # @param theFace : GEOM face (or group, compound) on which to define an enforced vertex
486 # @param theVertex : GEOM vertex (or group, compound) to be projected on theFace.
487 # @param groupName : name of the group
488 def SetEnforcedVertexGeom(self, theFace, theVertex, groupName = ""):
489 from salome.smesh.smeshBuilder import AssureGeomPublished
490 AssureGeomPublished( self.mesh, theFace )
491 AssureGeomPublished( self.mesh, theVertex )
493 return self.Parameters().SetEnforcedVertexGeom(theFace, theVertex)
495 return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName)
498 ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates.
499 # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
500 # @param x : x coordinate
501 # @param y : y coordinate
502 # @param z : z coordinate
503 def UnsetEnforcedVertex(self, theFace, x, y, z):
504 from salome.smesh.smeshBuilder import AssureGeomPublished
505 AssureGeomPublished( self.mesh, theFace )
506 return self.Parameters().UnsetEnforcedVertex(theFace, x, y, z)
508 ## To remove an enforced vertex on a given GEOM face (or group, compound) given a GEOM vertex, group or compound.
509 # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex
510 # @param theVertex : GEOM vertex (or group, compound) to remove.
511 def UnsetEnforcedVertexGeom(self, theFace, theVertex):
512 from salome.smesh.smeshBuilder import AssureGeomPublished
513 AssureGeomPublished( self.mesh, theFace )
514 AssureGeomPublished( self.mesh, theVertex )
515 return self.Parameters().UnsetEnforcedVertexGeom(theFace, theVertex)
517 ## To remove all enforced vertices on a given face.
518 # @param theFace : face (or group/compound of faces) on which to remove all enforced vertices
519 def UnsetEnforcedVertices(self, theFace):
520 from salome.smesh.smeshBuilder import AssureGeomPublished
521 AssureGeomPublished( self.mesh, theFace )
522 return self.Parameters().UnsetEnforcedVertices(theFace)
524 ## To tell BLSURF to add a node on internal vertices
525 # @param toEnforceInternalVertices : boolean; if True the internal vertices are added as enforced vertices
526 def SetInternalEnforcedVertexAllFaces(self, toEnforceInternalVertices):
527 return self.Parameters().SetInternalEnforcedVertexAllFaces(toEnforceInternalVertices)
529 ## To know if BLSURF will add a node on internal vertices
530 def GetInternalEnforcedVertexAllFaces(self):
531 return self.Parameters().GetInternalEnforcedVertexAllFaces()
533 ## To define a group for the nodes of internal vertices
534 # @param groupName : string; name of the group
535 def SetInternalEnforcedVertexAllFacesGroup(self, groupName):
536 return self.Parameters().SetInternalEnforcedVertexAllFacesGroup(groupName)
538 ## To get the group name of the nodes of internal vertices
539 def GetInternalEnforcedVertexAllFacesGroup(self):
540 return self.Parameters().GetInternalEnforcedVertexAllFacesGroup()
542 #-----------------------------------------
544 #-----------------------------------------
546 ## 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 ]
547 # @param theFace : face on which the attractor will be defined
548 # @param theAttractor : geometrical object from which the mesh size "h" decreases exponentially
549 # @param theStartSize : mesh size on theAttractor
550 # @param theEndSize : maximum size that will be reached on theFace
551 # @param theInfluenceDistance : influence of the attractor ( the size grow slower on theFace if it's high)
552 # @param theConstantSizeDistance : distance until which the mesh size will be kept constant on theFace
553 def SetAttractorGeom(self, theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance):
554 from salome.smesh.smeshBuilder import AssureGeomPublished
555 AssureGeomPublished( self.mesh, theFace )
556 AssureGeomPublished( self.mesh, theAttractor )
557 self.Parameters().SetAttractorGeom(theFace, theAttractor, theStartSize, theEndSize, theInfluenceDistance, theConstantSizeDistance)
560 ## Unsets an attractor on the chosen face.
561 # @param theFace : face on which the attractor has to be removed
562 def UnsetAttractorGeom(self, theFace):
563 from salome.smesh.smeshBuilder import AssureGeomPublished
564 AssureGeomPublished( self.mesh, theFace )
565 self.Parameters().SetAttractorGeom(theFace)
568 #-----------------------------------------
570 #-----------------------------------------
572 ## To set a size map on a face, edge or vertex (or group, compound) given Python function.
573 # If theObject is a face, the function can be: def f(u,v): return u+v
574 # If theObject is an edge, the function can be: def f(t): return t/2
575 # If theObject is a vertex, the function can be: def f(): return 10
576 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
577 # @param theSizeMap : Size map defined as a string
578 def SetSizeMap(self, theObject, theSizeMap):
579 from salome.smesh.smeshBuilder import AssureGeomPublished
580 AssureGeomPublished( self.mesh, theObject )
581 self.Parameters().SetSizeMap(theObject, theSizeMap)
584 ## To set a constant size map on a face, edge or vertex (or group, compound).
585 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
586 # @param theSizeMap : Size map defined as a double
587 def SetConstantSizeMap(self, theObject, theSizeMap):
588 from salome.smesh.smeshBuilder import AssureGeomPublished
589 AssureGeomPublished( self.mesh, theObject )
590 self.Parameters().SetConstantSizeMap(theObject, theSizeMap)
592 ## To remove a size map defined on a face, edge or vertex (or group, compound)
593 # @param theObject : GEOM face, edge or vertex (or group, compound) on which to define a size map
594 def UnsetSizeMap(self, theObject):
595 from salome.smesh.smeshBuilder import AssureGeomPublished
596 AssureGeomPublished( self.mesh, theObject )
597 self.Parameters().UnsetSizeMap(theObject)
600 ## To remove all the size maps
601 def ClearSizeMaps(self):
602 self.Parameters().ClearSizeMaps()
605 ## Sets QuadAllowed flag.
606 # @param toAllow "allow quadrangles" flag value
607 def SetQuadAllowed(self, toAllow=True):
608 self.Parameters().SetQuadAllowed(toAllow)
611 ## Defines hypothesis having several parameters
612 # @return hypothesis object
613 def Parameters(self):
615 self.params = self.Hypothesis("MG-CADSurf Parameters", [],
616 LIBRARY, UseExisting=0)
620 #-----------------------------------------
621 # Periodicity (BLSURF with PreCAD)
622 #-----------------------------------------
624 ## Defines periodicity between two groups of faces, using PreCAD
625 # @param theFace1 : GEOM face (or group, compound) to associate with theFace2
626 # @param theFace2 : GEOM face (or group, compound) associated with theFace1
627 # @param theSourceVertices (optionnal): list of GEOM vertices on theFace1 defining the transformation from theFace1 to theFace2.
628 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
629 # @param theTargetVertices (optionnal): list of GEOM vertices on theFace2 defining the transformation from theFace1 to theFace2.
630 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
631 def AddPreCadFacesPeriodicity(self, theFace1, theFace2, theSourceVertices=[], theTargetVertices=[]):
632 """calls preCad function:
633 status_t cad_add_face_multiple_periodicity_with_transformation_function(cad t *cad,
634 integer *fid1, integer size1, integer *fid2, integer size2,
635 periodicity_transformation_t transf, void *user data);
637 if theSourceVertices and theTargetVertices:
638 self.Parameters().AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices)
640 self.Parameters().AddPreCadFacesPeriodicity(theFace1, theFace2)
643 ## Defines periodicity between two groups of edges, using PreCAD
644 # @param theEdge1 : GEOM edge (or group, compound) to associate with theEdge2
645 # @param theEdge2 : GEOM edge (or group, compound) associated with theEdge1
646 # @param theSourceVertices (optionnal): list of GEOM vertices on theEdge1 defining the transformation from theEdge1 to theEdge2.
647 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
648 # @param theTargetVertices (optionnal): list of GEOM vertices on theEdge2 defining the transformation from theEdge1 to theEdge2.
649 # If None, PreCAD tries to find a simple translation. Else, need at least 3 not aligned vertices.
650 def AddPreCadEdgesPeriodicity(self, theEdge1, theEdge2, theSourceVertices=[], theTargetVertices=[]):
651 """calls preCad function:
652 status_t cad_add_edge_multiple_periodicity_with_transformation_function(cad t *cad,
653 integer *eid1, integer size1, integer *eid2, integer size2,
654 periodicity_transformation_t transf, void *user data);
656 if theSourceVertices and theTargetVertices:
657 self.Parameters().AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices)
659 self.Parameters().AddPreCadEdgesPeriodicity(theEdge1, theEdge2)
662 #=====================
664 #=====================
669 ## Sets lower boundary of mesh element size (PhySize).
670 def SetPhyMin(self, theVal=-1):
672 Obsolete function. Use SetMinSize.
674 print "Warning: SetPhyMin is obsolete. Please use SetMinSize"
675 self.SetMinSize(theVal)
678 ## Sets upper boundary of mesh element size (PhySize).
679 def SetPhyMax(self, theVal=-1):
681 Obsolete function. Use SetMaxSize.
683 print "Warning: SetPhyMax is obsolete. Please use SetMaxSize"
684 self.SetMaxSize(theVal)
687 ## Sets angular deflection (in degrees) of a mesh face from CAD surface.
688 def SetAngleMeshS(self, theVal=_geometric_approximation):
690 Obsolete function. Use SetAngleMesh.
692 print "Warning: SetAngleMeshS is obsolete. Please use SetAngleMesh"
693 self.SetAngleMesh(theVal)
696 ## Sets angular deflection (in degrees) of a mesh edge from CAD curve.
697 def SetAngleMeshC(self, theVal=_geometric_approximation):
699 Obsolete function. Use SetAngleMesh.
701 print "Warning: SetAngleMeshC is obsolete. Please use SetAngleMesh"
702 self.SetAngleMesh(theVal)
705 ## Sets lower boundary of mesh element size computed to respect angular deflection.
706 def SetGeoMin(self, theVal=-1):
708 Obsolete function. Use SetMinSize.
710 print "Warning: SetGeoMin is obsolete. Please use SetMinSize"
711 self.SetMinSize(theVal)
714 ## Sets upper boundary of mesh element size computed to respect angular deflection.
715 def SetGeoMax(self, theVal=-1):
717 Obsolete function. Use SetMaxSize.
719 print "Warning: SetGeoMax is obsolete. Please use SetMaxSize"
720 self.SetMaxSize(theVal)
724 pass # end of BLSURF_Algorithm class