3 #=======================================================================================================
4 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeTableOfInteger")
6 raise RuntimeError, "Can't create AttributeTableOfInteger attribute"
7 A = A._narrow(SALOMEDS.AttributeTableOfInteger)
31 # change attribute values
32 print "A.GetValue(2,2) = ", A.GetValue(2,2)
33 print "A.PutValue(2,2,625323)"
34 A.PutValue(625323,2,2)
35 print "A.GetValue(2,2) = ", A.GetValue(2,2)
45 A.SetColumnTitle(1,"FC")
46 A.SetColumnTitle(2,"SC")
47 A.SetColumnTitle(3,"TC")
51 print "Common title : ",A.GetTitle()
52 print "Rows titles : ", A.GetRowTitles()
54 for i in range(1, rnb):
58 cnb = A.GetNbColumns()
59 print "Columns title : ", A.GetColumnTitles()
60 for i in range(1, cnb):
65 #titles=["11","12","13"]
66 #A.SetRowTitles(titles)
67 #titles=["21","22","23"]
68 #A.SetRowTitles(2,titles)
69 #titles=["31","32","33"]
70 #A.SetRowTitles(3,titles)
72 #--------------------------------------------------------------------------#
73 # ----------------------- save the study ----------------------------------#
74 #--------------------------------------------------------------------------#
75 str= os.getenv("TmpDir")
78 file = str+"/test.hdf"
80 print " ------- We will save to", file, "-----------"
82 batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy)
84 #--------------------------------------------------------------------------#
85 #---------------------------- Open file -----------------------------------#
86 #--------------------------------------------------------------------------#
88 print" -------------- Open " + file + "-------------- "
90 openedStudy=batchmode_geompy.myStudyManager.Open(file)
91 if openedStudy == None:
92 raise RuntimeError, "Can't open saved study!"
94 father = openedStudy.FindComponent("GEOM")
96 raise RuntimeError, "Geom component is not found! Wrong study is opened."
98 # --- check attribute ---
100 res,A=father.FindAttribute("AttributeTableOfInteger")
101 if res == 0 or A == None:
102 raise RuntimeError, "Error: not found AttributeTableOfInteger"
104 A = A._narrow(SALOMEDS.AttributeTableOfInteger)
107 print "Common title : ",A.GetTitle()
108 print "Rows titles : ", A.GetRowTitles()
110 for i in range(1, rnb):
114 cnb = A.GetNbColumns()
115 print "Columns title : ", A.GetColumnTitles()
116 for i in range(1, cnb):
120 titles=["ff","ss","tt"]
121 A.SetRowTitles(titles)
122 print "Rows titles : ", A.GetRowTitles()
124 titles=["ww","zz","cc"]
125 A.SetColumnTitles(titles)
126 print "Column titles : ", A.GetColumnTitles()