Salome HOME
Merge remote branch 'origin/eap/23307'
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPluginBuilder.py
index 3b443a95783717ff7e7cb72cab50b61b1c98b181..084b8c7561fd4088285fa7ddb4ccdbadee87350a 100644 (file)
@@ -74,6 +74,7 @@ class BLSURF_Algorithm(Mesh_Algorithm):
   _bad_surface_element_aspect_ratio = 1000
   _geometric_approximation = 22
   _gradation  = 1.3
+  _volume_gradation  = 2
   _metric = "isotropic"
   _remove_tiny_edges = 0
 
@@ -159,11 +160,22 @@ class BLSURF_Algorithm(Mesh_Algorithm):
 
   ## Sets maximal allowed ratio between the lengths of two adjacent edges.
   #  @param theVal value of maximal length ratio
-  def SetGradation(self, theVal=_gradation):
+  def SetGradation(self, toUseGradation=True, theVal=_gradation):
+    if isinstance( toUseGradation, float ): ## backward compatibility
+      toUseGradation, theVal = True, toUseGradation
     if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
+    self.Parameters().SetUseGradation(toUseGradation)
     self.Parameters().SetGradation(theVal)
     pass
 
+  ## Sets maximal allowed ratio between the lengths of two adjacent edges in 3D mesh.
+  #  @param theVal value of maximal length ratio
+  def SetVolumeGradation(self, toUseGradation=True, theVal=_gradation):
+    if self.Parameters().GetGeometricMesh() == 0: theVal = self._volume_gradation
+    self.Parameters().SetUseVolumeGradation(toUseGradation)
+    self.Parameters().SetVolumeGradation(theVal)
+    pass
+
   ## Sets topology usage way.
   # @param way defines how mesh conformity is assured <ul>
   # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
@@ -191,6 +203,141 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     self.Parameters().SetVerbosity(level)
     pass
 
