Block

A block is cuboid with a set size in each direction [A, B, C] and centroid [X, Y, Z]. The SDK currently only supports rectangular, prism-shaped blocks.

Blocks are used to make more complex block models. How they are created depends on the type of block model being created. There are two types of block models that can be created: a DenseBlockModel and a SubBlockModel.

Manipulating a Model’s Blocks

The following is a list of properties and methods that can be used to manipulate a block-based model:

Name Description
block_count

Use this read-only property to return the number of blocks in a model. This could be useful for when you want to perform an operation on a number of blocks. You can use this property to iterate over each block in a model.

block_resolution Use this read-only property to return the resolution of blocks in a block model.
block_centroids Use this read-only property to return the centroid of each block in a model.
block_sizes Use this read-only property to return the block sizes of each block in a model.
block_colours

Use this property to set the colours of each block in a model. The colour of each block is represented by an array containing four values [R, G, B, A] where:

  • R, G and B is a value between 0 and 255.

  • A is a value between 0 and 255 where 0 represents full transparency and 255 represents no transparency. This value is optional and can use an [R, G, B] format instead.

slice_count Use this read-only property to return the number of slices in a block model. If the block model hasn’t rotated, the number of slices in a block model will equal the number of blocks in the z-direction.
row_count Use this read-only property to return the number of rows in a block model. If the block model hasn’t been rotated, the number of rows in a block model will equal the number of blocks in the y-direction.
column_count Use this read-only property to return the number of columns in a block model. If the block model hasn’t been rotated, the number of columns in a block model will equal the number of blocks in the x-direction.
block_selection Use this property to select blocks in a block model. The selection of each block is represented by a boolean value in an array. True means that the block is selected while False means that the block is not selected. By default, block_selection is set to False.
block_visibility Use this property to set the visibility of each block in a block model. The visibility of each block is represented by a boolean value in an array. True means that the block is visible while False means that the block is not visible. By default, block_visibility is set to True.
block_attributes Use this property to set or return the custom block attributes of a model. To set a particular block attribute, you can use the notation block_attributes[attribute_name] = data.
origin Use this property to set the origin of a block model.
block_to_grid_index Use this property to retrieve the row, column and slice that contains the centroid for each block. Each item in the array is an array which appears in the form [row, column, slice].
orientation Use this read-only property to retrieve the orientation of a block model. You will return a tuple of the form (dip, plunge, bearing).
set_orientation(dip, plunge, bearing) Use this method to set the orientation of a block model. This method takes three parameters — dip, plunge and bearing.
grid_index(start, end) Use this method to return all of the subblocks within a parent block. The parent block is defined by its row, count and slice. The start and end parameters are arrays of three items, [row, count, slice].
rotate(angle, axis) Use this method to rotate a block model by the specified angle around the specified axis.

You can read more about the Block primitive class in the class references.