X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_SWIG%2FsmeshBuilder.py;h=2c98e16531d3c1bfe36890986f53e22cb43d70a6;hp=1d6de9c75a79438e5bda052d1ef74dcd15070a72;hb=e074bae4b74bc02aeebb7437fbae12a55bdad0c1;hpb=07589de92eb5d8e7d4e3bfde8b26f0d69251acf0 diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index 1d6de9c75..2c98e1653 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -1424,8 +1424,10 @@ class Mesh: # Treat compute errors computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom ) + shapeText = "" for err in computeErrors: - shapeText = " on %s" % self.GetSubShapeName( err.subShapeID ) + if self.mesh.HasShapeToMesh(): + shapeText = " on %s" % self.GetSubShapeName( err.subShapeID ) errText = "" stdErrors = ["OK", #COMPERR_OK "Invalid input mesh", #COMPERR_BAD_INPUT_MESH @@ -1680,9 +1682,10 @@ class Mesh: if self.mesh.HasShapeToMesh(): hyp_type = hyp.GetName() lib_name = hyp.GetLibName() - checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() )) - if checkAll and geom: - checkAll = geom.GetType() == 37 + # checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() )) + # if checkAll and geom: + # checkAll = geom.GetType() == 37 + checkAll = False isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll) if isApplicable: AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName()) @@ -3987,6 +3990,7 @@ class Mesh: if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object): RefPoint = self.smeshpyD.GetPointStruct(RefPoint) if isinstance( RefPoint, list ): + if not RefPoint: RefPoint = [0,0,0] RefPoint = SMESH.PointStruct( *RefPoint ) if isinstance( PathMesh, Mesh ): PathMesh = PathMesh.GetMesh() @@ -4019,8 +4023,9 @@ class Mesh: # only SMESH::Extrusion_Error otherwise # @ingroup l2_modif_extrurev def ExtrusionAlongPathX(self, Base, Path, NodeStart, - HasAngles, Angles, LinearVariation, - HasRefPoint, RefPoint, MakeGroups, ElemType): + HasAngles=False, Angles=[], LinearVariation=False, + HasRefPoint=False, RefPoint=[0,0,0], MakeGroups=False, + ElemType=SMESH.FACE): n,e,f = [],[],[] if ElemType == SMESH.NODE: n = Base if ElemType == SMESH.EDGE: e = Base @@ -4050,7 +4055,7 @@ class Mesh: # only SMESH::Extrusion_Error otherwise # @ingroup l2_modif_extrurev def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart, - HasAngles, Angles, HasRefPoint, RefPoint, + HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[], MakeGroups=False, LinearVariation=False): n,e,f = [],IDsOfElements,IDsOfElements gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, @@ -4080,7 +4085,7 @@ class Mesh: # only SMESH::Extrusion_Error otherwise # @ingroup l2_modif_extrurev def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart, - HasAngles, Angles, HasRefPoint, RefPoint, + HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[], MakeGroups=False, LinearVariation=False): n,e,f = [],theObject,theObject gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart, @@ -4109,7 +4114,7 @@ class Mesh: # only SMESH::Extrusion_Error otherwise # @ingroup l2_modif_extrurev def ExtrusionAlongPathObject1D(self, theObject, PathMesh, PathShape, NodeStart, - HasAngles, Angles, HasRefPoint, RefPoint, + HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[], MakeGroups=False, LinearVariation=False): n,e,f = [],theObject,[] gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart, @@ -4138,7 +4143,7 @@ class Mesh: # only SMESH::Extrusion_Error otherwise # @ingroup l2_modif_extrurev def ExtrusionAlongPathObject2D(self, theObject, PathMesh, PathShape, NodeStart, - HasAngles, Angles, HasRefPoint, RefPoint, + HasAngles=False, Angles=[], HasRefPoint=False, RefPoint=[], MakeGroups=False, LinearVariation=False): n,e,f = [],[],theObject gr,er = self.ExtrusionAlongPathObjects(n,e,f, PathMesh, PathShape, NodeStart, @@ -4519,6 +4524,52 @@ class Mesh: def MergeEqualElements(self): self.editor.MergeEqualElements() + ## Returns groups of FreeBorder's coincident within the given tolerance. + # @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average + # size of elements adjacent to free borders being compared is used. + # @return SMESH.CoincidentFreeBorders structure + # @ingroup l2_modif_trsf + def FindCoincidentFreeBorders (self, tolerance=0.): + return self.editor.FindCoincidentFreeBorders( tolerance ) + + ## Sew FreeBorder's of each group + # @param freeBorders either a SMESH.CoincidentFreeBorders structure or a list of lists + # where each enclosed list contains node IDs of a group of coincident free + # borders such that each consequent triple of IDs within a group describes + # a free border in a usual way: n1, n2, nLast - i.e. 1st node, 2nd node and + # last node of a border. + # For example [[1, 2, 10, 20, 21, 40], [11, 12, 15, 55, 54, 41]] describes two + # groups of coincident free borders, each group including two borders. + # @param createPolygons if @c True faces adjacent to free borders are converted to + # polygons if a node of opposite border falls on a face edge, else such + # faces are split into several ones. + # @param createPolyhedra if @c True volumes adjacent to free borders are converted to + # polyhedra if a node of opposite border falls on a volume edge, else such + # volumes, if any, remain intact and the mesh becomes non-conformal. + # @return a number of successfully sewed groups + # @ingroup l2_modif_trsf + def SewCoincidentFreeBorders (self, freeBorders, createPolygons=False, createPolyhedra=False): + if freeBorders and isinstance( freeBorders, list ): + # construct SMESH.CoincidentFreeBorders + if isinstance( freeBorders[0], int ): + freeBorders = [freeBorders] + borders = [] + coincidentGroups = [] + for nodeList in freeBorders: + if not nodeList or len( nodeList ) % 3: + raise ValueError, "Wrong number of nodes in this group: %s" % nodeList + group = [] + while nodeList: + group.append ( SMESH.FreeBorderPart( len(borders), 0, 1, 2 )) + borders.append( SMESH.FreeBorder( nodeList[:3] )) + nodeList = nodeList[3:] + pass + coincidentGroups.append( group ) + pass + freeBorders = SMESH.CoincidentFreeBorders( borders, coincidentGroups ) + + return self.editor.SewCoincidentFreeBorders( freeBorders, createPolygons, createPolyhedra ) + ## Sews free borders # @return SMESH::Sew_Error # @ingroup l2_modif_trsf