+  ## Set enforce_cad_edge_sizes parameter
+  #  
+  #  Relaxes the given sizemap constraint around CAD edges to allow a better
+  #  element quality and a better geometric approximation. It is only useful in 
+  #  combination with the gradation option.
+  #  
+  def SetEnforceCadEdgesSize( self, toEnforce ):
+    self.Parameters().SetEnforceCadEdgesSize( toEnforce )
+
+  ## Set jacobian_rectification_respect_geometry parameter
+  #  
+  #  While making the mesh quadratic, allows to lose the CAD-mesh associativity in order
+  #  to correct elements with nagative Jacobian
+  #  
+  def SetJacobianRectificationRespectGeometry( self, allowRectification ):
+    self.Parameters().SetJacobianRectificationRespectGeometry( allowRectification )
+    
+  ## Set rectify_jacobian parameter
+  #  
+  #  While making the mesh quadratic, allow to fix nagative Jacobian surface elements
+  #  
+  def SetJacobianRectification( self, allowRectification ):
+    self.Parameters().SetJacobianRectification( allowRectification )
+
+  ## Set respect_geometry parameter
+  #  
+  #  This patch independent option can be deactivated to allow MeshGems-CADSurf
+  #  to lower the geometry accuracy in its patch independent process.
+  #  
+  def SetRespectGeometry( self, toRespect ):
+    self.Parameters().SetRespectGeometry( toRespect )
+
+  ## Set max_number_of_points_per_patch parameter
+  #  
+  #  This parameter controls the maximum amount of points MeshGems-CADSurf is allowed
+  #  to generate on a single CAD patch. For an automatic gestion of the memory, one
+  #  can set this parameter to 0
+  #  
+  def SetMaxNumberOfPointsPerPatch( self, nb ):
+    self.Parameters().SetMaxNumberOfPointsPerPatch( nb )
+
+  ## Set respect_geometry parameter
+  #  
+  #  This patch independent option can be deactivated to allow MeshGems-CADSurf
+  #  to lower the geometry accuracy in its patch independent process.
+  #  
+  def SetRespectGeometry( self, toRespect ):
+    self.Parameters().SetRespectGeometry( toRespect )
+
+  ## Set tiny_edges_avoid_surface_intersections parameter
+  #  
+  #  This option defines the priority between the tiny feature
+  #  suppression and the surface intersection prevention. 
+  #  
+  def SetTinyEdgesAvoidSurfaceIntersections( self, toAvoidIntersection ):
+    self.Parameters().SetTinyEdgesAvoidSurfaceIntersections( toAvoidIntersection )
+
+  ## Set closed_geometry parameter parameter
+  #  
+  #  Describes whether the geometry is expected to be closed or not. 
+  #  When activated, this option helps MeshGems-PreCAD to treat the dirtiest geometries.
+  #  
+  def SetClosedGeometry( self, isClosed ):
+    self.Parameters().SetClosedGeometry( isClosed )
+
+  ## Set debug parameter
+  #  
+  #  Make MeshGems-CADSurf will be very verbose and will output some intermediate
+  #  files in the working directory. This option is mainly meant for Distene support issues.
+  #  
+  def SetDebug( self, isDebug ):
+    self.Parameters().SetDebug( isDebug )
+
+  ## Set periodic_tolerance parameter
+  #  
+  #  This parameter defines the maximum size difference between two periodic edges
+  #  and also the maximum distance error between two periodic entities.
+  #  
+  def SetPeriodicTolerance( self, tol ):
+    self.Parameters().SetPeriodicTolerance( tol )
+
+  ## Set required_entities parameter
+  #  
+  #  The required entities control the correction operations. 
+  #  Accepted values for this parameter are :
+  #  - "respect" : MeshGems-CADSurf is not allowed to alter any required entity, 
+  #                even for correction purposes,
+  #  - "ignore" : MeshGems-CADSurf will ignore the required entities in its processing,
+  #  - "clear" : MeshGems-CADSurf will clear any required status for the entities. 
+  #              There will not be any entity marked as required in the generated mesh.
+  #  
+  def SetRequiredEntities( self, howToTreat ):
+    self.Parameters().SetRequiredEntities( howToTreat )
+
+  ## Set sewing_tolerance parameter
+  #  
+  #  This parameter is the tolerance of the assembly.
+  #  
+  def SetSewingTolerance( self, tol ):
+    self.Parameters().SetSewingTolerance( tol )
+
+  ## Set tags parameter
+  #  
+  #  The tag (attribute) system controls the optimisation process. 
+  #  Accepted values for this parameter are :
+  #  - "respect"  : the CAD tags will be preserved and unaltered by the optimisation operations,
+  #  - "ignore" : the CAD tags will be ignored by the optimisation operations 
+  #               but they will still be present in the output mesh,
+  #  - "clear" : MeshGems-CADSurf will clear any tag on any entity and optimise accordingly. 
+  #              There will not be any tag in the generated mesh.
+  #  
+  def SetTags( self, howToTreat ):
+    self.Parameters().SetTags( howToTreat )
+
+  ## Activate removal of the tiny edges from the generated
+  # mesh when it improves the local mesh quality, without taking into account the
+  # tags (attributes) specifications.
+  #  @param toOptimise "to optimize" flag value
+  #  @param length minimal length under which an edge is considered to be a tiny
+  def SetOptimiseTinyEdges(self, toOptimise, length=-1):
+    self.Parameters().SetOptimiseTinyEdges( toOptimise )
+    if toOptimise:
+      self.Parameters().SetTinyEdgeOptimisationLength( length )
+
+  ## Activate correction of all surface intersections
+  #  @param toCorrect "to correct" flag value
+  #  @param maxCost  the time the user is ready to spend in the intersection prevention process
+  #         For example, maxCost = 3 means that MeshGems-CADSurf will not spend more time
+  #         in the intersection removal process than 3 times the time required to mesh
+  #         without processing the intersections.
+  def SetCorrectSurfaceIntersection(self, toCorrect, maxCost ):
+    self.Parameters().SetCorrectSurfaceIntersection( toCorrect )
+    if toCorrect:
+      self.Parameters().SetCorrectSurfaceIntersectionMaxCost( maxCost )
+
   ## To optimize merges edges.
   #  @param toMergeEdges "merge edges" flag value
   def SetPreCADMergeEdges(self, toMergeEdges=False):
@@ -251,6 +398,12 @@ class BLSURF_Algorithm(Mesh_Algorithm):
     self.Parameters().SetPreCADOptionValue(optionName,optionValue)
     pass
   
+  ## Adds custom advanced option values
+  #  @param optionsAndValues options and values in a form "option_1 v1 option_2 v2'"
+  def SetAdvancedOption(self, optionsAndValues):
+    self.Parameters().SetAdvancedOption(optionsAndValues)
+    pass
+
   ## Adds custom advanced option value.
   #  @param optionName custom advanced option name
   #  @param level custom advanced option value