]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
Merge changes from 'master' branch. V9_dev V9_0_0
authorrnv <rnv@opencascade.com>
Fri, 29 Dec 2017 13:21:45 +0000 (16:21 +0300)
committerrnv <rnv@opencascade.com>
Fri, 29 Dec 2017 13:21:45 +0000 (16:21 +0300)
27 files changed:
1  2 
doc/salome/examples/blsurfdemo.py
doc/salome/examples/periodicity_prepro.py
src/BLSURFPlugin/BLSURFPluginBuilder.py
src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/GUI/BLSURFPluginGUI_Dlg.h
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx
tests/attractor.py
tests/attractor_edge_on_border.py
tests/attractor_point_outside_face.py
tests/enforced_internal_vertex.py
tests/enforced_vertex.py
tests/multithread.py
tests/periodicity_2D_prepro.py
tests/periodicity_reflexion_2D_prepro.py
tests/periodicity_reflexion_prepro.py
tests/periodicity_with_points_2D_prepro.py
tests/prepro_intersections.py
tests/prepro_keep_gaps.py
tests/proximity.py
tests/quadrangles.py
tests/quadrangles_gradation.py
tests/remove_tiny_edges.py
tests/sphere.py

Simple merge
index 0000000000000000000000000000000000000000,c15afcbad1157ad3d0071ddf9a1fc686e7267dad..f901cc12defa9c3bdec2278ba5654f90f3b72bf7
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,140 +1,140 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: utf-8 -*-
+ import salome
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ simple = False
+ r = 10
+ dist = 10
+ p1 = geompy.MakeVertex(0., 0., 0.)
+ p2 = geompy.MakeVertex(100., 100., 100.)
+ box = geompy.MakeBoxTwoPnt(p1, p2)
+ geompy.addToStudy(box, "box")
+ p3 = geompy.MakeVertex(25., 5., 25.)
+ sphere1 = geompy.MakeSpherePntR(p3, 15.)
+ geompy.addToStudy(sphere1, "sphere1")
+ sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+ geompy.addToStudy(sphere1_trans, "sphere1_trans")
+ sphere1_trans = geompy.MakeTranslation(sphere1, 0, 100, 0)
+ geompy.addToStudy(sphere1_trans, "sphere1_trans")
+ p4 = geompy.MakeVertex(5, 50, 90)
+ sphere2 = geompy.MakeSpherePntR(p4, 20.)
+ sphere2_trans = geompy.MakeTranslation(sphere2, 100, 0, 0)
+ geompy.addToStudy(sphere2_trans, "sphere2_trans")
+ sphere2_trans2 = geompy.MakeTranslation(sphere2, 0, 0, -100)
+ geompy.addToStudy(sphere2_trans2, "sphere2_trans2")
+ sphere2_trans3 = geompy.MakeTranslation(sphere2, 100, 0, -100)
+ geompy.addToStudy(sphere2_trans3, "sphere2_trans3")
+ if simple:
+     part = box
+ else:
+     part = geompy.MakePartition([box], [sphere1, sphere1_trans, sphere2, sphere2_trans, sphere2_trans2, sphere2_trans3])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(left, left_faces)
+ geompy.addToStudyInFather(part, left, "left")
+ right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(right, right_faces)
+ geompy.addToStudyInFather(part, right, "right")
+ back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+ back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(back, back_faces)
+ geompy.addToStudyInFather(part, back, "back")
+ front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+ front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(front, front_faces)
+ geompy.addToStudyInFather(part, front, "front")
+ bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(bottom, bottom_faces)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(top, top_faces)
+ geompy.addToStudyInFather(part, top, "top")
+ sources = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(sources, left_faces)
+ geompy.UnionList(sources, back_faces)
+ geompy.UnionList(sources, top_faces)
+ geompy.addToStudyInFather(part, sources, "sources")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ algo2d.SetVerbosity(1)
+ # Periodicity
+ #algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+ algo2d.AddPreCadFacesPeriodicity(left, right)
+ algo2d.AddPreCadFacesPeriodicity(front, back)
+ algo2d.AddPreCadFacesPeriodicity(bottom, top)
+ gr_left = Mesh.Group(left)
+ gr_right = Mesh.Group(right)
+ gr_front = Mesh.Group(front)
+ gr_back = Mesh.Group(back)
+ gr_bottom = Mesh.Group(bottom)
+ gr_top = Mesh.Group(top)
+ Mesh.Compute()
+ left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 0, 100, 0 )), 0, 'left_translated' )
+ front_translated = Mesh.TranslateObjectMakeMesh( gr_front, SMESH.DirStruct( SMESH.PointStruct ( -100, 0, 0 )), 0, 'front_translated' )
+ bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 0, 100 )), 0, 'bottom_translated' )
+ def checkProjection(gr, mesh_translated, tol=1e-7):
+     name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+     mesh_source = smesh.CopyMesh(gr, gr.GetName())
+     mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+     ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+     coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+     mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+     mesh_nodes = mesh_check.GetNodesId()
+     if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+         raise Exception("Projection failed for %s"%name)
+         
+ checkProjection(gr_right, left_translated)
+ checkProjection(gr_back, front_translated)
+ checkProjection(gr_top, bottom_translated)
++salome.sg.updateObjBrowser()
Simple merge
index 0000000000000000000000000000000000000000,fd69c4c5b8018f4897076755dbc5c3f31b51f24a..5b641499794886c7f797605203b14dcd83a8c0ab
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,77 +1,76 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(theStudy)
+ import  SMESH, SALOMEDS
+ ## Compute the minimum area of the faces of the mesh
+ def getMinArea(mesh):
+   faces = mesh.GetElementsByType(SMESH.FACE)
+   areas = [mesh.GetArea(face) for face in faces]
+   return min(areas)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(100, 100, 1)
+ Circle_1 = geompy.MakeCircle(None, None, 20)
+ geompy.addToStudy( O, 'O' )
+ geompy.addToStudy( OX, 'OX' )
+ geompy.addToStudy( OY, 'OY' )
+ geompy.addToStudy( OZ, 'OZ' )
+ geompy.addToStudy( Face_1, 'Face_1' )
+ geompy.addToStudy( Circle_1, 'Circle_1' )
+ ###
+ ### SMESH component
+ ###
+ from salome.smesh import smeshBuilder
 -print "min_area_without_attractor: ", min_area_without_attractor
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Face_1)
+ MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+ MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+ MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+ MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+ #MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
+ Mesh_1.Compute()
+ min_area_without_attractor = getMinArea(Mesh_1)
 -print "min_area_with_attractor: ", min_area_with_attractor
