"Dump Python". Restore myStudy, myStudyID and myBuilder variables

This commit is contained in:
eap 2005-04-11 05:16:04 +00:00
parent fcadb99dda
commit 75cb5bc214

View File

@ -40,9 +40,9 @@ gg = ImportComponentGUI("GEOM")
#SRN: modified on Mar 18, 2005 #SRN: modified on Mar 18, 2005
geomStudy = None myStudy = None
geomBuilder = None myBuilder = None
geomStudyId = 0 myStudyId = 0
BasicOp = None BasicOp = None
CurvesOp = None CurvesOp = None
PrimOp = None PrimOp = None
@ -58,40 +58,40 @@ GroupOp = None
def init_geom(theStudy): def init_geom(theStudy):
global geomStudy, geomBuilder, geomStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp global myStudy, myBuilder, myStudyId, BasicOp, CurvesOp, PrimOp, ShapesOp, HealOp
global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp global InsertOp, BoolOp, TrsfOp, LocalOp, MeasuOp, BlocksOp, GroupOp
geomStudy = theStudy myStudy = theStudy
geomStudyId = geomStudy._get_StudyId() myStudyId = myStudy._get_StudyId()
geomBuilder = geomStudy.NewBuilder() myBuilder = myStudy.NewBuilder()
father = geomStudy.FindComponent("GEOM") father = myStudy.FindComponent("GEOM")
if father is None: if father is None:
father = geomBuilder.NewComponent("GEOM") father = myBuilder.NewComponent("GEOM")
A1 = geomBuilder.FindOrCreateAttribute(father, "AttributeName") A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
FName = A1._narrow(SALOMEDS.AttributeName) FName = A1._narrow(SALOMEDS.AttributeName)
FName.SetValue("Geometry") FName.SetValue("Geometry")
A2 = geomBuilder.FindOrCreateAttribute(father, "AttributePixMap") A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
aPixmap = A2._narrow(SALOMEDS.AttributePixMap) aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry") aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
geomBuilder.DefineComponentInstance(father,geom) myBuilder.DefineComponentInstance(father,geom)
pass pass
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Assign Operations Interfaces # Assign Operations Interfaces
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
BasicOp = geom.GetIBasicOperations (geomStudyId) BasicOp = geom.GetIBasicOperations (myStudyId)
CurvesOp = geom.GetICurvesOperations (geomStudyId) CurvesOp = geom.GetICurvesOperations (myStudyId)
PrimOp = geom.GetI3DPrimOperations (geomStudyId) PrimOp = geom.GetI3DPrimOperations (myStudyId)
ShapesOp = geom.GetIShapesOperations (geomStudyId) ShapesOp = geom.GetIShapesOperations (myStudyId)
HealOp = geom.GetIHealingOperations (geomStudyId) HealOp = geom.GetIHealingOperations (myStudyId)
InsertOp = geom.GetIInsertOperations (geomStudyId) InsertOp = geom.GetIInsertOperations (myStudyId)
BoolOp = geom.GetIBooleanOperations (geomStudyId) BoolOp = geom.GetIBooleanOperations (myStudyId)
TrsfOp = geom.GetITransformOperations(geomStudyId) TrsfOp = geom.GetITransformOperations(myStudyId)
LocalOp = geom.GetILocalOperations (geomStudyId) LocalOp = geom.GetILocalOperations (myStudyId)
MeasuOp = geom.GetIMeasureOperations (geomStudyId) MeasuOp = geom.GetIMeasureOperations (myStudyId)
BlocksOp = geom.GetIBlocksOperations (geomStudyId) BlocksOp = geom.GetIBlocksOperations (myStudyId)
GroupOp = geom.GetIGroupOperations (geomStudyId) GroupOp = geom.GetIGroupOperations (myStudyId)
pass pass
init_geom(myStudy) init_geom(myStudy)
@ -117,7 +117,7 @@ def addToStudy(aShape, aName):
* Example: see GEOM_TestAll.py * Example: see GEOM_TestAll.py
""" """
try: try:
aSObject = geom.AddInStudy(geomStudy, aShape, aName, None) aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
except: except:
print "addToStudy() failed" print "addToStudy() failed"
return "" return ""
@ -130,7 +130,7 @@ def addToStudyInFather(aFather, aShape, aName):
* Example: see GEOM_TestAll.py * Example: see GEOM_TestAll.py
""" """
try: try:
aSObject = geom.AddInStudy(geomStudy, aShape, aName, aFather) aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
except: except:
print "addToStudyInFather() failed" print "addToStudyInFather() failed"
return "" return ""