
0
Save information generated in the script
Hello!!
I have created a python script in micromine, check the examples and if you show me how to use the block model information, but I would like to know how I save the information that I am going to modify in a new field created in the block model table.
@author: USER
"""
BMFileName = MMpy.Project.path() + "model_1c.DAT"
Xfield,Yfield,Zfield = "EAST","NORTH","ELEV"
myBM = MMpy.BlockModel()
myBM.open(BMFileName,Xfield,Yfield,Zfield)
field = "TCU"
fieldID = myBM.get_field_id(field)
recordID = 1
int(recordID)
while (recordID < 10):
print(myBM.get_num_block_value(fieldID,recordID))
print(myBM.get_num_block_value(fieldID,recordID)*100)
recordID = recordID +1
#else:
# print("error")
I am attentive to your comments
thanks you
Customer support service by UserEcho
Hi Gustavo,
I think it would be something like this (not tested):
######################
...
precision = 4
new_field= "test"
field = "TCU"
struct = myBM.structure
struct.add_field(new_field, MMpy.FieldType.real,4,precision)
myBM.structure = struct
fieldID = myBM.get_field_id(field)
newfield_ID = myBM.get_field_id(new_field)
recordID = 1
while (recordID < 10):
value = myBM.get_num_block_value(fieldID,recordID)*100
myBM.set_block_value(newfield_ID ,recordID,value )
myBM.close()
######################
Cheers