From: akk Date: Wed, 3 May 2006 14:16:24 +0000 (+0000) Subject: Fix for 12314. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3d41c015437a2da6efd9248dda4e92173b4c11f2;p=modules%2Fgeom.git Fix for 12314. --- diff --git a/src/GEOM_SWIG/GEOM_cyl2complementary.py b/src/GEOM_SWIG/GEOM_cyl2complementary.py index 97efc776e..930f09218 100755 --- a/src/GEOM_SWIG/GEOM_cyl2complementary.py +++ b/src/GEOM_SWIG/GEOM_cyl2complementary.py @@ -12,11 +12,12 @@ import salome import geompy geomgui = salome.ImportComponentGUI("GEOM") - +import salome_ComponentGUI def addToStudy(shape, name): i = geompy.addToStudy(shape, name) salome.sg.updateObjBrowser(0) - geomgui.createAndDisplayGO(i) + if not isinstance(geomgui, type(salome_ComponentGUI)): + geomgui.createAndDisplayGO(i) return i # Piece diff --git a/src/GEOM_SWIG/GEOM_example3.py b/src/GEOM_SWIG/GEOM_example3.py index 1287f6853..da733d477 100644 --- a/src/GEOM_SWIG/GEOM_example3.py +++ b/src/GEOM_SWIG/GEOM_example3.py @@ -30,7 +30,7 @@ import salome import geompy import math from time import sleep - +import salome_ComponentGUI geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") myBuilder = salome.myStudy.NewBuilder() @@ -47,14 +47,16 @@ dirz = BasicOp.MakeVectorTwoPnt(point0,pointz1) torus1 = PrimOp.MakeTorusPntVecRR(point0,dirz,150.,25.) id_torus1 = geompy.addToStudy(torus1,"torus1") -gg.createAndDisplayGO(id_torus1) +if not isinstance(gg, type(salome_ComponentGUI)): + gg.createAndDisplayGO(id_torus1) torus2 = InsertOp.MakeCopy(torus1) vec1 = BasicOp.MakeVectorDXDYDZ(0.,0.,100.) torus2 = TrsfOp.TranslateVectorCopy(torus2,vec1) id_torus2 = geompy.addToStudy(torus2,"torus2") -gg.createAndDisplayGO(id_torus2) +if not isinstance(gg, type(salome_ComponentGUI)): + gg.createAndDisplayGO(id_torus2) cylz1 = PrimOp.MakeCylinderPntVecRH(point0,dirz,25.,100.) @@ -70,7 +72,8 @@ while ind < 6: name = "cyl%d"%(ind) acyl = TrsfOp.TranslateVectorCopy(acyl,vec_i) id_acyl = geompy.addToStudy(acyl,name) - gg.createAndDisplayGO(id_acyl) + if not isinstance(gg, type(salome_ComponentGUI)): + gg.createAndDisplayGO(id_acyl) shapeList.append(acyl) idList.append(id_acyl) ind = ind +1 @@ -82,7 +85,8 @@ idList.append(id_torus2) cage = geompy.MakeCompound(shapeList) id_cage = geompy.addToStudy(cage,"cage") -gg.createAndDisplayGO(id_cage) +if not isinstance(gg, type(salome_ComponentGUI)): + gg.createAndDisplayGO(id_cage) from salome import sg sleep(1) @@ -102,15 +106,15 @@ for id in idList: sg.Display(id_torus1) sg.Display(id_torus2) sg.Display(id_acyl) - -gg.setTransparency(id_torus1,0.5) - -gg.setDisplayMode(id_torus1,1) -gg.setDisplayMode(id_torus2,1) -gg.setDisplayMode(id_acyl,1) -#gg.setDisplayMode(id_cage,1) - -gg.setColor(id_torus1,0,0,255) -gg.setColor(id_torus2,255,0,0) -gg.setColor(id_acyl,0,255,0) -#gg.setColor(id_cage,255,255,0) +if not isinstance(gg, type(salome_ComponentGUI)): + gg.setTransparency(id_torus1,0.5) + + gg.setDisplayMode(id_torus1,1) + gg.setDisplayMode(id_torus2,1) + gg.setDisplayMode(id_acyl,1) + #gg.setDisplayMode(id_cage,1) + + gg.setColor(id_torus1,0,0,255) + gg.setColor(id_torus2,255,0,0) + gg.setColor(id_acyl,0,255,0) + #gg.setColor(id_cage,255,255,0) diff --git a/src/GEOM_SWIG/GEOM_tube_geom_gg2.py b/src/GEOM_SWIG/GEOM_tube_geom_gg2.py index 9d7ddbcb5..677310266 100755 --- a/src/GEOM_SWIG/GEOM_tube_geom_gg2.py +++ b/src/GEOM_SWIG/GEOM_tube_geom_gg2.py @@ -143,17 +143,18 @@ assemblageId = addToStudy(assemblage, "assemblage") # Display # gg = ImportComponentGUI("GEOM") -gg.initGeomGen() - -gg.createAndDisplayGO(baseId) -gg.setTransparency(baseId,0.5) -gg.setDisplayMode(baseId,1) -gg.setColor(baseId,255,0,0) -gg.createAndDisplayGO(travId) -gg.setTransparency(travId,0.5) -gg.setDisplayMode(travId,1) -gg.setColor(travId,255,0,0) -gg.createAndDisplayGO(weldId) -gg.setTransparency(weldId,0.5) -gg.setDisplayMode(weldId,1) -gg.setColor(weldId,0,0,255) +import salome_ComponentGUI +if not isinstance(gg, type(salome_ComponentGUI)): + gg.initGeomGen() + gg.createAndDisplayGO(baseId) + gg.setTransparency(baseId,0.5) + gg.setDisplayMode(baseId,1) + gg.setColor(baseId,255,0,0) + gg.createAndDisplayGO(travId) + gg.setTransparency(travId,0.5) + gg.setDisplayMode(travId,1) + gg.setColor(travId,255,0,0) + gg.createAndDisplayGO(weldId) + gg.setTransparency(weldId,0.5) + gg.setDisplayMode(weldId,1) + gg.setColor(weldId,0,0,255)