@@ -272,43 +272,54 @@ def test_two_adds(capfd):
272272def test_geom_assoc1 ():
273273 ctx = Mgx3D .getStdContext ()
274274 ctx .clearSession () # Clean the session after the previous test
275+ gm = ctx .getGeomManager ()
275276 tm = ctx .getTopoManager ()
276277
277278 # Création de la boite Vol0000
278- ctx .getGeomManager ().newBox (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Point (1 , 1 , 1 ))
279- # Création d'un sommet géométrique par coordonnées
280- tm .newTopoVertex (Mgx3D .Point (0 , 0 , 0 ),"" )
279+ gm .newBox (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Point (1 , 1 , 1 ))
280+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['Hors_Groupe_0D' ]
281281
282+ # Création d'un sommet géométrique par coordonnées
283+ tm .newTopoVertex (Mgx3D .Point (0 , 0 , 0 ), "" )
282284 assert tm .getInfos ("Som0000" , 0 ).groups () == ['Hors_Groupe_0D' ]
283285
284286 # Affectation d'une projection vers Pt0001 pour les entités topologiques Som0000
285- # L'association ne peut se faire car le groupe Hors_Groupe_0D possède Pt0001 ainsi que Som0000
286- # Il est recommandé de supprimer la topologie du groupe
287+ # Som0000 va être sorti du groupe Hors_Groupe_0D car Pt0001 appartient à Hors_Groupe_0D
288+ # Som0000 va donc hériter de ce groupe par associativité
287289 tm .setGeomAssociation (["Som0000" ], "Pt0001" , True )
290+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['Hors_Groupe_0D' ]
291+ assert tm .getInfos ("Som0000" , 0 ).groups () == []
288292
293+ ctx .undo ()
294+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['Hors_Groupe_0D' ]
289295 assert tm .getInfos ("Som0000" , 0 ).groups () == ['Hors_Groupe_0D' ]
290296
291297def test_geom_assoc2 ():
292298 ctx = Mgx3D .getStdContext ()
293299 ctx .clearSession () # Clean the session after the previous test
300+ gm = ctx .getGeomManager ()
294301 tm = ctx .getTopoManager ()
295302
296303 # Création de la boite Vol0000
297304 ctx .getGeomManager ().newBox (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Point (1 , 1 , 1 ))
298305 # Modifie le groupe A
299306 ctx .getGeomManager ().addToGroup (["Pt0001" ], 0 , "A" )
307+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['A' ]
300308
301309 # Création d'un sommet géométrique par coordonnées
302310 tm .newTopoVertex (Mgx3D .Point (0 , 0 , 0 ),"A" )
303-
304311 assert tm .getInfos ("Som0000" , 0 ).groups () == ['A' ]
305312
306313 # Affectation d'une projection vers Pt0001 pour les entités topologiques Som0000
307- # L'association ne peut se faire car le groupe Hors_Groupe_0D possède Pt0001 ainsi que Som0000
308- # Il est recommandé de supprimer la topologie du groupe
314+ # Som0000 va être sorti du groupe A car Pt0001 appartient à A
315+ # Som0000 va donc hériter de ce groupe par associativité
309316 tm .setGeomAssociation (["Som0000" ], "Pt0001" , True )
317+ assert tm .getInfos ("Som0000" , 0 ).groups () == []
318+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['A' ]
310319
320+ ctx .undo ()
311321 assert tm .getInfos ("Som0000" , 0 ).groups () == ['A' ]
322+ assert gm .getInfos ("Pt0001" , 0 ).groups () == ['A' ]
312323
313324# issue#245: undo on addToGroup raises an error
314325def test_topo_surface ():
@@ -352,3 +363,56 @@ def test_issue265():
352363 gm .setGroup (["Vol0001" ], 3 , "aaa" )
353364 assert gm .getInfos ("Vol0000" , 3 ).groups () == ["aaa" ]
354365 assert gm .getInfos ("Vol0001" , 3 ).groups () == ["aaa" ]
366+
367+ # mesh becomes invisible during geom association
368+ def test_issue261_1 ():
369+ ctx = Mgx3D .getStdContext ()
370+ ctx .clearSession () # Clean the session after the previous test
371+ gm = ctx .getGeomManager ()
372+ tm = ctx .getTopoManager ()
373+
374+ gn = "test"
375+ # Création de la boite Vol0000
376+ gm .newBox (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Point (1 , 1 , 1 ), gn )
377+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
378+
379+ # Création d'un bloc unitaire mis dans le groupe test
380+ tm .newFreeTopoInGroup (gn , 3 )
381+ assert tm .getInfos ("Bl0000" , 3 ).groups () == [gn ]
382+
383+ # Affectation d'une projection vers Vol0000 pour les entités topologiques Bl0000
384+ tm .setGeomAssociation (["Bl0000" ], "Vol0000" , False )
385+ # lors de l'association, Bl0000 doit être retiré de gn car il en "hérite" par la géométrie
386+ assert tm .getInfos ("Bl0000" , 3 ).groups () == []
387+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
388+
389+ # test du undo
390+ ctx .undo ()
391+ assert tm .getInfos ("Bl0000" , 3 ).groups () == [gn ]
392+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
393+
394+ def test_issue261_2 ():
395+ ctx = Mgx3D .getStdContext ()
396+ ctx .clearSession () # Clean the session after the previous test
397+ gm = ctx .getGeomManager ()
398+ tm = ctx .getTopoManager ()
399+
400+ gn = "Hors_Groupe_3D"
401+ # Création de la boite Vol0000
402+ gm .newBox (Mgx3D .Point (0 , 0 , 0 ), Mgx3D .Point (1 , 1 , 1 ))
403+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
404+
405+ # Création d'un bloc unitaire mis dans le groupe test
406+ tm .newFreeTopoInGroup (gn , 3 )
407+ assert tm .getInfos ("Bl0000" , 3 ).groups () == [gn ]
408+
409+ # Affectation d'une projection vers Vol0000 pour les entités topologiques Bl0000
410+ tm .setGeomAssociation (["Bl0000" ], "Vol0000" , False )
411+ # lors de l'association, Bl0000 doit être retiré de gn car il en "hérite" par la géométrie
412+ assert tm .getInfos ("Bl0000" , 3 ).groups () == []
413+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
414+
415+ # test du undo
416+ ctx .undo ()
417+ assert tm .getInfos ("Bl0000" , 3 ).groups () == [gn ]
418+ assert gm .getInfos ("Vol0000" , 3 ).groups () == [gn ]
0 commit comments