++print("min_area_without_attractor: ", min_area_without_attractor)
+ MG_CADSurf_Parameters_1.SetAttractorGeom( Face_1, Circle_1, 1, 14.1421, 5, 5 )
+ Mesh_1.Compute()
+ min_area_with_attractor = getMinArea(Mesh_1)
++print("min_area_with_attractor: ", min_area_with_attractor)
+ assert min_area_with_attractor < min_area_without_attractor
+ assert min_area_with_attractor < 1
+ if salome.sg.hasDesktop():
+   salome.sg.updateObjBrowser(True)
index 0000000000000000000000000000000000000000,c10597c72c4225e7409cce5edae789b180e5e781..cbb71b276cabd7a52e63467253e3ab04333172bd
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,85 +1,84 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(theStudy)
+ import  SMESH, SALOMEDS
+ ## Compute the minimum area of the faces of the mesh
+ def getMinArea(mesh):
+   faces = mesh.GetElementsByType(SMESH.FACE)
+   areas = [mesh.GetArea(face) for face in faces]
+   return min(areas)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(100, 100, 1)
+ Box_1 = geompy.MakePrismVecH(Face_1, OZ, -100)
+ # define the edge slightly longer than the face to test out of bounds case.
+ P1 = geompy.MakeVertex(-50.5, 0, 0)
+ P2 = geompy.MakeVertex(50.5, 0, 0)
+ Edge_1 = geompy.MakeEdge(P1, P2)
+ geompy.addToStudy( O, 'O' )
+ geompy.addToStudy( OX, 'OX' )
+ geompy.addToStudy( OY, 'OY' )
+ geompy.addToStudy( OZ, 'OZ' )
+ geompy.addToStudy( Face_1, 'Face_1' )
+ geompy.addToStudy( Box_1, 'Box_1' )
+ geompy.addToStudy( Edge_1, 'Edge_1' )
+ sub_Face_1 = geompy.GetInPlace(Box_1, Face_1)
+ geompy.addToStudyInFather(Box_1, sub_Face_1, "Face_1")
+ ###
+ ### SMESH component
+ ###
+ from salome.smesh import smeshBuilder
 -print "min_area_without_attractor: ", min_area_without_attractor
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Box_1)
+ MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+ MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+ MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+ MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+ #MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+ Mesh_1.Compute()
+ min_area_without_attractor = getMinArea(Mesh_1)
 -print "min_area_with_attractor: ", min_area_with_attractor
++print("min_area_without_attractor: ", min_area_without_attractor)
+ MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+ Mesh_1.Compute()
+ min_area_with_attractor = getMinArea(Mesh_1)
++print("min_area_with_attractor: ", min_area_with_attractor)
+ assert min_area_with_attractor < min_area_without_attractor
+ assert min_area_with_attractor < 1
+ if salome.sg.hasDesktop():
+   salome.sg.updateObjBrowser(True)
index 0000000000000000000000000000000000000000,9513ac3c650e0106ffccad3c7bef6302afca8452..369cda2055e0c0c7e53be0d942ff1f853b2d5006
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,111 +1,110 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(theStudy)
+ import  SMESH, SALOMEDS
+ ## Compute the minimum area of the faces of the mesh
+ def getMinArea(mesh):
+   faces = mesh.GetElementsByType(SMESH.FACE)
+   areas = [mesh.GetArea(face) for face in faces]
+   return min(areas)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ radius = 10
+ height = 100
+ Cylinder_1 = geompy.MakeCylinderRH(radius, height)
+ p_half_height = geompy.MakeVertex(0, 0, height/2.)
+ plane_z = geompy.MakePlane(p_half_height, OZ, 2.5*radius)
+ Part_1 = geompy.MakePartition([Cylinder_1], [plane_z], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy( O, 'O' )
+ geompy.addToStudy( OX, 'OX' )
+ geompy.addToStudy( OY, 'OY' )
+ geompy.addToStudy( OZ, 'OZ' )
+ geompy.addToStudy( Part_1, 'Part_1' )
+ p_edge_vert_opp_1 = geompy.MakeVertex(-radius, 0, 0)
+ geompy.addToStudy( p_edge_vert_opp_1, 'p_edge_vert_opp_1' )
+ edge_vert_opp_1 = geompy.MakePrismVecH(p_edge_vert_opp_1, OZ, height/2.)
+ geompy.addToStudy( edge_vert_opp_1, 'edge_vert_opp_1' )
+ p_edge_vert_opp_2 = geompy.MakeVertex(-radius, 0, height/4.)
+ geompy.addToStudy( p_edge_vert_opp_2, 'p_edge_vert_opp_2' )
+ p_face_cyl_1 = geompy.MakeVertex(0, radius, height/4.)
+ p_face_cyl_2 = geompy.MakeVertex(0, radius, 3*height/4.)
+ face_1 = geompy.GetFaceNearPoint(Part_1, p_face_cyl_1)
+ face_2 = geompy.GetFaceNearPoint(Part_1, p_face_cyl_2)
+ geompy.addToStudyInFather(Part_1, face_1, "face_1")
+ geompy.addToStudyInFather(Part_1, face_2, "face_2")
+ ###
+ ### SMESH component
+ ###
+ from salome.smesh import smeshBuilder
 -print "min_area_without_attractor: ", min_area_without_attractor
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Part_1)
+ MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_1.SetPhySize( 14.1421 )
+ MG_CADSurf_Parameters_1.SetMinSize( 0.141421 )
+ MG_CADSurf_Parameters_1.SetMaxSize( 28.2843 )
+ MG_CADSurf_Parameters_1.SetChordalError( 7.07107 )
+ #MG_CADSurf_Parameters_1.SetAttractorGeom( sub_Face_1, Edge_1, 1, 14.1421, 5, 5 )
+ ok = Mesh_1.Compute()
+ if not ok:
+   raise Exception("Mesh not computed")
+ min_area_without_attractor = getMinArea(Mesh_1)
 -print "min_area_with_attractor: ", min_area_with_attractor
