3 #===============================================
4 A = batchmode_geompy.myBuilder.FindOrCreateAttribute(batchmode_geompy.father, "AttributeTableOfReal")
6 raise RuntimeError, "Can't create AttributeTableOfReal attribute"
7 A = A._narrow(SALOMEDS.AttributeTableOfReal)
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())
53 rnb = A.GetNbRows() + 1
54 for i in range(1, rnb):
58 cnb = A.GetNbColumns() + 1
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 #--------------------------------------------------------------------------#
76 str= os.getenv("TmpDir")
79 file = str+"/test.hdf"
81 print(" ------- We will save to", file, "-----------")
83 batchmode_geompy.myStudy.SaveAs(file)
85 #--------------------------------------------------------------------------#
86 #---------------------------- Open file -----------------------------------#
87 #--------------------------------------------------------------------------#
89 print" -------------- Open " + file + "-------------- "
91 openedStudy = batchmode_geompy.myStudy.Open(file)
92 if openedStudy == None:
93 raise RuntimeError, "Can't open saved study!"
95 father = openedStudy.FindComponent("GEOM")
97 raise RuntimeError, "Geom component is not found! Wrong study is opened."
99 # --- check attribute ---
101 res,A=father.FindAttribute("AttributeTableOfReal")
102 if res == 0 or A == None:
103 raise RuntimeError, "Error: not found AttributeTableOfReal"
105 A = A._narrow(SALOMEDS.AttributeTableOfReal)
108 print("Common title : ",A.GetTitle())
109 print("Rows titles : ", A.GetRowTitles())
110 rnb = A.GetNbRows() + 1
111 for i in range(1, rnb):
115 cnb = A.GetNbColumns() + 1
116 print("Columns title : ", A.GetColumnTitles())
117 for i in range(1, cnb):
121 titles=["ff","ss","tt"]
122 A.SetRowTitles(titles)
123 print("Rows titles : ", A.GetRowTitles())
125 titles=["ww","zz","cc"]
126 A.SetColumnTitles(titles)
127 print("Column titles : ", A.GetColumnTitles())