MMpy.BlockModel.set_block_value
Syntax
blockmodel.set_block_value(field_id, record_id, value)
Description
Assign a string or a numeric value to a block attribute identified by the given field ID and record ID.
Parameters
Name |
Type |
Description |
---|---|---|
field_id |
int | The ID of the target field. |
record_id |
int | The ID of the target record. |
value |
float or str | The value to assign as the block value. |
Returns
Type |
Description |
---|---|
bool | Returns True if the block value was successfully set, otherwise returns False. |
See Also
MMpy.BlockModel.get_num_block_value()
MMpy.BlockModel.get_str_block_value()
Notes
Record IDs are 1-based, meaning passing an index of 1 will return the first record.
Examples
blockmodel_filename = MMpy.Project.path() + 'Block_Model.DAT' x_field, y_field, z_field = 'EAST', 'NORTH', 'RL' blockmodel = MMpy.BlockModel() blockmodel.open(blockmodel_filename, x_field, y_field, z_field) num_field = 'NUMVALUE' num_field_id = blockmodel.get_field_id(num_field) str_field = 'STRVALUE' str_field_id = blockmodel.get_field_id(str_field) blockmodel.set_block_value(num_field_id, 1, 0.5) blockmodel.set_block_value(str_field_id, 1, 'A string value') blockmodel.close()
Resource ID
IDPH_BM_SET_BLOCK_VALUE