++print("min_area_without_attractor: ", min_area_without_attractor)
+ MG_CADSurf_Parameters_1.SetAttractorGeom( face_1, edge_vert_opp_1, 1, 14.1421, 5, 5 )
+ # the attractor is not on the face. It is done on purpose to test this out of bounds case.
+ MG_CADSurf_Parameters_1.SetAttractorGeom( face_2, p_edge_vert_opp_2, 1, 14.1421, 5, 5 )
+ ok = Mesh_1.Compute()
+ if not ok:
+   raise Exception("Mesh with attractors not computed")
+ min_area_with_attractor = getMinArea(Mesh_1)
++print("min_area_with_attractor: ", min_area_with_attractor)
+ assert min_area_with_attractor < min_area_without_attractor
+ assert min_area_with_attractor < 1
+ if salome.sg.hasDesktop():
+   salome.sg.updateObjBrowser(True)
index 0000000000000000000000000000000000000000,5459def29e8e7fb5f2573ca878c4b71882dba258..574101d9e71a736c277a4d0276192d16d9ce5e90
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,54 +1,54 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: utf-8 -*-
+ import salome
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ r = 10
+ dist = 10
+ dist_coin = 10.1
+ p1 = geompy.MakeVertex(0., 0., 0.)
+ p2 = geompy.MakeVertex(100., 100., 100.)
+ box = geompy.MakeBoxTwoPnt(p1, p2)
+ geompy.addToStudy(box, "box")
+ p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
+ geompy.addToStudy(p3, "p3")
+ part = geompy.MakePartition([box], [p3])
+ geompy.addToStudy(part, "part")
+ left = geompy.GetFaceNearPoint(box, p3)
+ geompy.addToStudyInFather(box, left, "left")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ algo2d.SetInternalEnforcedVertexAllFaces(True)
+ Mesh.Compute()
+ id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
+ x, y, z = Mesh.GetNodeXYZ(id_node)
+ assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
++salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,a96de400db33120837d4f35ac998d430e3991dfd..1f5470b8fdaa11c915afe77a1e72abe9dde0e5de
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,71 +1,72 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: utf-8 -*-
+ import salome
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ dist_coin = 10.1
+ p1 = geompy.MakeVertex(0., 0., 0.)
+ p2 = geompy.MakeVertex(100., 100., 100.)
+ box = geompy.MakeBoxTwoPnt(p1, p2)
+ geompy.addToStudy(box, "box")
+ p3 = geompy.MakeVertex(dist_coin, 0, dist_coin)
+ geompy.addToStudy(p3, "p3")
+ left = geompy.GetFaceNearPoint(box, p3)
+ geompy.addToStudyInFather(box, left, "left")
+ allEnforcedCoords = []
+ allEnforcedCoords.append(( dist_coin, 0, dist_coin ))
+ allEnforcedCoords.append(( 20, 0, 15.3 ))
+ allEnforcedCoords.append(( 25, 1, 25.3 ))
+ allEnforcedCoords.append(( 35, 1, 45.3 ))
+ allEnforcedCoords.append(( 35, 1, 55.3 ))
+ p4 = geompy.MakeVertex( *(allEnforcedCoords[1] ))
+ p5 = geompy.MakeVertex( *(allEnforcedCoords[2] ))
+ pp = geompy.MakeCompound( [p4,p5], theName="p4,p5" )
+ p6 = geompy.MakeVertex( *(allEnforcedCoords[3] ), theName="p6")
+ p7 = geompy.MakeVertex( *(allEnforcedCoords[4] ), theName="p7")
+ xyz7 = allEnforcedCoords[4]
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(box, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
+ algo2d.AddEnforcedVertexGeom( pp )
+ algo2d.AddEnforcedVertexGeom( p6 )
+ algo2d.AddEnforcedVertex( *xyz7 )
+ assert Mesh.Compute()
+ assert not Mesh.FindCoincidentNodes( 1e-7 )
+ for x,y,z in allEnforcedCoords:
+     id_node = Mesh.FindNodeClosestTo( x,y,z )
+     xn, yn, zn = Mesh.GetNodeXYZ( id_node )
+     # compare X and Z
+     assert "%.2f, %.2f"%(x, z) == "%.2f, %.2f"%( xn, zn ), \
+         "%.2f, %.2f, %.2f != %.2f, %.2f, %.2f"%( xn, yn, zn, x,y,z )
++salome.sg.updateObjBrowser()
++
index 0000000000000000000000000000000000000000,06bf12cc3961d1bbdb1d97a587cf66b1435dfba0..7c4d67aef44443774bd5f88a59cc746f27a78438
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,92 +1,91 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import os
+ import sys
+ import salome
+ import time
+ import multiprocessing
+ salome.salome_init()
 -print "Running test on workstation with %d available cores" % cpu_count
+ cpu_count = multiprocessing.cpu_count()
+ divider = min(4, cpu_count)/2.
 -geompy = geomBuilder.New(theStudy)
++print ("Running test on workstation with %d available cores" % cpu_count)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ flight_solid_brep_1 = geompy.ImportBREP(os.path.join(os.getenv("DATA_DIR"),"Shapes/Brep/flight_solid.brep" ))
+ geompy.addToStudy( O, 'O' )
+ geompy.addToStudy( OX, 'OX' )
+ geompy.addToStudy( OY, 'OY' )
+ geompy.addToStudy( OZ, 'OZ' )
+ geompy.addToStudy( flight_solid_brep_1, 'flight_solid.brep_1' )
+ ###
+ ### SMESH component
+ ###
+ import  SMESH, SALOMEDS
+ from salome.smesh import smeshBuilder
 -print "Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread)
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(flight_solid_brep_1)
+ MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_1.SetPhySize( 1 )
+ MG_CADSurf_Parameters_1.SetMaxSize( 1 )
+ MG_CADSurf_Parameters_1.SetGradation( 1.05 )
+ MG_CADSurf_Parameters_1.SetAngleMesh( 1 )
+ MG_CADSurf_Parameters_1.SetChordalError( 2.40018 )
+ # 4 procs are used by default
+ # => No need to set an option
+ time0 = time.time()
+ isDone = Mesh_1.Compute()
+ time1 = time.time()
+ time_multithread = time1-time0
 -print "Time in single thread (1 proc): %.3s"%(time_singlethread)
++print ("Time in multi thread (%d cores): %.3s"%(cpu_count, time_multithread))
+ Mesh_2 = smesh.Mesh(flight_solid_brep_1)
+ MG_CADSurf = Mesh_2.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_2 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_2.SetPhySize( 1 )
+ MG_CADSurf_Parameters_2.SetMaxSize( 1 )
+ MG_CADSurf_Parameters_2.SetGradation( 1.05 )
+ MG_CADSurf_Parameters_2.SetAngleMesh( 1 )
+ MG_CADSurf_Parameters_2.SetChordalError( 2.40018 )
+ # Use only one thread
+ MG_CADSurf_Parameters_2.SetMaxNumberOfThreads( 1 )
+ time2 = time.time()
+ isDone = Mesh_2.Compute()
+ time3 = time.time()
+ time_singlethread = time3-time2
 -    print "Warning: cannot validate test - only 1 cpu core is available"
++print ("Time in single thread (1 proc): %.3s"%(time_singlethread))
+ if cpu_count == 1:
++    print ("Warning: cannot validate test - only 1 cpu core is available")
+ else:
+     assert time_multithread < time_singlethread/divider
+ if salome.sg.hasDesktop():
+   salome.sg.updateObjBrowser(True)
index 0000000000000000000000000000000000000000,0bad8e8ec950c9d883a8ccd6f323e4af65cc7462..771a0fc8b841576b2c9f44254ebf7a94d891cf4b
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,110 +1,110 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: iso-8859-1 -*-
+ import sys
+ import salome
+ ###
+ ### GEOM component
+ ###
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+ Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+ vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+ Curve_1 = geompy.MakeInterpol(vertices, True, True)
+ part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p1 = geompy.MakeVertex(-5, -5, 0)
+ p2 = geompy.MakeVertex(5, 5, 0)
+ left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(left, left_edges)
+ geompy.addToStudyInFather(part, left, "left")
+ right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(right, right_edges)
+ geompy.addToStudyInFather(part, right, "right")
+ bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(bottom, bottom_edges)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(top, top_edges)
+ geompy.addToStudyInFather(part, top, "top")
+ source_face = geompy.GetFaceNearPoint(part, p1)
+ geompy.addToStudyInFather(part, source_face, "source_face")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -  salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ #algo2d.SetGradation(1.05)
+ # Periodicity
+ #algo2d.SetVerbosity(10)
+ algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+ algo2d.AddPreCadEdgesPeriodicity(left, right)
+ algo2d.AddPreCadEdgesPeriodicity(bottom, top)
+ Mesh.Compute()
+ gr_left = Mesh.Group(left)
+ gr_right = Mesh.Group(right)
+ gr_bottom = Mesh.Group(bottom)
+ gr_top = Mesh.Group(top)
+ Mesh.Compute()
+ left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
+ bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
+ def checkProjection(gr, mesh_translated, tol=1e-7):
+     name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+     mesh_source = smesh.CopyMesh(gr, gr.GetName())
+     mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+     ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+     coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+     mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+     mesh_nodes = mesh_check.GetNodesId()
+     if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+         raise Exception("Projection failed for %s"%name)
+         
+ checkProjection(gr_right, left_translated)
+ checkProjection(gr_top, bottom_translated)
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,f8674fe978001000a99c1862a94f4bfbb482ed2e..ba6853e344d3b06e6c3564b37850fce3012ba182
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,126 +1,126 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: iso-8859-1 -*-
+ import sys
+ import salome
+ ###
+ ### GEOM component
+ ###
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+ Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+ vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+ Curve_1 = geompy.MakeInterpol(vertices, True, True)
+ part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p1 = geompy.MakeVertex(-5, -5, 0)
+ p2 = geompy.MakeVertex(5, 5, 0)
+ left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(left, left_edges)
+ geompy.addToStudyInFather(part, left, "left")
+ right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(right, right_edges)
+ geompy.addToStudyInFather(part, right, "right")
+ bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(bottom, bottom_edges)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(top, top_edges)
+ geompy.addToStudyInFather(part, top, "top")
+ source_face = geompy.GetFaceNearPoint(part, p1)
+ geompy.addToStudyInFather(part, source_face, "source_face")
+ # To define a rotation, we have to set at least 3 source vertices not aligned.
+ p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
+ geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
+ p_bas_mil = geompy.MakeVertex(0, -4, 0)
+ geompy.addToStudy(p_bas_mil, "p_bas_mil")
+ p_bas_droite = geompy.MakeVertex(5, -5, 0)
+ geompy.addToStudy(p_bas_droite, "p_bas_droite")
+ # Target vertices
+ p_mil_droite = geompy.MakeVertex(4, 0, 0)
+ geompy.addToStudy(p_mil_droite, "p_mil_droite")
+ p_haut_droite = geompy.MakeVertex(5, 5, 0)
+ geompy.addToStudy(p_haut_droite, "p_haut_droite")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -        print "Projection failed for %s"%name
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ #algo2d.SetGradation(1.05)
+ #algo2d.SetOptionValue( 'debug', '1' )
+ #algo2d.SetPreCADOptionValue( 'debug', '1' )
+ # Periodicity
+ #algo2d.SetVerbosity(10)
+ algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+ algo2d.AddPreCadEdgesPeriodicity(bottom, right, [p_bas_droite, p_bas_mil, p_bas_gauche], [p_bas_droite, p_mil_droite, p_haut_droite])
+ Mesh.Compute()
+ gr_left = Mesh.Group(left)
+ gr_right = Mesh.Group(right)
+ gr_bottom = Mesh.Group(bottom)
+ gr_top = Mesh.Group(top)
+ axe = geompy.MakePrismVecH(p_bas_droite, Vz, 1)
+ bottom_rotated = Mesh.RotateObjectMakeMesh( gr_bottom, axe, -math.pi/2, NewMeshName='bottom_rotated' )
+ def checkProjection(gr, mesh_translated, tol=1e-7):
+     name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+     mesh_source = smesh.CopyMesh(gr, gr.GetName())
+     mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+     ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+     coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+     mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+     mesh_nodes = mesh_check.GetNodesId()
+     if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+         #raise Exception("Projection failed for %s"%name)
 -#salome.myStudyManager.SaveAs("test.hdf", salome.myStudy, 0)
++        print("Projection failed for %s"%name)
+         
+ checkProjection(gr_right, bottom_rotated)
 -  salome.sg.updateObjBrowser(True)
++#salome.myStudy.SaveAs("test.hdf", 0, 0)
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
+   
index 0000000000000000000000000000000000000000,8c9d7cdad1e5163635c354cced86ac77d9c3dd3d..2eeb6e9ce19ae58e1021ca2c1014852eb3570fdf
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,122 +1,122 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
+ import salome
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ simple = False
+ r = 10
+ dist = 10
+ p1 = geompy.MakeVertex(0., 0., 0.)
+ p2 = geompy.MakeVertex(100., 100., 100.)
+ box = geompy.MakeBoxTwoPnt(p1, p2)
+ geompy.addToStudy(box, "box")
+ p3 = geompy.MakeVertex(50., 5., 25.)
+ sphere1 = geompy.MakeSpherePntR(p3, 15.)
+ geompy.addToStudy(sphere1, "sphere1")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p4 = geompy.MakeVertex(100., 0., 0.)
+ axe = geompy.MakePrismVecH(p4, Vz, 1)
+ geompy.addToStudy(axe, "axe")
+ sphere1_rota = geompy.MakeRotation(sphere1, axe, -math.pi/2.)
+ geompy.addToStudy(sphere1_rota, "sphere1_rota")
+ part = geompy.MakePartition([box], [sphere1, sphere1_rota])
+ geompy.addToStudy(part, "part")
+ left_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vy, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(left, left_faces)
+ geompy.addToStudyInFather(part, left, "left")
+ right_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vy, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(right, right_faces)
+ geompy.addToStudyInFather(part, right, "right")
+ back_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vx, GEOM.ST_ON)
+ back = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(back, back_faces)
+ geompy.addToStudyInFather(part, back, "back")
+ front_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vx, p2, GEOM.ST_ON)
+ front = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(front, front_faces)
+ geompy.addToStudyInFather(part, front, "front")
+ bottom_faces = geompy.GetShapesOnPlane(part, geompy.ShapeType["FACE"], Vz, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(bottom, bottom_faces)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_faces = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["FACE"], Vz, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(top, top_faces)
+ geompy.addToStudyInFather(part, top, "top")
+ p1_rota = geompy.MakeRotation(p1, axe, -math.pi/2.)
+ geompy.addToStudy(sphere1_rota, "sphere1_rota")
+ p5 = geompy.MakeVertex(100, 0, 100)
+ geompy.addToStudy(p5, "p5")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ # Periodicity
+ #algo2d.SetVerbosity(10)
+ #algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+ algo2d.AddPreCadFacesPeriodicity(left, front, [p1, p4, p5], [p1_rota, p4, p5])
+ gr_left = Mesh.Group(left)
+ gr_right = Mesh.Group(right)
+ gr_front = Mesh.Group(front)
+ gr_back = Mesh.Group(back)
+ gr_bottom = Mesh.Group(bottom)
+ gr_top = Mesh.Group(top)
+ Mesh.Compute()
+ left_rotated = Mesh.RotateObjectMakeMesh( gr_left, axe, -math.pi/2, NewMeshName='left_rotated' )
+ def checkProjection(gr, mesh_translated, tol=1e-7):
+     name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+     mesh_source = smesh.CopyMesh(gr, gr.GetName())
+     mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+     ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+     coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+     mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+     mesh_nodes = mesh_check.GetNodesId()
+     if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+         raise Exception("Projection failed for %s"%name)
+         
+ checkProjection(gr_front, left_rotated)
++salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,3dbc01dd6aa8936614858801856cc8a24f26641a..f0b12c6b88b48e7c67520f8c3840cd93f1b3d68a
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,125 +1,125 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: iso-8859-1 -*-
+ import sys
+ import salome
+ ###
+ ### GEOM component
+ ###
+ import math
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+ Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+ vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+ Curve_1 = geompy.MakeInterpol(vertices, True, True)
+ part = geompy.MakePartition([Face_1], [Curve_1], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p1 = geompy.MakeVertex(-5, -5, 0)
+ p2 = geompy.MakeVertex(5, 5, 0)
+ left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(left, left_edges)
+ geompy.addToStudyInFather(part, left, "left")
+ right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(right, right_edges)
+ geompy.addToStudyInFather(part, right, "right")
+ bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(bottom, bottom_edges)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(top, top_edges)
+ geompy.addToStudyInFather(part, top, "top")
+ source_face = geompy.GetFaceNearPoint(part, p1)
+ geompy.addToStudyInFather(part, source_face, "source_face")
+ p_bas_gauche = geompy.MakeVertex(-5, -5, 0)
+ geompy.addToStudy(p_bas_gauche, "p_bas_gauche")
+ p_bas_mil = geompy.MakeVertex(0, -4, 0)
+ geompy.addToStudy(p_bas_mil, "p_bas_mil")
+ p_bas_droite = geompy.MakeVertex(5, -5, 0)
+ geompy.addToStudy(p_bas_droite, "p_bas_droite")
+ p_haut_gauche = geompy.MakeVertex(-5, 5, 0)
+ geompy.addToStudy(p_haut_gauche, "p_haut_gauche")
+ p_haut_mil = geompy.MakeVertex(0, 6, 0)
+ geompy.addToStudy(p_haut_mil, "p_haut_mil")
+ p_haut_droite = geompy.MakeVertex(5, 5, 0)
+ geompy.addToStudy(p_haut_droite, "p_haut_droite")
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -  salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.MG_CADSurf)
+ algo2d.SetGeometricMesh( 1 )
+ algo2d.SetAngleMesh( 4 )
+ algo2d.SetPhySize( 8 )
+ #algo2d.SetGradation(1.05)
+ # Periodicity
+ #algo2d.SetVerbosity(10)
+ algo2d.SetPreCADOptionValue("periodic_tolerance", "1e-2")
+ algo2d.AddPreCadEdgesPeriodicity(bottom, top, [p_bas_gauche, p_bas_mil, p_bas_droite], [p_haut_gauche, p_haut_mil, p_haut_droite])
+ # debug
+ #algo2d.SetOptionValue( 'debug', '1' )
+ #algo2d.SetPreCADOptionValue( 'debug', '1' )
+ Mesh.Compute()
+ gr_left = Mesh.Group(left)
+ gr_right = Mesh.Group(right)
+ gr_bottom = Mesh.Group(bottom)
+ gr_top = Mesh.Group(top)
+ Mesh.Compute()
+ left_translated = Mesh.TranslateObjectMakeMesh( gr_left, SMESH.DirStruct( SMESH.PointStruct ( 10, 0, 0 )), 0, 'left_translated' )
+ bottom_translated = Mesh.TranslateObjectMakeMesh( gr_bottom, SMESH.DirStruct( SMESH.PointStruct ( 0, 10, 0 )), 0, 'bottom_translated' )
+ def checkProjection(gr, mesh_translated, tol=1e-7):
+     name = gr.GetName() + "_" + mesh_translated.GetName().split("_")[0]
+     mesh_source = smesh.CopyMesh(gr, gr.GetName())
+     mesh_check = smesh.Concatenate([mesh_source.GetMesh(), mesh_translated.GetMesh()], 0, name=name)
+     ll_coincident_nodes = mesh_check.FindCoincidentNodes(tol)
+     coincident_nodes = [item for sublist in ll_coincident_nodes for item in sublist]
+     mesh_check.MakeGroupByIds("coincident_nodes", SMESH.NODE, coincident_nodes)
+     mesh_nodes = mesh_check.GetNodesId()
+     if len(ll_coincident_nodes) != mesh_translated.NbNodes():
+         non_coincident_nodes = list(set(mesh_nodes) - set(coincident_nodes))
+         mesh_check.MakeGroupByIds("non_coincident_nodes", SMESH.NODE, non_coincident_nodes)
+         raise Exception("Projection failed for %s"%name)
+         
+ checkProjection(gr_top, bottom_translated)
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
+   
index 0000000000000000000000000000000000000000,47eef3df6b88b55a976134b9d180e26afb331178..080594950a7ec55ad539760a69858d1bc8a5469f
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,70 +1,69 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(salome.myStudy)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
 -geompy.init_geom(theStudy)
++geompy = geomBuilder.New()
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy.init_geom()
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
+ Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
+ Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ geompy.addToStudy( Face_1, 'Face_1' )
+ geompy.addToStudy( Translation_1, 'Translation_1' )
+ geompy.addToStudy( Translation_2, 'Translation_2' )
+ geompy.addToStudy( Partition_1, 'Partition_1' )
+ p_axe = geompy.MakeVertex(5, -5, 0)
+ axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
+ vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
+ gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
+ geompy.UnionList(gr_vertices, vertices)
+ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
+ ###
+ ### SMESH component
+ ###
+ import SMESH
+ from salome.smesh import smeshBuilder
 -  salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Partition_1)
+ BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ BLSURF_Parameters = BLSURF_1.Parameters()
+ BLSURF_Parameters.SetPhySize( 5 )
+ BLSURF_Parameters.SetPreCADMergeEdges( True )
+ BLSURF_Parameters.SetPreCADProcess3DTopology( True )
+ BLSURF_Parameters.SetPreCADOptionValue( 'remove_tiny_uv_edges', 'yes' )
+ Mesh_1.Compute()
+ # Check that vertices are merged by preCAD preprocessing
+ nodes = []
+ for p in vertices:
+     x, y, z = geompy.PointCoordinates(p)
+     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
+     nodes.append(id_node)
+ nodes = list(set(nodes))
+ nodesGroup = Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
+ assert nodesGroup.Size() == 1, nodesGroup.GetIDs()
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,4ca8a068137e4a15c36f227ed8f1a4225647deef..242cbfb8687e4ab8c31f9eea1f21fa1eca18efb1
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,68 +1,67 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(salome.myStudy)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
 -geompy.init_geom(theStudy)
++geompy = geomBuilder.New()
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy.init_geom()
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ Translation_1 = geompy.MakeTranslation(Face_1, 10.0001, 0.0001, 0)
+ Translation_2 = geompy.MakeTranslation(Face_1, 5, -9.99995, 0)
+ Partition_1 = geompy.MakePartition([Face_1, Translation_1, Translation_2], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ geompy.addToStudy( Face_1, 'Face_1' )
+ geompy.addToStudy( Translation_1, 'Translation_1' )
+ geompy.addToStudy( Translation_2, 'Translation_2' )
+ geompy.addToStudy( Partition_1, 'Partition_1' )
+ p_axe = geompy.MakeVertex(5, -5, 0)
+ axe = geompy.MakePrismDXDYDZ(p_axe, 0, 0, 1)
+ vertices = geompy.GetShapesOnCylinder(Partition_1, geompy.ShapeType["VERTEX"], axe, 1e-3, GEOM.ST_IN)
+ gr_vertices = geompy.CreateGroup(Partition_1, geompy.ShapeType["VERTEX"])
+ geompy.UnionList(gr_vertices, vertices)
+ geompy.addToStudyInFather(Partition_1, gr_vertices, "vertices")
+ ###
+ ### SMESH component
+ ###
+ import SMESH
+ from salome.smesh import smeshBuilder
 -  salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Partition_1)
+ BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ BLSURF_Parameters = BLSURF_1.Parameters()
+ BLSURF_Parameters.SetPhySize( 5 )
+ Mesh_1.Compute()
+ # Check that vertices are not merged by preCAD preprocessing
+ # when no preprocessing option has been explicitely called
+ nodes = []
+ for p in vertices:
+     x, y, z = geompy.PointCoordinates(p)
+     id_node = Mesh_1.FindNodeClosestTo(x, y, z)
+     nodes.append(id_node)
+ nodes = list(set(nodes))
+ Mesh_1.MakeGroupByIds("nodes", SMESH.NODE, nodes)
+ assert len(nodes) == 3, "We should have 3 nodes. We got %i. => The preprocessing has done something, but we did not ask him to."%len(nodes)
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,a649832c8aa9490716ee154654ce806ee6251ded..5a0230fe49d8408c3c03fcbc23a2292a788d1919
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,89 +1,88 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(theStudy)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ # Create a box
+ box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+ # Create a sphere near the sides of the box
+ sphere_tmp = geompy.MakeSphereR(5)
+ sphere = geompy.MakeTranslation(sphere_tmp, 6, 6, 50)
+ part = geompy.MakePartition([box, sphere])
+ geompy.addToStudy( box, 'box' )
+ geompy.addToStudy( sphere, 'sphere' )
+ geompy.addToStudy( part, 'part' )
+ # Create the groups of faces
+ box_faces = geompy.GetShapesOnBox(box, part, geompy.ShapeType["FACE"], GEOM.ST_ON)
+ gr_box_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(gr_box_faces, box_faces)
+ geompy.addToStudyInFather(part, gr_box_faces, "box_faces")
+ all_faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+ gr_all_faces = geompy.CreateGroup(part, geompy.ShapeType["FACE"])
+ geompy.UnionList(gr_all_faces, all_faces)
+ gr_spheres_faces = geompy.CutGroups(gr_all_faces, gr_box_faces)
+ geompy.addToStudyInFather(part, gr_spheres_faces, "spheres_faces")
+ ###
+ ### SMESH component
+ ###
+ import  SMESH, SALOMEDS
+ from salome.smesh import smeshBuilder
 -print "min_area: ", min_area
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(part, "Mesh_part")
+ BLSURF = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
+ BLSURF_Parameters_1 = BLSURF.Parameters()
+ BLSURF_Parameters_1.SetGradation( 1.2 )
+ BLSURF_Parameters_1.SetGeometricMesh( 1 )
+ BLSURF_Parameters_1.SetPhySize( 20 )
+ #BLSURF_Parameters_1.SetMinSize( 0.1 )
+ BLSURF_Parameters_1.SetMaxSize( 20 )
+ BLSURF_Parameters_1.SetAngleMesh( 8 )
+ # Old way to set proximity (Mesh Gems 1.1)
+ #BLSURF_Parameters_1.SetOptionValue( 'proximity', '1' )
+ #BLSURF_Parameters_1.SetOptionValue( 'prox_ratio', '1.2' )
+ #BLSURF_Parameters_1.SetOptionValue( 'prox_nb_layer', '3' )
+ # New way to set proximity (Mesh Gems >= 1.3)
+ BLSURF_Parameters_1.SetOptionValue( "volume_gradation", "1.2" )
+ isDone = Mesh_1.Compute()
+ if not isDone:
+     raise Exception("Compute mesh ended in error")
+ # Create the groups on the mesh
+ gr_mesh_box = Mesh_1.Group(gr_box_faces)
+ gr_mesh_spheres = Mesh_1.Group(gr_spheres_faces)
+ # Check the minimal area of the box faces to check the proximity
+ min_area, max_area = Mesh_1.GetMinMax(SMESH.FT_Area, gr_mesh_box)
 -  salome.sg.updateObjBrowser(True)
