X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH_SWIG%2FStdMeshersBuilder.py;h=8867060244051e1a7fc7c04ff052d54a539a652f;hb=47bdf12d63a58cdd17b3a709d8f7d13071780cf1;hp=e2f1d5f4666e6b6481916e839098acdc25e4af03;hpb=6524427cb236ef241d5bc27113278ba994cdbcd1;p=modules%2Fsmesh.git diff --git a/src/SMESH_SWIG/StdMeshersBuilder.py b/src/SMESH_SWIG/StdMeshersBuilder.py index e2f1d5f46..886706024 100644 --- a/src/SMESH_SWIG/StdMeshersBuilder.py +++ b/src/SMESH_SWIG/StdMeshersBuilder.py @@ -26,7 +26,7 @@ from salome.smesh.smeshBuilder import AssureGeomPublished, IsEqual, ParseParamet from salome.smesh.smeshBuilder import GetName, TreatHypoStatus from salome.smesh.smeshBuilder import Mesh -import StdMeshers +from salome.StdMeshers import StdMeshersBuilder #---------------------------- # Mesh algo type identifiers @@ -178,6 +178,28 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm): return True return False + ## Defines "Adaptive" hypothesis to cut an edge into segments keeping segment size + # within the given range and considering (1) deflection of segments from the edge + # and (2) distance from segments to closest edges and faces to have segment length + # not longer than two times shortest distances to edges and faces. + # @param minSize defines the minimal allowed segment length + # @param maxSize defines the maximal allowed segment length + # @param deflection defines the maximal allowed distance from a segment to an edge + # @param UseExisting if ==true - searches for an existing hypothesis created with + # the same parameters, else (default) - creates a new one + # @return an instance of StdMeshers_Adaptive1D hypothesis + # @ingroup l3_hypos_1dhyps + def Adaptive(self, minSize, maxSize, deflection, UseExisting=False): + compFun = lambda hyp, args: ( IsEqual(hyp.GetMinSize(), args[0]) and \ + IsEqual(hyp.GetMaxSize(), args[1]) and \ + IsEqual(hyp.GetDeflection(), args[2])) + hyp = self.Hypothesis("Adaptive1D", [minSize, maxSize, deflection], + UseExisting=UseExisting, CompareMethod=compFun) + hyp.SetMinSize(minSize) + hyp.SetMaxSize(maxSize) + hyp.SetDeflection(deflection) + return hyp + ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length # @param start defines the length of the first segment # @param end defines the length of the last segment @@ -861,9 +883,9 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm): shape = geom if not shape: shape = mesh.geom - from geompy import SubShapeAll, ShapeType - nbSolids = len( SubShapeAll( shape, ShapeType["SOLID"] )) - nbShells = len( SubShapeAll( shape, ShapeType["SHELL"] )) + from salome.geom import geomBuilder + nbSolids = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SOLID"] )) + nbShells = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SHELL"] )) if nbSolids == 0 or nbSolids == nbShells: self.Create(mesh, geom, "Prism_3D") pass