Salome HOME
23370: [CEA 632] Impose enforced vertices without indicate the face on which the...
[plugins/blsurfplugin.git] / tests / test_enforced_vertex.py
index 19172cd12414094d14f8e0f4e34791319bc88ee0..2f809a46937882ccf006385e41bd2323c36142f9 100644 (file)
@@ -7,8 +7,6 @@ import GEOM
 from salome.geom import geomBuilder
 geompy = geomBuilder.New(salome.myStudy)
 
-r = 10
-dist = 10
 dist_coin = 10.1
 
 p1 = geompy.MakeVertex(0., 0., 0.)
@@ -22,6 +20,21 @@ 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
 # ====
 
@@ -38,15 +51,20 @@ algo2d.SetAngleMesh( 4 )
 algo2d.SetPhySize( 8 )
 
 algo2d.SetEnforcedVertex(left, dist_coin, 0, dist_coin)
+algo2d.AddEnforcedVertexGeom( pp )
+algo2d.AddEnforcedVertexGeom( p6 )
+algo2d.AddEnforcedVertex( *xyz7 )
 
 Mesh.Compute()
 
-id_node = Mesh.FindNodeClosestTo(dist_coin, 0, dist_coin)
+for x,y,z in allEnforcedCoords:
 
-x, y, z = Mesh.GetNodeXYZ(id_node)
+    id_node = Mesh.FindNodeClosestTo( x,y,z )
+    xn, yn, zn = Mesh.GetNodeXYZ( id_node )
 
-assert("%.2f, %.2f, %.2f"%(x, y, z) == "%.2f, %.2f, %.2f"%(dist_coin, 0, dist_coin))
+    # 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(True)
-