++print("min_area: ", min_area)
+ if min_area > 1.5:
+     raise Exception("Wrong minimal area on box. Proximity has not worked.")
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,bb1e0c34f8c261a36940e536bf15c5d8c69735bb..3c5b86eac888e9a54830b2628d8640157a501702
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,87 +1,86 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(theStudy)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
+ import math
+ import SALOMEDS
 -smesh = smeshBuilder.New(theStudy)
++geompy = geomBuilder.New()
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(100, 100, 1)
+ Disk_1 = geompy.MakeDiskR(20, 1)
+ Partition_1 = geompy.MakePartition([Face_1, Disk_1], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy( O, 'O' )
+ geompy.addToStudy( OX, 'OX' )
+ geompy.addToStudy( OY, 'OY' )
+ geompy.addToStudy( OZ, 'OZ' )
+ geompy.addToStudy( Face_1, 'Face_1' )
+ geompy.addToStudy( Disk_1, 'Disk_1' )
+ geompy.addToStudy( Partition_1, 'Partition_1' )
+ ###
+ ### SMESH component
+ ###
+ import  SMESH, SALOMEDS
+ from salome.smesh import smeshBuilder
+ from salome.BLSURFPlugin import BLSURFPluginBuilder
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(Partition_1)
+ MG_CADSurf = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ MG_CADSurf_Parameters_1 = MG_CADSurf.Parameters()
+ MG_CADSurf_Parameters_1.SetPhySize( 10 )
+ MG_CADSurf_Parameters_1.SetMaxSize( 10 )
+ MG_CADSurf_Parameters_1.SetChordalError( -1 )
+ # Test quadrangle dominant
+ MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.QuadrangleDominant )
+ isDone = Mesh_1.Compute()
+ assert Mesh_1.NbQuadrangles() > 0
+ assert Mesh_1.NbTriangles() > 0
+ assert Mesh_1.NbQuadrangles() > Mesh_1.NbTriangles()
+ # Test quadrangles only
+ MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.Quadrangles )
+ isDone = Mesh_1.Compute()
+ assert Mesh_1.NbQuadrangles() > 0
+ assert Mesh_1.NbTriangles() == 0
+ # Test triangles only
+ MG_CADSurf_Parameters_1.SetElementType( BLSURFPluginBuilder.Triangles )
+ isDone = Mesh_1.Compute()
+ assert Mesh_1.NbQuadrangles() == 0
+ assert Mesh_1.NbTriangles() > 0
+ # Test quadrangle dominant compatibility (to be deprecated in Salome 9)
+ MG_CADSurf_Parameters_1.SetQuadAllowed( True )
+ isDone = Mesh_1.Compute()
+ assert Mesh_1.NbQuadrangles() > 0
+ assert Mesh_1.NbTriangles() > 0
+ assert Mesh_1.NbQuadrangles() > Mesh_1.NbTriangles()
+ if salome.sg.hasDesktop():
+   salome.sg.updateObjBrowser(True)
index 0000000000000000000000000000000000000000,264fd8f266207c5ac96787d785badbd81b773792..c11280d3a0daedba5d247220534a80dcf18f7895
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,155 +1,155 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: utf-8 -*-
+ import salome
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ import math
+ area_tolerance = 0.1
+ nb_faces_tolerance = 20
+ ## Return the min and max areas of a mesh
+ def getMinMaxArea(mesh):
+   mini, maxi = mesh.GetMinMax(SMESH.FT_Area)
+   return mini, maxi
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+ Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+ vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+ Curve_1 = geompy.MakeInterpol(vertices, True, True)
+ p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
+ geompy.addToStudy(p_small, "p_small")
+ p_small2 = geompy.MakeVertexOnCurve(Curve_1, 0.5)
+ geompy.addToStudy(p_small2, "p_small2")
+ p_small3 = geompy.MakeVertexOnCurve(Curve_1, 0.501)
+ geompy.addToStudy(p_small3, "p_small3")
+ part = geompy.MakePartition([Face_1], [Curve_1, p_small, p_small2, p_small3], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p1 = geompy.MakeVertex(-5, -5, 0)
+ p2 = geompy.MakeVertex(5, 5, 0)
+ left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(left, left_edges)
+ geompy.addToStudyInFather(part, left, "left")
+ right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(right, right_edges)
+ geompy.addToStudyInFather(part, right, "right")
+ bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(bottom, bottom_edges)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(top, top_edges)
+ geompy.addToStudyInFather(part, top, "top")
+ faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+ sub_shapes = []
+ for i, face in enumerate(faces):
+   geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
+   sub_shapes.append(face)
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -  salome.sg.updateObjBrowser(True)
++smesh = smeshBuilder.New()
+ # Test gradation with quadrangles
+ Mesh_1 = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh_1.Triangle(algo=smeshBuilder.BLSURF)
+ params = algo2d.Parameters()
+ params.SetGeometricMesh( 1 )
+ params.SetAngleMesh( 4 )
+ params.SetPhySize( 8 )
+ algo2d.SetGradation(1.05)
+ params.SetElementType( True )
+ ok = Mesh_1.Compute()
+ if not ok:
+   raise Exception("Error when computing Mesh_1")
+ # Check the areas of Mesh_1
+ mini_1, maxi_1 = getMinMaxArea(Mesh_1)
+ mini_1_ref = 0.00197
+ maxi_1_ref = 0.530
+ if abs(mini_1-mini_1_ref) > area_tolerance:
+   raise Exception("Min area of Mesh_1 incorrect")
+ if maxi_1 > maxi_1_ref:
+   raise Exception("Max area of Mesh_1 incorrect")
+ # Check the number of faces of Mesh_1
+ nb_faces_1 = Mesh_1.NbFaces()
+ nb_faces_1_ref = 1208
+ if nb_faces_1 < nb_faces_1_ref:
+   raise Exception("Number of faces of Mesh_1 incorrect")
+ # Test no gradation with quadrangles and anisotropy
+ # RQ: this kind of mesh is not suitable for simulation
+ # but gives a coarse mesh like a stl geometry
+ Mesh_2 = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh_2.Triangle(algo=smeshBuilder.BLSURF)
+ params = algo2d.Parameters()
+ params.SetGeometricMesh( 1 )
+ params.SetAngleMesh( 4 )
+ params.SetPhySize( 8 )
+ algo2d.SetGradation(1.05)
+ params.SetElementType( 1 )
+ params.SetAnisotropic(True)
+ ok = Mesh_2.Compute()
+ if not ok:
+   raise Exception("Error when computing Mesh_2")
+ # Check the areas of Mesh_2
+ mini_2, maxi_2 = getMinMaxArea(Mesh_2)
+ mini_2_ref = 0.000408
+ maxi_2_ref = 10.1982
+ if abs(mini_2-mini_2_ref) > area_tolerance:
+   raise Exception("Min area of Mesh_2 incorrect")
+ if abs(maxi_2-maxi_2_ref) > area_tolerance:
+   raise Exception("Max area of Mesh_2 incorrect")
+ # Check the number of faces of Mesh_2
+ nb_faces_2 = Mesh_2.NbFaces()
+ nb_faces_2_ref = 121
+ if abs(nb_faces_2-nb_faces_2_ref) > nb_faces_tolerance:
+   raise Exception("Number of faces of Mesh_2 incorrect")
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
index 0000000000000000000000000000000000000000,0b61607876df3b08d9aefbf585d57c27ea2fe647..9bb6904dbe9517ed1b9f3788cfa80c7e1c223502
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,109 +1,109 @@@
 -geompy = geomBuilder.New(salome.myStudy)
+ # -*- coding: utf-8 -*-
+ import salome
+ import GEOM
+ from salome.geom import geomBuilder
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy = geomBuilder.New()
+ import math
+ tiny_edge_length = 0.1
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ Face_1 = geompy.MakeFaceHW(10, 10, 1)
+ geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+ Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -2.5209155082703 -1.4416453838348:TT -1.1105282306671 -2.9872753620148:TT 0.76354801654816 -2.3303825855255:TT 1.9614112377167 -3.0838770866394:TT 3.8354876041412 -1.2677619457245:TT 4.2218952178955 0.644955098629:TT 3.2751967906952 2.5576722621918:TT 0.58966463804245 3.5430111885071:TT -3.7380990982056 3.2338852882385:TT -4.433632850647 0.85747921466827:WW", Face_1 )
+ vertices = geompy.ExtractShapes(Sketch_1, geompy.ShapeType["VERTEX"], True)
+ Curve_1 = geompy.MakeInterpol(vertices, True, True)
+ p_small = geompy.MakeVertexOnCurve(Curve_1, 0.001)
+ geompy.addToStudy(p_small, "p_small")
+ part = geompy.MakePartition([Face_1], [Curve_1, p_small], Limit=geompy.ShapeType["FACE"])
+ geompy.addToStudy(part, "part")
+ Vx = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ Vy = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ Vz = geompy.MakeVectorDXDYDZ(0, 0, 1)
+ p1 = geompy.MakeVertex(-5, -5, 0)
+ p2 = geompy.MakeVertex(5, 5, 0)
+ left_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p1, GEOM.ST_ON)
+ left = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(left, left_edges)
+ geompy.addToStudyInFather(part, left, "left")
+ right_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vx, p2, GEOM.ST_ON)
+ right = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(right, right_edges)
+ geompy.addToStudyInFather(part, right, "right")
+ bottom_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p1, GEOM.ST_ON)
+ bottom = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(bottom, bottom_edges)
+ geompy.addToStudyInFather(part, bottom, "bottom")
+ top_edges = geompy.GetShapesOnPlaneWithLocation(part, geompy.ShapeType["EDGE"], Vy, p2, GEOM.ST_ON)
+ top = geompy.CreateGroup(part, geompy.ShapeType["EDGE"])
+ geompy.UnionList(top, top_edges)
+ geompy.addToStudyInFather(part, top, "top")
+ faces = geompy.SubShapeAll(part, geompy.ShapeType["FACE"])
+ sub_shapes = []
+ for i, face in enumerate(faces):
+   geompy.addToStudyInFather(part, face, "face_%i"%(i+1))
+   sub_shapes.append(face)
+ # Mesh
+ # ====
+ import SMESH
+ from salome.smesh import smeshBuilder
 -print min_length
++smesh = smeshBuilder.New()
+ Mesh = smesh.Mesh(part, "Mesh")
+ algo2d = Mesh.Triangle(algo=smeshBuilder.BLSURF)
+ params = algo2d.Parameters()
+ params.SetVerbosity(1)
+ #algo2d.SetTopology(smesh.PreCAD)
+ params.SetGeometricMesh( 1 )
+ params.SetAngleMesh( 4 )
+ params.SetPhySize( 8 )
+ #algo2d.SetGradation(1.05)
+ params.SetQuadraticMesh( True )
+ params.SetRemoveTinyEdges( True )
+ params.SetTinyEdgeLength( tiny_edge_length )
+ #params.SetOptionValue( 'rectify_jacobian', '0' )
+ Mesh.Compute()
+ for sub_shape in sub_shapes:
+   Mesh.Group(sub_shape)
+ x0, y0, z0 = geompy.PointCoordinates(p_small)
+ node = Mesh.FindNodeClosestTo(x0, y0, z0)
+ elems = Mesh.GetNodeInverseElements(node)
+ edges_length = []
+ for elem in elems:
+     if Mesh.GetElementType(elem, True) == SMESH.EDGE:
+         edge_length = Mesh.GetLength(elem)
+         edges_length.append(edge_length)
+ min_length = min(edges_length)
+ x1, y1, z1 = Mesh.GetNodeXYZ(node)
 -  salome.sg.updateObjBrowser(True)
++print(min_length)
+ if min_length<tiny_edge_length:
+     raise Exception("Small edge has not been removed")
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()
diff --cc tests/sphere.py
index 0000000000000000000000000000000000000000,ac4b96d9a67230bd824ce39934bf6bf23a926c75..8734c63d126b2545f72f4c2bdd71b224c14d166c
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,56 +1,55 @@@
 -theStudy = salome.myStudy
+ # -*- coding: utf-8 -*-
+ import sys
+ import salome
+ salome.salome_init()
 -geompy = geomBuilder.New(salome.myStudy)
+ ###
+ ### GEOM component
+ ###
+ import GEOM
+ from salome.geom import geomBuilder
 -geompy.init_geom(theStudy)
++geompy = geomBuilder.New()
 -smesh = smeshBuilder.New(salome.myStudy)
++geompy.init_geom()
+ sphere = geompy.MakeSphereR(10)
+ geompy.addToStudy( sphere, 'sphere' )
+ ###
+ ### SMESH component
+ ###
+ import SMESH
+ from salome.smesh import smeshBuilder
 -    print "Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable"
++smesh = smeshBuilder.New()
+ Mesh_1 = smesh.Mesh(sphere)
+ BLSURF_1 = Mesh_1.Triangle(algo=smeshBuilder.MG_CADSurf)
+ BLSURF_Parameters = BLSURF_1.Parameters()
+ BLSURF_Parameters.SetPhySize( 5 )
+ BLSURF_Parameters.SetGeometricMesh( 1 )
+ BLSURF_Parameters.SetAngleMesh( 8 )
+ ok = Mesh_1.Compute()
+ if not ok:
+     raise Exception("Error when computing surface mesh")
+ try:
+     Mesh_1.Tetrahedron(algo=smeshBuilder.MG_Tetra)
+     ok = Mesh_1.Compute()
+     if not ok:
+         raise Exception("Error when computing volume mesh")
+ except AttributeError:
 -  salome.sg.updateObjBrowser(True)
++    print("Warning: Cannot build volume mesh: MG-Tetra plugin seems to be unavailable")
+ if salome.sg.hasDesktop():
++  salome.sg.updateObjBrowser()