maptek.vulcan module

This module provides access to Vulcan functionality that does not require Envisage interaction.

Some of the available data classes are:
  • Block models

  • Design Databases

  • Design Layers

  • Design Objects (Polylines, Text, Dimensions, etc)

  • Design Object Attributes and Metadata

  • Design Points

  • Grids

  • Isis databases

  • Map files

  • Triangulations

  • Variant data (spec files, etc)

class variant(*args, **kwargs)

Bases: MutableMapping

Class to access Vulcan specification files from Variant formats. This implementation behaves like a dictionary with the additional ability to load and save the specfile to the original specification file type.

load(specfile)

Loads a Vulcan specification file.

save()

Saves a Vulcan spec file to the original name and type.

save_as(specfile=None)

Saves a spec file with a new name.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
values() an object providing a view on D's values
class isisdb(name: str, mode: str, env: str = '')

Bases: object

Interface for Vulcan isis databases.

Instantiates a new isisdb object. Can be used to open an existing database or create a new one.

If creating a new database, this will automatically look for a design file with a name matching the first part of the extension given.

For example, `vulcan.isisdb("holes.dhd.isis", "create")` will look for a file named “dhd.dsf” to use as the design.

Parameters:
  • name (str) – The file path of the database to load or create. File must exist for load, and must not exist for create.

  • mode (str) – The mode to open the database. Options are: ‘r’ - read-only existing database. ‘create’ - create a new database. ‘w’ - read and write existing database.

  • env (str, optional) – Deprecated, included only for backwards compatibility.

Example

Move through all the records and print them. Similar example using for record in db syntax in isisdb.__iter__()

>>> with vulcan.isisdb("mydatabase.cmp.isis", "r") as db:
>>>     db.rewind()
>>>     while not db.eof():
>>>         db.next()
>>>         table = db.get_table_name()
>>>         for field in db.field_list(table):
>>>             print (f"{table:10s}:{field:10s}:{str(db[field]):10s}")
open(name: str, mode: str, env: str = '') int

Open a new database connection on an existing isisdb object. Can be used to open an existing database or create a new one.

Parameters:
  • name (str) – The file path of the database to load or create. File must exist for load, and must not exist for create.

  • mode (str) – The mode to open the database. Options are: ‘r’ - read-only existing database. ‘create’ - create a new database. ‘w’ - read and write existing database.

  • env (str, optional) – Deprecated, included only for backwards compatibility.

Returns:

0 if successful, -1 otherwise.

Return type:

int

close() int

Close the database, performing any pending write operations. It is not valid to continue to use a database after it has been closed.

Returns:

0 if successful, 1 otherwise.

Return type:

int

key_list() list[str]

Get the list of keys from the current database.

Returns:

The keys in the database.

Return type:

list[str]

Raises:

OSError – If the database is invalid, commonly if it is missing or locked.

table_list() list[str]

Get the list of tables in the database.

Returns:

The names of the tables in the database.

Return type:

list[str]

field_list(table_name: str) list[str]

Get the list of fields within a table in the database.

Parameters:

table_name (str) – The name of the table to list the fields of.

field_list_numbers(table_name: str) list[str]

Get the list of numeric fields within a table in the database.

Parameters:

table_name (str) – The name of the table to list the fields of.

field_list_strings(table_name: str) list[str]

Get the list of string fields within a table in the database.

Parameters:

table_name (str) – The name of the table to list the fields of.

is_field(field: str, table_name: str = '') bool

Check whether a field exists in a given table.

Parameters:
  • field (str) – The name of the field to check for existence.

  • table_name (str, optional) – The name of the table to check for the field. Defaults to the table at the current record position.

Returns:

True if the field exists in the table, False otherwise.

Return type:

bool

is_number(field: str, table_name: str = '') bool

Check if a field is numeric.

Parameters:
  • field (str) – The name of the field to check is numeric.

  • table_name (str, optional) – The name of the table to check for the numeric field. Defaults to the table at the current record position.

Returns:

True if the field is numeric, False otherwise.

Return type:

bool

is_string(field: str, table_name: str = '') bool

Check if a field is a string field.

Parameters:
  • field (str) – The name of the field to check is a string field.

  • table_name (str, optional) – The name of the table to check for the string field. Defaults to the table at the current record position.

Returns:

True if the field is a string field, False otherwise.

Return type:

bool

field_index(name: str, table: str) int

Return a one-based field index.

Warning

This function is deprecated and will be removed in a future release. Use get_field_index() instead.

See also

get_field_index

Gets the index of a field within a table.

get_field_index(name: str, table: str) int

Return the index of a field within a table.

Parameters:
  • name (str) – The name of the field to search for.

  • table (str, optional) – The name of the table to search in. Defaults to the table at the current record position.

Returns:

The index of the field.

Return type:

int

Raises:

NameError – If table not in database, or field not in table.

get_table_index(name: str) int

Get the index of a table in the database.

Parameters:

name (str) – The name of the table to get the index of.

Returns:

The index of the table if it exists, -1 otherwise.

Return type:

int

get_default(field_id: int | str, table_id: int | str) float

Get the default value of a numeric field.

Parameters:
  • field_id (int or str) – The name or index of the field to get the default value of.

  • table_id (int or str) – The name or index of the table the field belongs to.

Returns:

The default value of the field.

Return type:

float

get_default_string(field_id: int | str, table_id: int | str)

Get the default value of a string field.

Parameters:
  • field_id (int or str) – The name or index of the field to get the default value of.

  • table_id (int or str) – The name or index of the table the field belongs to.

Returns:

The default value of the field.

Return type:

str

get_table_name() str

Get the table name of the current record.

Returns:

The table name of the current record.

Return type:

str

get_subtype() str

Get the subtype of the current record.

Returns:

The subtype of the current record.

Return type:

str

put_table_name(rec_type: str) int

Sets a table on the current record, filling any fields with their default values.

Parameters:

rec_type (str) – The name of the table that defines the type of table that will be assigned to the current record

Raises:

NameError – If rec_type is not a valid table.

get(name: str | None = None, field_index: int | None = None) float

Get the numeric value of a field in the current table, either by name or by index.

Parameters:
  • name (str, optional) – The name of the field to get the value of.

  • field_index (int, optional) – The index of the field to get the value of.

Returns:

The value of the field.

Return type:

float

Raises:

Exception – When an error occurs. Check the console for more information.

get_string(name: str | None = None, field_index: int | None = None)

Get the string value of a field in the current table, either by name or by index.

Parameters:
  • name (str, optional) – The name of the field to get the value of.

  • field_index (int, optional) – The index of the field to get the value of.

Returns:

The value of the field.

Return type:

str

Raises:

Exception – When an error occurs. Check the console for more information.

put(self, name: 'str', v: 'float | str | int')

Put a numeric value into a field.

Parameters:
  • name (str) – The name of the field to store the value.

  • v (float|int|str) – The value to put. Note that any strings passed will be converted to numeric values.

Raises:

PermissionError – If the database was opened in read-only mode.

Overload

put(self, field_index: ‘int’, v: ‘float | str | int’)

Put a numeric value into a field.

Parameters:
  • field_index (i) – The index of the field to store the value.

  • v (float|int|str) – The value to put. Note that any strings passed will be converted to numeric values.

Raises:

PermissionError – If the database was opened in read-only mode.

put_string(self, name: 'str', v: 'float | int | str')

Put a string value into a field.

Parameters:
  • name (str) – The name of the field to store the value.

  • v (str or float) – The value to put. Numeric values will be cast to str.

Raises:

PermissionError – If the database was opened in read-only mode.

Overload

put_string(self, field_index: ‘int’, v: ‘float | int | str’)

Put a string value into a field.

Parameters:
  • field_index (int) – The index of the field to store the value.

  • v (str) – The value to put. Numeric values will be cast to str.

Raises:

PermissionError – If the database was opened in read-only mode.

get_position() float

Get the position of the current record.

Returns:

The position of the current record in the database, or -1 on error.

Return type:

float

set_position(pos: float) int

Set the current record position.

Parameters:

pos (float) – The position to set.

Returns:

0 if successful, 1 otherwise.

Return type:

int

find_key(key: str) int

Move the current record to the first occurrence of a given key.

Parameters:

key (str) – The key to move to. Wildcard matching supported.

Returns:

0 if successful, 1 otherwise.

Return type:

int

next_key() int

Move the current record position to the start of the next key.

Returns:

0 if successful, 1 otherwise.

Return type:

int

next_same_key() int

Move the current record to the next record with the same key.

Returns:

0 if successful, or -1 if the next record is in a new key, and will not advance further.

Return type:

int

delete_key(key: str) int

Delete any records belonging to a key from the database.

Parameters:

key (str) – The key to remove from the database. Wildcard matching supported.

Returns:

0 if successful, 1 otherwise.

Return type:

int

get_key() str

Get the key of the current record.

Returns:

The key of the current record.

Return type:

str

synonym(db_type: str, name: str) str

Look up a synonym in the database.

Parameters:
  • db_type (str) – The type of the database.

  • name (str) – The standard name of the data to look up the synonym for.

Returns:

The synonym.

Return type:

str

field_size(field: str, table_name: str) int

Get the size of a field.

Parameters:
  • field (str) – The name of the field to get the size of.

  • table_name (str) – The name of the table the field belongs to.

Returns:

The size of the field, or 0 if the field cannot be found.

Return type:

int

next() int

Move to the next record.

Returns:

0 if successful, 1 if now at end of file, -1 if failure.

Return type:

int

rewind() int

Move to the first record.

Returns:

0 if successful, 1 otherwise.

Return type:

int

write() int

Write the current record back to the database, saving any pending changes.

Returns:

0 if successful, 1 otherwise.

Return type:

int

insert_after() int

Insert the current buffer after the current record.

Returns:

0 if successful, 1 otherwise.

Return type:

int

insert_before() int

Insert the current buffer before the current record.

Returns:

0 if successful, 1 otherwise.

Return type:

int

get_buffer() str

Get the trimmed record buffer for the current record.

Returns:

The trimmed record buffer of the current record.

Return type:

str

append_buffer(table_name: str, buffer: str) int

Append a buffer to the current record.

Parameters:
  • table_name (str) – The name of the table to associate the buffer with.

  • buffer (str) – The buffer to append.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

PermissionError – If the database was opened in read-only mode.

append() int

Append the current record to the end of the database.

Returns:

0 if successful, 1 otherwise.

Return type:

int

delete_record() int

Delete the current record from the database.

Returns:

0 if successful, 1 otherwise.

Return type:

int

get_raw_header() bytes

Get the raw header of the database. This will be a design, including the number of records.

Returns:

The header of the database.

Return type:

bytes

get_raw_layer(layer: str) bytes

Get all of a layer’s records as a single binary buffer.

Parameters:

layer (str) – The layer to get.

Returns:

The layer data.

Return type:

bytes

has_dsr() int

Check if the database contains DSR information.

Returns:

1 if the database contains DSR information, 0 otherwise.

Return type:

int

get_coordinate(depth: float) list[float]

Get the coordinate of a drillhole at a given depth.

Parameters:

depth (float) – The depth to query the drillhole coordinates at.

Returns:

The (X, Y, Z) position of the drillhole at the given depth.

Return type:

list[float]

get_multiple(fields: list[str]) list[float]

Get the values of multiple numeric fields simultaneously.

Parameters:

fields (list[str]) – The list of field names to get the values of.

Returns:

The values of the fields, in the same order as the field names were passed.

Return type:

list[float]

get_multiple_string(fields: list[str]) list[str]

Get the values of multiple string fields simultaneously.

Parameters:

fields (list[str]) – The list of field names to get the values of.

Returns:

The values of the fields, in the same order as the field names were passed.

Return type:

list[str]

eof() bool

Check whether the current record position is the end of file.

Returns:

True if at end of file, False otherwise.

Return type:

bool

is_open() bool

Check whether the database is currently open.

Returns:

True if the database is open, False otherwise.

Return type:

bool

__iter__()

Generator to move through all records in an isisdb

Yields:

self – Database index for each record.

Example

>>> # Iterates through all the records in a database and
>>> # prints the data.
>>> for record in db:
>>>     table = db.get_table_name()
>>>     for field in record.field_list(table):
>>>         print ("%10s:%10s:%10s" %(table, field, record[field]))
property keys: Iterator[str]

Generator to move from one key to the next in an isisdb

Yields:

self – Database index for each key.

Example

>>> # Iterates through all the keys in a database and
>>> # prints the key names.
>>> for key in db.keys:
>>>     print (db.get_key())
property this_key: str

Get the current position key.

Returns:

The key at the current record position.

Return type:

str

key(key: str = '')

This is a generator to loop through the records in the current or specified key. If no key is provided, it will loop over the current key records. If a key name is provided, it will move until that key is found and return the records of that key.

Parameters:

key (str, optional) – Key name to be looped. Defaults to the current key.

Yields:

self – Database index for the specified key

Raises:

NameError – When no key found.

Example

>>> # Prints the contents of the depth field for the
>>> # key LK177 on the table SURVEY
>>> for record in db.key("LK177"):
>>>     if db.get_table_name() == "SURVEY":
>>>         print (record['DEPTH'])
this_table(table: str = '')

This is a generator to loop in the current or specified table of the current key. If no table is provided, it will loop over the current table. If a table name is provided, it will move until that table is found and return the results of that table. If no table is found, it will return nothing.

Parameters:

table (str, optional) – Table name to be looped. Defaults to the current table.

Yields:

self – Database index for the specified table

Example

>>> # Prints the contents of the depth field for the
>>> # survey table (on the current key)
>>> for record in db.this_table("SURVEY"):
>>>     print (record['DEPTH'])
goto_table(table: str) bool

This is a function that will move to a specified table name by moving to the beginning of the current key and finding the start of the specified table name.

Parameters:

table (str) – Table name to be found

Returns:

True on success and position of current record is set.

Return type:

bool

Raises:

NameError – When no table found with the matching name.

Examples

>>> # Goes to a requested table name
>>> db.goto_table("SURVEY"):
class block_model(name: str, mode: str = 'w', env_deprecated: str = '')

Bases: object

Interface for Vulcan block models

__init__(name: str, mode: str = 'w', env_deprecated: str = '') None

Instantiate a new block model object. This can either load an existing block model from file or create a new one.

Parameters:
  • name (str) – The file path of the block model to open. If attempting to load an existing model, this file must exist. If attempting to create a new model, this file must not exist.

  • mode (str) – Mode to open the block model. Options are ‘w’ - write mode ‘r’ - read mode ‘create’ - create mode

  • env_deprecated (str) – Project environment - deprecated, included only for backwards compatibility.

Returns:

The block model object.

Return type:

block_model

Raises:

OSError – If the model is unable to be opened.

open(name: str, mode: str = 'w', env_deprecated: str = '')

Open a different block model. This will clear any information about the previous block model the object referred to.

Parameters:
  • name (str) – The file path of the block model to open. If attempting to load an existing model, this file must exist. If attempting to create a new model, this file must not exist.

  • mode (str) – Mode to open the block model. Options are ‘r’ - read mode ‘w’ - write mode ‘create’ - create mode

  • env_deprecated (str) – Deprecated, included only for backwards compatibility.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

OSError – If the model is unable to be opened.

create_regular(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int, nz: int) int

Create a new regular block model. This will clear any information about the previous block model the object referred to.

Parameters:
  • name (str) – The file path for the new block model.

  • x0 (float) – The minimum X coordinate of the model extent.

  • y0 (float) – The minimum Y coordinate of the model extent.

  • z0 (float) – The minimum Z coordinate of the model extent.

  • x1 (float) – The maximum X coordinate of the model extent.

  • y1 (float) – The maximum Y coordinate of the model extent.

  • z1 (float) – The maximum Z coordinate of the model extent.

  • nx (int) – The number of blocks in the X direction.

  • ny (int) – The number of blocks in the Y direction.

  • nz (int) – The number of blocks in the Z direction.

Returns:

0 if successful, 1 otherwise.

Return type:

int

create_irregular(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int, nz: int, sub_nx: int | None = None, sub_ny: int | None = None, sub_nz: int | None = None) int

Create a new irregular block model optionally with a sub schema. This will clear any information about the previous block model the object referred to.

If any optional sub_* arguments are given, all 3 are required.

Parameters:
  • name (str) – The file path for the new block model.

  • x0 (float) – The minimum X coordinate of the model extent.

  • y0 (float) – The minimum Y coordinate of the model extent.

  • z0 (float) – The minimum Z coordinate of the model extent.

  • x1 (float) – The maximum X coordinate of the model extent.

  • y1 (float) – The maximum Y coordinate of the model extent.

  • z1 (float) – The maximum Z coordinate of the model extent.

  • nx (int) – The number of blocks in the X direction for the main schema.

  • ny (int) – The number of blocks in the Y direction for the main schema.

  • nz (int) – The number of blocks in the Z direction for the main schema.

  • sub_nx (int, optional) – The number of blocks in the X direction for the sub schema.

  • sub_ny (int, optional) – The number of blocks in the Y direction for the sub schema.

  • sub_nz (int, optional) – The number of blocks in the Z direction for the sub schema.

Returns:

0 if successful, 1 otherwise.

Return type:

int

create_strat(name: str, x0: float, y0: float, z0: float, x1: float, y1: float, z1: float, nx: int, ny: int) int

Create a new stratigraphic block model. This will clear any information about the previous block model the object referred to.

Parameters:
  • name (str) – The file path for the new block model.

  • x0 (float) – The minimum X coordinate of the model extent.

  • y0 (float) – The minimum Y coordinate of the model extent.

  • z0 (float) – The minimum Z coordinate of the model extent.

  • x1 (float) – The maximum X coordinate of the model extent.

  • y1 (float) – The maximum Y coordinate of the model extent.

  • z1 (float) – The maximum Z coordinate of the model extent.

  • nx (int) – The number of blocks in the X direction.

  • ny (int) – The number of blocks in the Y direction.

Returns:

0 if successful, 1 otherwise.

Return type:

int

translate(x: float, y: float, z: float) int

Translate the origin of the block model.

This operation is additive, i.e.

>>>   block_model.translate(0.0, 10.0, 0.0)
>>>   block_model.translate(5.0, 0.0, 0.0)

is the same as

>>>   block_model.translate(5.0, 10.0, 0.0)
Parameters:
  • x (float) – The distance to translate the block model in the X direction.

  • y (float) – The distance to translate the block model in the Y direction.

  • z (float) – The distance to translate the block model in the Z direction.

Return type:

0 if successful.

Raises:

PermissionError – If the block model is open in read only mode.

See also

set_model_origin

Set the origin to given coordinates.

rotate

Change the rotation of the model.

rotate(x: float, y: float, z: float) int

Rotate the block model about its origin.

This operation is additive, i.e.

>>>   block_model.rotate(0.0, 10.0, 0.0)
>>>   block_model.rotate(5.0, 0.0, 0.0)

is the same as

>>>   block_model.rotate(5.0, 10.0, 0.0)
Parameters:
  • x (float) – The amount (in degrees) to rotate the model in the X axis.

  • y (float) – The amount (in degrees) to rotate the model in the Y axis.

  • z (float) – The amount (in degrees) to rotate the model in the Z axis.

Raises:

PermissionError – If the block model is open in read only mode.

See also

set_model_orientation

Set the rotation of the model to the given values.

scale(x: float, y: float, z: float) int

Multiplicatively scale the block model size.

Parameters:
  • x (float) – The amount to scale the X axis by.

  • y (float) – The amount to scale the Y axis by.

  • z (float) – The amount to scale the Z axis by.

Raises:

PermissionError – If the block model is open in read only mode.

description() str

Get the description of the block model.

Returns:

The description.

Return type:

str

select(selection: str) int

Specify block selection criteria for a block model. Note that this will overwrite any selection at the current level.

Parameters:

selection (str) –

The selection criteria string.

The selection is in the form an argument string for programs like bcalc. The most useful feature is block selection by triangulation: ‘’’-t “mytri.00t”’’’ or f’’’-t “{myTriVariable}”’’’ Other useful options are -n and -u for upper and lower surface triangulation, and -O (capital o) or blocks outside the triangulation, and -b xl,xu,yl,yu,zl,zu for a bounding box.

Possible options are:

-v <variable> [value]

Mask with variable.

-t <triangulation>

Bounding triangulation. Blocks with centroids inside the triangulation will be selected. The -X option may be applied to select based on block extents.

-n <top surface>

Top bounding surface triangulation.

-u <lower surface>

Lower bounding surface triangulation.

-B <triangulation>

Use single bounding surface

-Z

Project down Z axis. Requires -B.

-O

Select blocks outside the solid only.

-bm <xl, xt, yl, yt, zl, zt>

Define the bounding extents using block model coordinates. When using this switch, you will need to specify the minimum and maximum X, Y and Z coordinates. Blocks having extents that are inside, or intersect these extents are selected.

-bw <xl, xt, yl, yt, zl, zt>
Define the bounding extents using real world coordinates.

When using this switch, you will need to specify the minimum and maximum X, Y and Z coordinates. Blocks having centroids that are inside the extents are selected. The -X option may be used to reproduce the extents intersection type selection of -bm.

-s <mx, my, mz>

Sub-block dimensions.

-p <a, b, c, d>

Include planed blocks.

-C <condition>

Use conditional expression.

-r <offset>

Provide a plane offset buffer.

-X

Use proportional volumes against solid. This modifies the block selection to include blocks that intersect the selecting volume.

-T

Use selection file with triangulations.

-S

Reverse block selection

Returns:

0 if successful, 1 otherwise.

Return type:

int

See also

push_select

Add a new selection to the selection stack.

pop_select

Remove the current selection from the selection stack.

select_xy_seam(x: float, y: float, seam: str) int

Set the selection to match blocks with the given seam in an xy grid square.

Parameters:
  • x (float) – The X coordinate to find blocks to match.

  • y (float) – The Y coordinate to find blocks to match.

  • seam (str) – The seam to match blocks against.

Returns:

0 if successful, 1 otherwise.

Return type:

int

push_select(selection: str) int

Add to the existing selection. Note that there is a limit of 5 ‘levels’ for the selection stack; that is after the initial selection is made, only an additional 4 selections can be pushed.

Returns:

0 if successful, 1 if the selection stack is full.

Return type:

int

pop_select() int

Remove the most recent selection from the selection stack.

Returns:

0 if successful, 1 if there is nothing to remove.

Return type:

int

close() int

Close the block model file.

Returns:

0 if successful, 1 otherwise.

Return type:

int

field_list() list[str]

Get the list of fields for the block model.

Returns:

The list of field names.

Return type:

list[str]

field_list_numbers() list[str]

Get the list of numeric fields for the block model.

Returns:

The list of numeric field names.

Return type:

list[str]

field_list_strings() list[str]

Get the list of string fields for the block model.

Returns:

The list of string field names.

Return type:

list[str]

get_translation_values(field_name: str) list[str]

Get the translation values for a field.

This provides the mapping from the values as integers (indices) to string values. Using get_string() will translate the value for a single block to its correpsonding string, where as this function allows bulk-translation of the underlying values.

This is especially useful for large models, where calling get_data_string() may use large amounts of memory. By getting the data out as an integer rather than a string, much less memory is required.

For example, you can call get_data_int64() to load all the values then map the values it return into the translation values for their strings.

>>>   selection = bm.get_matches()
>>>   var = 'region'
>>>   numeric_values = bm.get_data_int64(var, selection)
>>>   translation_values = bm.get_translation_values(var)
>>>   print(numeric_values, translation_values)
>>>   for value in numeric_values:
>>>       print(translation_values[value])

Another usage would be to count the occurence of each string, without ever needing to translate the data.

>>>   selection = bm.get_matches()
>>>   var = 'region'
>>>   translation_values = bm.get_translation_values(var)
>>>   counter = collections.Counter(bm.get_data_int64(var, selection))
>>>   for key, value in counter.items():
>>>      print(translation_values[key], value)
Parameters:

field_name (str) – The field to get the translation values for.

Returns:

The translation values.

Return type:

list[str]

is_field(field: str) bool

Check if the given field exists on the block model.

Parameters:

field (str) – The field to check for existence.

Returns:

True if the field exists, False otherwise.

Return type:

bool

is_number(field: str) bool

Check if the given field exists as a numeric field on the block model.

Parameters:

field (str) – The field to check exists and is numeric.

Returns:

True if the field exists and is numeric, False otherwise.

Return type:

bool

is_string(field: str) bool

Check if the given field exists as a string field on the block model.

Parameters:

field (str) – The field to check exists is a string field.

Returns:

True if the field exists and is a string field, False otherwise.

Return type:

bool

field_index(name: str) int

Get the index of a given field in the block model.

Parameters:

name (str) – The field to get the index for.

Returns:

The index of the given field.

Return type:

int

field_default(name: str) float

Get the default value of a field.

Parameters:

name (str) – The field name to get the default value for.

Returns:

The default float value of the field.

Return type:

float

field_default_string(name: str) str

Get the default value of a string field.

Parameters:

name (str) – The field name to get the default value for.

Returns:

The default string value of the field.

Return type:

str

field_description(name: str) str

Get the description of a field.

Parameters:

name (str) – The field name to get the description for.

Returns:

The description of the field.

Return type:

str

field_type(name: str) str

Get the type of a field.

Parameters:

name (str) – The field to get the type of.

Returns:

The type of the field. Possible valid return values (subject to change) are: [‘float’, ‘double’, ‘integer’, ‘byte’, ‘name’, ‘short’, ‘sfloat’, ‘int64’, ‘bit’] `***` is returned if the field doesn’t exist.

Return type:

str

field_predefined(name: str) int

Check if a field is a predefined field.

Parameters:

name (str) – The field to check.

Returns:

1 if the field is predefined, 0 otherwise.

Return type:

int

get_variable_index(name: str) int

Alias for field_index. Get the index of a field.

Parameters:

name (str) – The field to get the index of.

Returns:

The index of the field.

Return type:

int

get(name: str | None = None, k: int | None = None) float

Get the numeric value of a field, either by name or by index.

Parameters:
  • name (str) – The name of the field to get the value of.

  • k (int) – The index of the field to get the value of.

Returns:

The value of the field.

Return type:

float

get_string(name: str | None = None, i: int | None = None) str

Get the string value of a field, either by name or by index.

Parameters:
  • name (str) – The name of the field to get the value of.

  • i (int) – The index of the field to get the value of.

Returns:

The value of the field.

Return type:

str

put(self, name: 'str', v: 'str | float | int')

Set the value of a field, either by name or by index.

Parameters:
  • name (str) – The name of the field to set the value of.

  • k (int) – The index of the field to set the value of.

  • v (float or str) – The value to set.

Raises:

PermissionError – If the block model is open in read only mode.

Overload

put(self, k: ‘int’, v: ‘str | float | int’)

Set the value of a field, either by name or by index.

Parameters:
  • k (int) – The index of the field to set the value of.

  • v (float or str) – The value to set.

Raises:

PermissionError – If the block model is open in read only mode.

put_string(self, name: 'str', v: 'str')

Set the value of a string field, either by name or by index.

Parameters:
  • name (str) – The name of the field to set the value of.

  • v (str) – The value to set.

Raises:

PermissionError – If the block model is open in read only mode.

Overload

put_string(self, index: ‘int’, v: ‘str’)

Set the value of a string field, either by name or by index.

Parameters:
  • index (int) – The index of the field to set the value of.

  • v (str) – The value to set.

Raises:

PermissionError – If the block model is open in read only mode.

add_block(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) int

Add a new block to the model.

The block location is not validated upon adding. The block should be sized equal to a parent or sub block size and should be inserted at a location that correctly aligns to those coordinates.This should only be used where no blocks exist (such as deleted blocks), and will overlap existing blocks if a block already exists at the location.

Parameters:
  • x0 (float) – The X coordinate of the lower extent of the block.

  • y0 (float) – The Y coordinate of the lower extent of the block.

  • z0 (float) – The Z coordinate of the lower extent of the block.

  • x1 (float) – The X coordinate of the upper extent of the block.

  • y1 (float) – The Y coordinate of the upper extent of the block.

  • z1 (float) – The Z coordinate of the upper extent of the block.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

PermissionError – If the block model is open in read only mode.

move_block(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) int

Move the block at the current record to the given coordinates. Note that the ‘current record’ is that pointed to using rewind() and next().

Parameters:
  • x0 (float) – The X coordinate for the new lower extent of the block.

  • y0 (float) – The Y coordinate for the new lower extent of the block.

  • z0 (float) – The Z coordinate for the new lower extent of the block.

  • x1 (float) – The X coordinate for the new upper extent of the block.

  • y1 (float) – The Y coordinate for the new upper extent of the block.

  • z1 (float) – The Z coordinate for the new upper extent of the block.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

PermissionError – If the block model is open in read only mode.

delete_variable(name: str) int

Remove a variable from the block model.

Parameters:

name (str) – The name of the variable to delete.

Returns:

0 if successful, 1 otherwise.

Return type:

int

next() int

Move to the next record.

Ensure rewind() has been called before beginning iteration.

Returns:

0 if sucessful, 1 if the current block is the last record.

Return type:

int

rewind() int

Move to the first record.

Should be called after:
  • Opening a model

  • Making a selection

  • Iterating through the model, if there is more work to be performed.

get_position() float

Get the current record position.

Returns:

The current record position.

Return type:

float

set_position(pos: float) int

Set the current record position.

Parameters:

pos (float) – The position of the block to move to.

Returns:

0 if successful, 1 otherwise.

Return type:

int

find_xyz(x: float, y: float, z: float) int

Find a block at given model coordinates and set the record position.

Parameters:
  • x (float) – The X coordinate to look for the block.

  • y (float) – The Y coordinate to look for the block.

  • z (float) – The Z coordinate to look for the block.

Returns:

0 if successful, 1 otherwise.

Return type:

int

find_world_xyz(x: float, y: float, z: float) int

Find a block at given real world coordinates and set the record position.

Parameters:
  • x (float) – The X coordinate to look for the block.

  • y (float) – The Y coordinate to look for the block.

  • z (float) – The Z coordinate to look for the block.

Returns:

0 if successful, 1 otherwise.

Return type:

int

find_xy_seam(x: float, y: float, seam: str) int

Find the seam at given coordinates.

find_world_xyz_seam(x: float, y: float, z: float, seam: str) int

Find the seam at given real world coordinates.

Parameters:
  • x (float) – The X coordinate to look for the seam.

  • y (float) – The Y coordinate to look for the seam.

  • seam (str) – The name of the seam.

Returns:

0 if successful, 1 otherwise.

Return type:

int

to_world(x: float, y: float, z: float) list[float]

Convert a set of model coordinates to real world coordinates.

Parameters:
  • x (float) – The X coordinate to convert.

  • y (float) – The Y coordinate to convert.

  • z (float) – The Z coordinate to convert.

Returns:

The converted coordinates, in the form [X, Y, Z]

Return type:

list[float]

to_model(x: float, y: float, z: float) list[float]

Convert a set of real world coordinates to model coordinates.

Parameters:
  • x (float) – The X coordinate to convert.

  • y (float) – The Y coordinate to convert.

  • z (float) – The Z coordinate to convert.

Returns:

The converted coordinates, in the form [X, Y, Z]

Return type:

list[float]

model_extent() list[float]

Get the extent of the model.

Returns:

In the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.

Return type:

list[float]

model_orientation() list[float]

Get the orientation of the model.

Returns:

The amount of rotation (in degrees) for each axis, in the form [Z, X, Y]

Return type:

list[float]

model_origin() list[float]

Get the origin of the model.

Returns:

The origin coordinates, in the form [X, Y, Z]

Return type:

list[float]

set_model_origin(x0: float, y0: float, z0: float) int

Set the origin of the model.

Parameters:
  • x0 (float) – The X coordinate to set.

  • y0 (float) – The Y coordinate to set.

  • z0 (float) – The Z coordinate to set.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

PermissionError – If the model is open in read only mode.

set_model_orientation(a1: float, a2: float, a3: float) int

Set the orientation of the model.

Parameters:
  • a1 (float) – The amount of rotation (in degrees) in the Z direction.

  • a2 (float) – The amount of rotation (in degrees) in the X direction.

  • a3 (float) – The amount of rotation (in degrees) in the Y direction.

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

PermissionError – If the model is open in read only mode.

model_n_schemas() int

Get the number of schemas associated with the model.

Returns:

The number of schemas.

Return type:

int

model_schema_extent(k: int) list[float]

Get the extent of a schema within the model.

Parameters:

k (int) – The index of the schema to get the extent of.

Returns:

In the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.

Return type:

list[float]

model_schema_size(k: int) list[float]

Get the size of a schema within the model.

Parameters:

k (int) – The index of the schema to get the size of.

Returns:

The size of the schema, in the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax].

Return type:

list[float]

model_schema_dimensions(k: int) list[float]

Get the dimensions of a schema within the model.

Parameters:

k (int) – The index of the schema to get the dimensions of.

Returns:

The dimensions of the schema, in the form [X, Y, Z]

Return type:

list[float]

n_blocks() int

Get the number of blocks in the model.

Returns:

The number of blocks.

Return type:

int

match_extent() list[float]

Get the extent of the current match selection.

Returns:

The extent of the selection.

Return type:

list[float]

match_volume() float

Calculates the volume of the current match selection.

Returns:

The calculated volume.

Return type:

float

block_extent() list[float]

Get the extent of the currently selected block.

Returns:

For most models, this will be in the form [Xmin, Ymin, Zmin, Xmax, Ymax, Zmax] where the min values are the coordinates of the lower extent, and the max values are the coordinates of the upper extent.

Return type:

list[float]

index_model() int

Build the index for the block model.

Returns:

0 if successful, 1 otherwise.

Return type:

int

is_indexed() int

Check whether the block model is indexed.

Returns:

1 if the model is indexed, 0 otherwise.

Return type:

int

write() int

Write pending block changes to disk.

is_tb_model() bool

Check if the model is an ‘extended’ format model. All new models are ‘extended’ or TB models.

Returns:

True if the model is an extended (TB) model, False otherwise.

Return type:

bool

is_regular() bool

Check if the model is a regular model.

Returns:

True if the model is a regular model, False if the model is irregular.

Return type:

bool

get_matches(match_string: str) numpy.ndarray[numpy.int64]

Get the blocks that match the given match arguments.

Parameters:

match_string (str) – The match arguments.

Returns:

The indexes of the matched blocks.

Return type:

numpy.ndarray[Int64]

get_matches_extent(match_string: str) tuple[numpy.ndarray]

Get a list of NumPy arrays containing the block IDs and extents of each block selected in the match.

Parameters:

match_string (str) – The match arguments.

Returns:

The extents of the matched blocks, in the form tuple[[id], [Xmin], [Xmax], [Ymin], [Ymax], [Zmin], [Zmax]]. That is, a tuple of 7 NumPy arrays, where the first array is the list of IDs, the second is the list of minimum X values etc.

Return type:

tuple[numpy.ndarray]

Raises:

SyntaxError

get_data_double(name: str, n0: list[numpy.int64]) numpy.ndarray[numpy.double]

Get the float values of a variable in the block model. It is recommended to use get_data() instead.

Parameters:
  • name (str) – The variable to get the data from.

  • sel (list[numpy.int64]) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

Returns:

The data.

Return type:

numpy.ndarray[numpy.double]

Raises:

NameError – If the variable doesn’t exist.

get_data_float(name: str, n0: list[numpy.int64]) numpy.ndarray[float]

Get the float values of a variable in the block model. It is recommended to use get_data() instead.

Parameters:
  • name (str) – The variable to get the data from.

  • sel (list[Int64]) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

Returns:

The data.

Return type:

numpy.ndarray[float]

Raises:

NameError – If the variable doesn’t exist.

get_data_string(name: str, n0: list[numpy.int64]) numpy.ndarray[str]

Get the string values of a variable in the block model. It is recommended to use get_data() instead.

Parameters:
  • name (str) – The variable to get the data from.

  • sel (list[Int64]) – The IDs of blocks to get data from. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

Returns:

The data.

Return type:

numpy.ndarray[str]

Raises:

NameError – If the variable doesn’t exist.

get_data_int64(name: str, n0: list[numpy.int64]) numpy.ndarray[numpy.int64]

Get the int values of a variable in the block model.

put_data_double(name: str, n1: numpy.ndarray[numpy.double], n0: list[numpy.int64]) int

Store double data in the block model. It is recommended to use put_data() instead.

Parameters:
  • name (str) – The variable to put the data into.

  • data (numpy.ndarray[double]) – The data to store.

  • sel (list[Int64]) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

  • length. (Note that 'data' and 'sel' MUST have the same) –

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

NameError – If the variable doesn’t exist.

put_data_float(name: str, n1: numpy.ndarray[float], n0: list[numpy.int64]) int

Store float data in the block model. It is recommended to use put_data() instead.

Parameters:
  • name (str) – The variable to put the data into.

  • data (numpy.ndarray[float]) – The data to store.

  • sel (list[Int64]) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

  • length. (Note that 'data' and 'sel' MUST have the same) –

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

NameError – If the variable doesn’t exist.

put_data_string_list(name: str, data: numpy.ndarray[str], n0: list[numpy.int64]) int

Store string data in the block model.

Parameters:
  • name (str) – The variable to put the data into.

  • data (numpy.ndarray[str]) – The data to store.

  • sel (list[Int64]) – The IDs of blocks to put data into. This could be the result of get_matches() or ‘numpy.arrange(bm.n_blocks())’ for all blocks

  • length. (Note that 'data' and 'sel' MUST have the same) –

Returns:

0 if successful, 1 otherwise.

Return type:

int

Raises:

NameError – If the variable doesn’t exist.

get_regular_indices() numpy.ndarray[numpy.int64]

Get the indices of a regular block model, in i/j/k order.

Returns:

The indices of the blocks.

Return type:

numpy.ndarray[Int64]

Raises:

TypeError – If the block model is not a regular block model.

creation_date() str

Check when the block model was created.

Returns:

The date of the block model creation.

Return type:

str

modified_date() str

Check when the block model was last modified.

Returns:

The date of the last modification.

Return type:

str

get_multiple(fields: list[str]) list[float]

Get the values from multiple numeric fields in the block model.

Parameters:

fields (list[str]) – The list of field names to get values from.

Returns:

The requested values, in the same order as fields are passed.

Return type:

list[float]

get_multiple_string(fields: list[str]) list[str]

Get the values from multiple string fields in the block model.

Parameters:

fields (list[str]) – The list of field names to get values from.

Returns:

The requested values, in the same order as fields are passed.

Return type:

list[str]

eof() bool

Check if the current record position is the end of the file.

Returns:

True if at end of file, False otherwise.

Return type:

bool

is_open() bool

Check whether the block model file is open.

Returns:

True if the file is open, False otherwise.

Return type:

bool

add_variable(*args, **kwargs)
Parameters:
  • name (str) – Variable name

  • type (str) – Variable type (name, byte, short, integer, float, double)

  • default (str) – Default variable value

  • description (str) – Variable description

Returns:

0 = success, Non-zero = failure

Return type:

int

get_pandas(vars: list[str] = None, select: str = '') pandas.DataFrame

Gets block model data as a pandas.DataFrame

Parameters:
  • vars (list[str], optional) – Variable list to get from model. Defaults to all variables.

  • select (str, optional) – Selection string to use. Defaults to all blocks.

Return type:

pandas.DataFrame

get_pandas_extent(vars: list[str] = None, select: str = '') pandas.DataFrame

Gets all matches within an extent.

Parameters:
  • vars (list[str], optional) – Variable list to get from model. Defaults to all variables.

  • select (str, optional) – Selection string to use. Defaults to all blocks.

Returns:

Block model within the match extent.

Return type:

pandas.DataFrame

get_data(var: str, sel: list[int] = None) numpy.ndarray

Gets the values of a set of blocks, or all blocks if no selection is provided.

Parameters:
  • variable (str) – Variable to get data from

  • sel (list[int]) – List of block indices to get from such as the return from block_model.get_matches()

Returns:

NumPy array of all values for the specified variable.

Return type:

numpy.array()

Example

>>> matches = bm.get_matches('''-C "rocktype eq 'oxide'"''')
>>> data = bm.get_data("au", matches)
put_data(var: str, data: numpy.ndarray, sel: list[int] = None)

Stores the values of a numpy array into the block model.

Parameters:
  • variable (str) – Variable to get data from

  • data (numpy.array) – Data to be stored

  • sel (list[int]) – List of block indices to store to such as the return from block_model.get_matches()

Example

>>> matches = bm.get_matches('''-C "rocktype eq 'oxide'"''')
>>> bm.put_data("au", data, matches)
put_data_string(var: str, data: numpy.ndarray, sel: list[int] = None)

Stores numpy string array to a block model string variable.

Parameters:
  • var (str) – Variable name to write to.

  • data (numpy.array) – NumPy array with string data

  • sel (list) – Selection of block indices to write to (from get_matches())

put_pandas(dataframe: pandas.DataFrame, vars: list[str] = None)

Puts a Pandas dataframe into the block model.

Parameters:
  • dataframe (pandas.DataFrame) – DataFrame with block model data

  • vars (list[str], optional) – Variables to update. DataFrame columns used when no var list is provided.

get_grid(var: str) numpy.ndarray

Returns a 3D i/j/k grid of block model values for a regular block model.

Parameters:

var (str) – Variable name to get data for.

Returns:

3D numpy array with block values in i/j/k or x/y/z order

Return type:

numpy.array

put_grid(var: str, data: numpy.ndarray)

Stores a 3D i/j/k grid of values into a regular block model.

Parameters:
  • var (str) – Variable name to get data for.

  • data (numpy.array) – 3D numpy array of block model values for all blocks

class mapio(name: str, mode: str, env: str = '', project: str = '')

Bases: object

Interface for interacting with Vulcan map files.

__init__(name: str, mode: str, env: str = '', project: str = '') None

Initialize a new mapio object.

Parameters:
  • name (str) – The filepath of the map file to open.

  • mode (str) – The mode to open the map file. ‘r’ - read only mode. ‘w’ - read/write mode. ‘create’ - create new file.

  • env (str, optional) – The environment name to use.

  • project (str, optional) – The project code.

open(name: str, mode: str, env: str, project: str) int

Opens a different map file.

Parameters:
  • name (str) – The filepath of the map file to open.

  • mode (str) – The mode to open the map file. ‘r’ - read only mode. ‘w’ - read/write mode. ‘create’ - create new file.

  • env (str, optional) – The environment name to use.

  • project (str, optional) – The project code.

close() int

Closes the map file.

Returns:

0 if successful, 1 otherwise.

Return type:

int

field_list() list[str]

Get a list of all fields in the map file.

field_list_numbers() list[str]

Get a list of numeric fields in the map file.

field_list_strings() list[str]

Get a list of string/text fields in the map file.

is_field(field: str | int) bool

Check whether the given field exists in the map file.

Parameters:

field (str or int) – The name or index of a field to check for existence.

Returns:

True if found, False otherwise.

Return type:

bool

is_number(field: str | int) bool

Check whether the given field is numeric.

Parameters:

field (str or int) – The name or index of the field to check.

Returns:

True if the field is numeric, False otherwise.

Return type:

bool

is_string(field: str | int) bool

Check whether the given field is a string/text field.

Parameters:

field (str or int) – The name or index of the field to check.

Returns:

True if the field is a text field, False otherwise.

Return type:

bool

get(field: str | int) float

Get the value of a given numeric field.

Parameters:

field (str or int) – The name or index of the field to get the value of.

Returns:

The value of the field.

Return type:

float

get_string(field: str | int) str

Get the value of a given text field.

Parameters:

field (str or int) – The name or index of the field to get the value of.

Returns:

The value of the field.

Return type:

str

field_index(name: str) int

Get the index of a field.

Parameters:

name (str) – The name of the field to get the index of.

Returns:

The index of the field.

Return type:

int

put(field: str | int, value: int | float | str)

Set the value of a given numeric field.

Parameters:
  • field (str or int) – The name or index of the field to set the value of.

  • value (str or int or float) – The value to set. Note that if a string value is given, it will be cast to a numeric value.

put_string(field: str | int, value: int | float | str)

Set the value of a given string field.

Parameters:
  • field (str or int) – The name or index of the field to set the value of.

  • value (str or int or float) – The value to set. Note that if a numeric value is given, it will be cast to a string value.

find_key(key: str) int

Set the current record position to the given key.

Parameters:

key (str) – The key to set the position at.

Returns:

0 if successful, 1 otherwise. An unsuccessful result likely means the end of the file has been reached before the key was found.

Return type:

int

next_key() int

Set the current record position to the next key in the file.

Returns:

0 if successful, 1 otherwise. An unsuccessful result likely means the end of the file was reached before the next key was found.

Return type:

int

field_size() int

Get the size of the fields in the map file.

Returns:

The size of the fields.

Return type:

int

next() int

Move the current position to the next record.

Returns:

0 if successful, 1 otherwise.

Return type:

int

rewind() int

Set the current position to the start of the map file.

Returns:

0 if successful, 1 otherwise.

Return type:

int

write() int

Save any pending changes to file.

Returns:

0 if successful, 1 otherwise.

Return type:

int

append() int

Update the current entry.

Returns:

Always returns 0.

Return type:

int

get_multiple(fields: list[str]) list[float]

Get the values from multiple numeric fields.

Parameters:

fields (list[str]) – The list of field names to get the values from.

Returns:

The values, in the order the fields were given.

Return type:

list[float]

get_multiple_string(fields: list[str]) list[str]

Get the values from multiple text fields.

Parameters:

fields (list[str]) – The list of field names to get the values from.

Returns:

The values, in the order the fields were given.

Return type:

list[str]

eof() bool

Check whether the current position is the end of the map file.

Returns:

True if at end of file, False otherwise.

Return type:

bool

is_open() bool

Check whether the map file is currently open.

Returns:

True if the file is open, False otherwise.

Return type:

bool

__iter__()

Generator to move through all records in a map file

Parameters:

None

Yields:

self – Mapfile index for each record.

Example

>>> # Iterates through all the records in a map file and
>>> # prints the data.
>>> for record in mapio:
>>>     for field in record.field_list():
>>>         print ("%10s:%10s" %(field, record[field]))
get_position()

Deprecated since version 2024.0.

set_position()

Deprecated since version 2024.0.

class triangulation(name: str, mode: str = 'r')

Bases: object

Interface for Vulcan triangulations. A triangulation is made up of triangular facets defined by three points. This means a square or rectangle is represented by two facets, a cube is represented as twelve facets (six squares, each made of two facets). More complicated surfaces may require hundreds, thousands or more facets to be represented.

__init__(name: str, mode: str = 'r') None
Parameters:
  • name (str) – The name of the triangulation file.

  • mode (str) –

    The open mode

    The options are:

    • `r` for read

    • `w` for write

Raises:

OSError – If file does not exist and is being opened in read mode.

Example

>>> with vulcan.triangulation("cube.00t", "r") as tri:
>>>     print (len(tri.nodes))
>>>     print (len(tri.facets))
>>> # Changes are auto saved with a context manager.
>>> with vulcan.triangulation("cube.00t", "w") as tri:
>>>     for i, vertex in enumerate(tri.nodes):
>>>         # Shift the z by 5m
>>>         vertex[2] += 5.0
>>>         # Save the node back
>>>         tri.node[i] = vertex
save(name: str = '')

Save the triangulation.

Parameters:

name (str, optional) – The file path to save the triangulation to. If not given, triangulation saves back to the path it was opened with.

load_grid(grid: grid)

Load a grid into the current triangulation (overwrites).

Parameters:

grid (vulcan.grid) – The grid to load into the triangulation.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

update_grid(grid: grid)

Update a grid with the current triangulation.

Parameters:

grid (vulcan.grid) – The grid to update with triangulation elevations.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

is_read_only() bool

Check whether the triangulation is open in read only mode.

Returns:

True if the triangulation is open in read-only mode, False otherwise.

Return type:

bool

is_ok() bool

Report the triangulation load status.

Returns:

True if the triangulation loaded successfully, False otherwise. New triangulations will always return True.

Return type:

bool

is_closed() bool

Report the triangulation closure state.

Returns:

True if the triangulation is closed/watertight, False otherwise.

Return type:

bool

is_crossing() bool

Report the existence of crossing triangles.

Returns:

True if the triangulation has crossing triangles, False otherwise.

Return type:

bool

is_consistent() bool

Report the existence of inconsistent triangles.

Returns:

True if the triangles are consistent, False otherwise.

Return type:

bool

n_nodes() int

Get the number of nodes (points) in the triangulation.

Returns:

The number of nodes/points in the triangulation.

Return type:

int

n_faces() int

Get the number of facets in the triangulation.

Returns:

The number of facets in the triangulation.

Return type:

int

get_face(k: int) list[int]

Get the point indices of a specific facet.

Parameters:

k (int) – The index of the facet to get the point indices of.

Returns:

The indices of the facet points.

Return type:

list[int]

Raises:

IndexError – If k is less than 0 or greater than n_faces.

set_face(k: int, n1: int, n2: int, n3: int)

Set a facets points by index.

Parameters:
  • k (int) – The index of the facet to set.

  • n1 (int) – The index of the first point to set for the facet.

  • n2 (int) – The index of the second point to set for the facet.

  • n3 (int) – The index of the third point to set for the facet.

Raises:
  • IndexError – If k is less than 0 or greater than n_faces, or n1, n2, n3 are less than 0 or greater than n_nodes.

  • PermissionError – If the triangulation was opened in read-only mode.

get_node(k: int) list[float]

Get a vertex from the triangulation.

Parameters:

k (int) – The index of the point to get.

Returns:

The X, Y, Z coordinates of the point.

Return type:

list[float]

Raises:

IndexError – If k is less than 0 or greater than n_nodes.

set_node(k: int, x: float, y: float, z: float)

Set the coordinates of a triangulation vertex.

Parameters:
  • k (int) – The index of the point to set.

  • x (float) – The X coordinate to set on the point.

  • y (float) – The Y coordinate to set on the point.

  • z (float) – The Z coordinate to set on the point.

Raises:
  • IndexError – If k is less than 0 or greater than n_nodes.

  • PermissionError – If the triangulation was opened in read-only mode.

add_face(n1: int, n2: int, n3: int) int

Add a facet to the triangulation.

Parameters:
  • n1 (int) – The index of the first point of the new facet.

  • n2 (int) – The index of the second point of the new facet.

  • n3 (int) – The index of the third point of the new facet.

Returns:

The index of the newly added facet.

Return type:

int

Raises:
  • IndexError – If n1, n2, n3 are less than 0 or greater than n_nodes.

  • PermissionError – If the triangulation was opened in read-only mode.

add_node(x: float, y: float, z: float) int

Add a vertex to the triangulation.

Parameters:
  • x (float) – The X coordinate of the new point.

  • y (float) – The Y coordinate of the new point.

  • z (float) – The Z coordinate of the new point.

Returns:

The index of the newly added point.

Return type:

int

Raises:

PermissionError – If the triangulation was opened in read-only mode.

delete_face(k: int, purge_points: bool = False)

Delete a facet from the triangulation. Optionally purge points that are no longer used.

Parameters:
  • k (int) – The index of the facet to remove.

  • purge_points (bool, optional) – Whether to purge any points that are no longer used after the facet is removed. Defaults to False.

Raises:
  • IndexError – If k is less than 0 or greater than n_faces.

  • PermissionError – If the triangulation was opened in read-only mode.

delete_node(k: int)

Delete a point from the triangulation.

Parameters:

int (k) – The index of the point to delete.

Raises:
  • IndexError – If k is less than 0 or greater than n_nodes.

  • PermissionError – If the triangulation was opened in read-only mode.

clear_triangles()

Clear all vertex and facet data, leaving attributes intact.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

clear()

Clear all data from the triangulation.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

get_colour_index() int

Get the triangulation colour index.

Returns:

The colour index of the triangulation.

Return type:

int

set_colour_index(colour: int)

Set the triangulation colour index.

Parameters:

colour (int) – The colour index to set on the triangulation.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

is_rgb() bool

Checks if the triangulation colour is RGB.

Returns:

True if the triangulation has an RGB colour, False otherwise.

Return type:

bool

get_rgb() list[int]

Get the triangulation colour (RGB).

Returns:

The R, G, B colour values for the triangulation.

Return type:

list[int]

set_rgb(rgb: list[int])

Set the triangulation colour (RGB).

Parameters:

rgb (list[int]) – The [R, G, B] colour value to set.

Raises:

PermissionError – If the triangulation is opened in read-only mode.

get_translucency() float

Get the triangulation translucency.

Returns:

The translucency of the triangulation.

Return type:

float

set_translucency(value: float)

Set the triangulation translucency.

Parameters:

value (float) – The translucency value to set.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

get_properties() dict

Get the triangulation property dictionary.

Returns:

The triangulation property dictionary.

Return type:

dict

set_properties(props: dict)

Set the triangulation property dictionary. Unknown keys will be ignored; calling get_properties first for an established dict with known keys is advised, which can then be modified as needed and set back on to the triangulation.

>>>   properties = tri.get_properties()
...   # 'property_name_to_edit' should be an existing key in the dict.
>>>   properties['property_name_to_edit'] = new_value
>>>   tri.set_properties(properties)
Parameters:

dict – The key value pairs to set as properties.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

See also

get_properties

get_elevation(x: float, y: float) float

Get the elevation of an x,y location.

Parameters:
  • x (float) – The X coordinate to get the elevation at.

  • y (float) – The Y coordinate to get the elevation at.

Returns:

The elevation at the given location.

Return type:

float

get_elevations(x: float, y: float) list[float]

Get any intersection elevations of an x,y location.

Parameters:
  • x (float) – The X coordinate to get the intersection of elevations at.

  • y (float) – The Y coordinate to get the intersection of elevations at.

Returns:

The intersection of elevations at the given location.

Return type:

list[float]

neighbors(k: int) list[int]

Get the neighbors of a facet. This will be every facet which shares an edge with the given facet.

Parameters:

k (int) – The index of the target facet.

Returns:

The indexes of the neighboring facets.

Return type:

list[int]

Raises:

IndexError – If k is less than 0 or greater than n_faces.

node_neighborhood(k: int) list[int]

Get the neighborhood of a node. This is all facets which contain the given node/point.

Parameters:

k (int) – The index of the target node/point.

Returns:

The indexes of the neighborhood facets.

Return type:

list[int]

Raises:

IndexError – If k is less than 0 or greater than n_nodes.

face_neighborhood(k: int) list[int]

Get the facet neighborhood of a given facet. The facet neighborhood is all facets which share either an edge or a point with the given facet.

Parameters:

k (int) – The index of the target facet.

Returns:

The indexes of the neighborhood facets.

Return type:

list[int]

Raises:

IndexError – If k is less than 0 or greater than n_faces.

face_direction(k: int) point

Get the facet direction as a unit vector.

Parameters:

k (int) – The index of the target facet.

Returns:

An (X, Y, Z) unit vector representing the facet direction.

Return type:

point

Raises:

IndexError – If k is less than 0 or greater than n_faces.

extent_pts() list[point]

Get the triangulation extent as points.

Returns:

A list of exactly two points representing the lower and upper bounds of the triangulation extent, respectively.

Return type:

list[point]

extent() list[list[float]]

Get the triangulation extent as a list.

Returns:

A list of exactly 2 list of floats, where the first list represents the [X, Y, Z] bounds of the lower extent of the triangulation, and the second list of [X, Y, Z] represents the upper extent.

Return type:

list[list[float]]

close() bool

Attempt to close holes in the triangulation.

Returns:

True if the operations succeeds, False otherwise.

Return type:

bool

Raises:

PermissionError – If the triangulation was opened in read-only mode.

clean()

Clean a triangulation, trying to remove consistency and crossing errors.

Raises:

PermissionError – If the triangulation was opened in read-only mode.

normalise()

Normalise a triangulation, fixing facet directions.

contour(z) list[obj]

Get the contours of a triangulation at a specified Z elevation.

Parameters:

z (float) – The elevation to contour.

Returns:

List of polylines representing the contours.

Return type:

list[vulcan.obj]

shortest_path(start: point, end: point) polyline

Get the shortest path along a triangulation between two points.

Parameters:
  • start (point) – Point representing one end of the shortest path line.

  • end (point) – Point representing the other end of the shortest path line.

Returns:

The shortest path between the two points, as a polyline.

Return type:

polyline

volume() float

Get the volume of a closed triangulation.

Returns:

The volume of the triangulation.

Return type:

float

surface_area() float

Get the surface area of the triangulation.

Returns:

The surface area of the triangluation.

Return type:

float

translate(translation: point) bool

Translate the triangulation by an x/y/z shift.

Parameters:

translation (point) – The (X, Y, Z) values to shift the triangluation by.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

scale(xyz_scale: point, xyz_reference: point) bool

Scale the triangulation by a factor in the x/y/z directions based on a reference point.

Parameters:
  • xyz_scale (point) – The point containing the X, Y, Z values to scale by.

  • xyz_reference (point) – The point to scale from.

Returns:

Always True. Return value will be removed in a future release.

Return type:

bool

Raises:

PermissionError – If the triangluation was opened in read-only mode.

centroid() point

Get the centroid of the triangulation.

Returns:

The centroid of the triangluation.

Return type:

point

point_inside(x: float, y: float, z: float) bool

Check if a point is inside a closed triangulation.

Parameters:
  • x (float) – The X coordinate of the point to check.

  • y (float) – The Y coordinate of the point to check.

  • z (float) – The Z coordinate of the point to check.

Returns:

True if the point is inside the triangulation, False if it is outside.

Return type:

bool

segment_intersections_pt(a: point, b: point) list[point]

Get the intersections of a line segment as points.

Parameters:
  • a (point) – The point representing the start of the line segment.

  • b (point) – The point representing the end of the line segment.

Returns:

The list of points where the line segment intersects the triangluation.

Return type:

list[point]

segment_intersections(x0: float, y0: float, z0: float, x1: float, y1: float, z1: float) list[list[float]]

Get the intersections of a line segment as a list.

Parameters:
  • x0 (float) – The X value of the first end of the line segment.

  • y0 (float) – The Y value of the first end of the line segment.

  • z0 (float) – The Z value of the first end of the line segment.

  • x1 (float) – The X value of the other end of the line segment.

  • y1 (float) – The Y value of the other end of the line segment.

  • z1 (float) – The Z value of the other end of the line segment.

Returns:

A list of lists of exactly 3 floats, where each list represents the [X, Y, Z] positions where the line segment intersects the triangluation.

Return type:

list[list[float]]

solid_from_polygon(width: float, poly_position: int)

Create a solid from the triangulation points, treating them as a polyline, projecting the points vertically. This should only be used for new solids as the triangulation will be cleared of all previous data.

Parameters:
  • width (float) – The total height of the projected solid.

  • poly_position (int) – The location the points are at, used to determine the projection direction. Possible values are: 0 - Polygon is at the top and will be projected down. 1 - Polygon is at the middle and will be projected 1/2 width up and 1/2 width down. 2 - Polygon is at the top and will be projected up.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

get_vertices() numpy.ndarray[float]

Get the vertices of a triangulation as a NumPy array.

Returns:

A 2D NumPy array of size [n_nodes][3], where each point is represented as an array of X/Y/Z values.

Return type:

numpy.ndarray[float]

get_faces() numpy.ndarray[int]

Get the facets of a triangulation as a NumPy array.

Returns:

A 2D NumPy array of size [n_faces][3], where each facet is represented as an array of point indices.

Return type:

numpy.ndarray[int]

put_vertices(n0: numpy.ndarray[float])

Store a NumPy array of vertices to the triangulation.

Parameters:

numpy.ndarray[float] – A 2D NumPy array of size [*][3], where each point is represented as an array of X/Y/Z values.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

put_faces(n0) numpy.ndarray[int]

Store a NumPy array of facets to the triangulation.

Parameters:

numpy.ndarray[int] – A 2D NumPy array of size [*][3], where each facet is represented as an array of vertex indices.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

append_vertices(n0: numpy.ndarray[float])

Append a NumPy array of vertices to the triangulation.

Parameters:

numpy.ndarray[float] – A 2D NumPy array of size [*][3], where each point is represented as an array of X/Y/Z values.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

append_faces(n0: numpy.ndarray[int])

Append a NumPy array of facets to the triangulation.

Parameters:

numpy.ndarray[int] – A 2D NumPy array of size [*][3], where each facet is represented as an array of vertex indices.

Raises:

PermissionError – If the triangluation was opened in read-only mode.

property nodes

Generator to move through each node of a triangulation.

Example

>>> for node in tri.nodes:
>>>     print (node)
property faces

Generator to move through each facet of a triangulation.

Example

>>> for face in tri.faces:
>>>     print (face)
property node: list[float]

Returns a node from a triangulation using the syntax tri.node[i].

Returns:

Node x/y/z data at a given index

Return type:

list[float](len=3)

Example

>>> for i in range(tri.n_nodes()):
>>>     print (tri.node[i])
property face: list[int]

Returns a face from a triangulation using the syntax tri.face[i]. Each face is a list of node indices it is linked to (list[3])

Returns:

Facet node connections of a triangulation at an index.

Return type:

list[int](len=3)

Example

>>> for i in range(tri.n_faces()):
>>>     print (tri.face[i])
get_colour() list[int] | int

Returns the colour of the triangulation in either RGB or colour index.

Returns:

  • list[int] – RGB colour. This must have a length of exactly 3.

  • int – Colour Index

Example

>>> tri.set_rgb([255,255,255])
>>> tri.get_colour()
[255, 255, 255]
>>> tri.set_colour_index()
>>> tri.get_colour()
1
set_colour(val: list[int] | int)

Sets the colour of the triangulation to RGB(list) or colour index(int).

property colour: list[int] | int

Sets and gets the color of a triangulation.

class tri_attributes(name: str)

Bases: object

Interface for Vulcan triangulation attributes.

__init__(name: str) None

Interface for Vulcan triangulation attributes.

is_ok() bool

Check if the triangulation loaded successfully.

Returns:

True if the triangulation loaded successfully, False otherwise.

Return type:

bool

put(name: str, value: int | str, type: str = None)

Add a new attribute into the triangulation.

Parameters:
  • name (str) – The name of the attribute to set.

  • value (str or int) – The value to set.

  • type (str, optional) – The type of the data to set. Defaults to ‘String’ if value is str, or ‘Integer’ is value is int. Must be one of ‘Integer’, ‘Double’, ‘String’, ‘Boolean’, ‘Date.DMY’, ‘Date.MDY’, ‘Date.YMD’.

Returns:

True if successful, False otherwise. If false, the error can be checked with get_last_error().

Return type:

bool

delete_key(name: str)

Remove an attribute from the triangulation.

Parameters:

name (str) – The name of the attribute to remove.

Returns:

True if successful, False otherwise.

Return type:

bool

clear()

Remove all attributes from the triangulation.

get_string(name: str) str

Get an attribute value as a string.

Parameters:

name (str) – The name of the attribute to get the value of.

Returns:

The value of the attribute. An empty string indicates an error, check get_last_error().

Return type:

str

get_type(name: str) str

Get the type of an attribute, in display form.

Parameters:

name (str) – The name of the attribute to get the type of.

Returns:

The type of the attribute in display form. An empty string indicates an error, check get_last_error().

Return type:

str

get_keys() list[str]

Get the list of attribute keys associated with the triangulation.

Returns:

The attribute keys.

Return type:

list[str]

get_values() list[str]

Get all the attribute values associated with the triangulation. All values are converted to string format.

Returns:

The attribute values.

Return type:

list[str]

get_hash() dict

Get all attribute keys and values associated with the triangulation.

Returns:

The key/value pairs for the attributes.

Return type:

dict

get_types() list[str]

Get the underlying meta type for all attributes.

Returns:

The list of attribute types.

Return type:

list[str]

exists(name: str) bool

Check if an attribute already exists for the triangulation.

Parameters:

name (str) – The name of the attribute to check for existence.

Returns:

True if attribute exists, False otherwise.

Return type:

bool

get_last_error() str

Get the most recent error associated with the triangulation.

Returns:

The error message.

Return type:

str

save()

Save any pending changes back to the triangulation.

class grid_cell

Bases: object

Interface to create and edit data within grid cells.

__init__(self) 'None'

Constructs a new grid cell.

Overload

__init__(self, _w: ‘float’, _mask: ‘int’) -> ‘None’

Constructs a new grid cell with w and mask values.

Parameters:
  • _w (float) – The w value for the new grid cell.

  • _mask (int) – The mask value for the new grid cell.

set_w(_w: float) grid_cell

Set the w value of the cell.

Parameters:

_w (float) – The value to set.

put_w(_w: float) grid_cell

Alias for set_w().

See also

set_w

set_mask(_mask: int) grid_cell

Set the mask value of the cell.

Parameters:

_mask (int) – The value to set.

put_mask(_mask: int) grid_cell

Alias for set_mask().

See also

set_mask

get_w() float

Get the w value of the cell.

Returns:

The w value.

Return type:

float

get_mask() int

Get the mask value of the cell.

Returns:

The mask value.

Return type:

int

get_w_and_mask(w: float, mask: int)

Deprecated since version 2024.0.

copy(copy: grid_cell) grid_cell

Copy the values from a given grid cell into the current cell.

Parameters:

copy (grid_cell) – The cell to copy values from.

VGD_grid_cell_t

Alias of grid_cell. This alias will be deprecated in the future in favor of grid_cell

class grid

Bases: object

Interface to create and edit data within Vulcan grids.

__init__(self) 'None'

Construct a new 1x1 grid with no values.

Overload

__init__(self, name: ‘str’) -> ‘None’

Load a grid file if it exists, otherwise construct a new 1x1 grid with no values.

Parameters:

name (str) – The grid file to load, or the name to assign to the new grid.

Overload

__init__(self, x0: ‘float | int’, y0: ‘float | int’, dx: ‘float | int’, dy: ‘float | int’, nx: ‘int’, ny: ‘int’) -> ‘None’

Construct a new grid with given dimensions.

Parameters:
  • x0 (float) – The x value of the origin of the grid.

  • y0 (float) – The y value of the origin of the grid.

  • dx (float) – The size of the grid cells in the x direction.

  • dy (float) – The size of the grid cells in the y direction.

  • nx (int) – The number of cells in the x direction.

  • ny (int) – The number of cells in the y direction.

clear()

Clear all values from the grid.

load(name: str = '') int

Load a grid file into the current object.

Parameters:

name (str) – The filepath of the grid file to load.

save(name: str = '') int

Save the grid to file.

Parameters:

name (str) – The filepath to save the grid to.

load_esri(name: str = '') int

Load a grid from an ESRI TIN file.

Parameters:

name (str) – The filepath of the ESRI TIN file to load.

save_esri_ascii(name: str) int

Save a grid in a format readable by ESRI.

Parameters:

name (str) – The filepath to save the grid to.

__call__(i: int, j: int) grid_cell

Return a cell in the grid. grid(1, 2) returns the cell at position (1, 2)

Parameters:
  • i (int) – The index of the cell in the X direction.

  • j (int) – The index of the cell in the Y direction.

Returns:

The cell.

Return type:

VGD_grid_cell_t

get_x0() float

Get the x value of the origin of the grid.

get_y0() float

Get the y value of the origin of the grid.

get_dx() float

Get the size of the grid cells in the x direction.

get_dy() float

Get the size of the grid cells in the y direction.

n_data() int

Get the number of cells in the grid.

This is equivalent to nx * ny.

get_nx() int

Get the number of cells in the x direction.

get_ny() int

Get the number of cells in the y direction.

get_x(k: int) float

Get the x value of a cell.

Parameters:

k (int) – The index of the cell.

Returns:

The x value of the cell.

Return type:

float

get_y(k: int) float

Get the y value of a cell.

Parameters:

k (int) – The index of the cell.

Returns:

The y value of the cell.

Return type:

float

get_mask(k: int) int

Get the mask value of a cell.

Parameters:

k (int) – The index of the cell.

Returns:

The mask value of the cell.

Return type:

int

put_w(k: int, w: float)

Set the w value of a cell.

Parameters:
  • k (int) – The index of the cell to set.

  • w (double) – The w value to set.

put_mask(k: int, mask: int)

Set the mask value of a cell.

Parameters:
  • k (int) – The index of the cell to set.

  • mask (int) – The mask value to set.

ij_to_pos(i: int, j: int) int

Convert an (i, j) cell index to a flattened index.

Parameters:
  • i (int) – The position of the cell in the x direction.

  • j (int) – The position of the cell in the y direction.

Returns:

The index of the cell.

Return type:

int

Example

>>> 0 1 2
>>> 3 4 5
>>> 6 7 8
>>>
>>> (0,3) using i,j indexing would have a flattened index of 6 for this 3x3 grid.
get_w(self, k: 'int') 'int'

Get the w value of a cell using a flattened index.

Parameters:

k (int) – The index of the cell to get.

Returns:

The w value of the cell.

Return type:

int

Overload

get_w(self, x: ‘float’, y: ‘float’, w: ‘float’, mask: ‘int’)

Deprecated since version 2024.0.

get_z(x: float, y: float, w: float, mask: int)

Deprecated since version 2024.0.

get_elevation(x: float, y: float) float

Get the elevation (w value) at given coordinates.

Parameters:
  • x (float) – The x coordinate to get the elevation at.

  • y (float) – The y coordinate to get the elevation at.

Returns:

The elevation value.

Return type:

float

get_elevation_mask(x: float, y: float) int

Get the mask value at given coordinates.

Parameters:
  • x (float) – The x coordinate to get the elevation at.

  • y (float) – The y coordinate to get the elevation at.

get_w_missing(x: float, y: float, w: float, mask: int)

Deprecated since version 2024.0.

get_elevation_missing(x: float, y: float, w: float | None = None, mask: int | None = None) float

Get the interpolated value at a given position.

This does not assume unmasked values are valid.

Parameters:
  • x (float) – The x coordinate to get the value at.

  • y (float) – The y coordinate to get the value at.

Returns:

The interpolated w (elevation) value.

Return type:

float

get_elevation_missing_mask(x: float, y: float, w: float | None = None, mask: int | None = None) int

Get the mask at a given position.

Parameters:
  • x (float) – The x coordinate to get the value at.

  • y (float) – The y coordinate to get the value at.

Returns:

The mask value.

Return type:

int

set_x0(_x0: float) grid

Set the x coordinate of the grid origin.

Parameters:

_x0 (float) – The value to set.

set_y0(_y0: float) grid

Set the y coordinate of the grid origin.

Parameters:

_y0 (float) – The value to set.

set_dx(_dx: float) grid

Set the size of the grid cells in the x direction.

Parameters:

_dx (float) – The value to set.

set_dy(_dy: float) grid

Set the size of the grid cells in the y direction.

Parameters:

_dy (float) – The value to set.

set_size(_nx: int, _ny: int) grid

Set the number of cells in the grid.

Parameters:
  • _nx (int) – The number of cells in the x direction.

  • _ny (int) – The number of cells in the y direction.

copy(right: grid)

Copy the size and values from another grid into the current grid.

Parameters:

right (grid) – The grid to copy from.

basic_stats() tuple[float, float, float, float, int]

Compute some basic stats describing the grid.

Returns:

The average, min, max, variance and count of w values in the grid.

Return type:

tuple[float, float, float, float, int]

get_values() numpy.ndarray[float]

Get the w values from the grid as a NumPy array.

Returns:

The w values from the grid.

Return type:

numpy.ndarray[float]

get_values_mask() numpy.ndarray[numpy.int64]

Get the mask values from the grid as a NumPy array.

Returns:

The mask values from the grid.

Return type:

numpy.ndarray[int]

get_x_coordinates() numpy.ndarray[float]

Get the x coordinate values from the grid as a NumPy array.

Returns:

The x coordinate values from the grid.

Return type:

numpy.ndarray[float]

get_y_coordinates() numpy.ndarray[float]

Get the y coordinate values from the grid as a NumPy array.

Returns:

The y coordinate values from the grid.

Return type:

numpy.ndarray[float]

put_values(n0: numpy.ndarray[float])

Set the w values of the grid using a NumPy array.

Parameters:

n0 (numpy.ndarray[float]) – The array containing the values to set. This should have the same dimensions as the grid itself.

put_values_mask(n0: numpy.ndarray[int])

Set the mask values of the grid using a NumPy array.

Parameters:

n0 (numpy.ndarray[float]) – The array containing the values to set. This should have the same dimensions as the grid itself.

property ok
__getitem__(index: int)

Get a cell out of the grid.

Parameters:

index (int) – The flattened index of the cell to get.

See also

ij_to_pos

convert an (i, j) index to a flattened index.

get_grid() numpy.ndarray[float]

Gets the values in the grid.

Returns:

The values in the grid. This will be an array with the same shape as the grid itself.

Return type:

numpy.ndarray[float]

get_grid_mask() numpy.ndarray[numpy.int64]

Gets the masks of the grid.

Returns:

The masks of the grid. This will be an array with the same shape as the grid itself.

Return type:

numpy.ndarray[Int64]

get_grid_x() numpy.ndarray[float]

Gets the X coordinates of the cells in the grid.

Returns:

The X coordinates of the cells. This will be an array with the same shape as the grid itself.

Return type:

numpy.ndarray[float]

get_grid_y() numpy.ndarray[float]

Gets the list of all Y coordinates of the cells in the grid.

Returns:

The Y coordinates of the cells. This will be an array with the same shape as the grid itself.

Return type:

numpy.ndarray[float]

put_grid(data: numpy.ndarray[float])

Sets the values in the grid to the values in ‘data’.

Parameters:

data (numpy.ndarray[float]) – The values to put into the grid. This should be an array with the same shape as the grid itself.

put_grid_mask(mask: numpy.ndarray[numpy.int64])

Sets the masks in the grid to the values in ‘mask’.

Parameters:

mask (numpy.ndarray[Int64]) – The masks to put into the grid. This should be an array with the same shape as the grid itself.

get_pandas() pandas.DataFrame

Get the values in the grid as a pandas DataFrame.

Returns:

The values in the grid.

Return type:

pandas.DataFrame

put_pandas(dataframe: pandas.DataFrame) int

Sets the values in the grid from a pandas.DataFrame.

Parameters:

dataframe (pandas.DataFrame) – Dataframe containing the values to set.

Returns:

0 on success.

Return type:

int

property pandas: pandas.DataFrame

Pandas DataFrame for vulcan.grid.

get_spec_type(specName: str) str

Returns the spec file type (FORMATTED/VARIANT).

load_spec(specName: str) dict

Loads a Vulcan specfile into a dictionary.

save_spec(dictionary: dict, specName: str)

Saves a dictionary as a Vulcan specfile.

save_formatted_spec(dictionary: dict, specName: str, sectionOrder: dict = {}) bool

Saves a dictionary into a formatted specfile.

class dgd(name: str, mode: str = 'read')

Bases: object

Interface for reading/editing Vulcan design databases.

Parameters:
  • name (str) – The name of the `.dgd.isis` file to open.

  • mode (str) –

    The acccess mode for the database.

    Options are:

    • r/read for readonly mode (default)

    • c/create for create mode

    • w/w+/write/a/a+/append for write mode

Example

>>> # Open and print the data of the first object of each layer.
>>> with vulcan.dgd("mydata.dgd.isis", "read") as db:
>>>     for layer in db:
>>>         for obj in layer:
>>>             print(obj)
>>>             break
Raises:

ValueError – When the database does not end with `.dgd.isis`

Note

Opening the currently active dgd in Vulcan with the vulcan.dgd class can cause issues with data syncing on screen. All edits to an open dgd should be done through the vulcan_gui module.

Edits to the dgd through vulcan.dgd will not be reflected in Vulcan GUI without closing and reopening the dgd, and edits in the GUI can overwrite changes to the dgd.

is_locked() bool

Returns dgd lock status by checking for lock files.

Returns:

True if lock file is present, False otherwise.

Return type:

bool

close()

Closes the dgd.

is_layer(name: str) bool

Check if a layer exists in the dgd.

Parameters:

name (str) – The name of the layer to check for existence.

Returns:

True if the layer exists, False otherwise.

Return type:

bool

get_layer(name: str) layer

Gets a layer from the database. If edited in in write mode, changes must be saved back by using save_layer() or save_layer_as()

Parameters:

name (str) – The name of the layer to get.

Returns:

The requested layer.

Return type:

layer

is_open() bool

Checks if the database is open.

Returns:

True if the database is open, False otherwise.

Return type:

bool

num_layers() int

Get the number of layers in the database.

list_layers() list[str]

Lists the names of the layers in the database.

delete_layer(layer: str) bool

Deletes a layer in the database.

Parameters:

layer (str) – The name of the layer to delete.

Returns:

True if the layer was successfully deleted, False otherwise.

Return type:

bool

save_layer(layerInstance: layer) bool

Saves a layer to the database.

Parameters:

layerInstance (layer) – The layer to save to the database.

Returns:

True if successful, False otherwise.

Return type:

bool

save_layer_as(name: str, layerInstance: layer) bool

Saves a layer to the database with a new name.

Parameters:
  • name (str) – The name to save the layer as.

  • layerInstance (layer) – The layer to save to the database.

Returns:

True if successful, False otherwise.

Return type:

bool

append(layerInstance: layer) bool

Adds a new layer to the database.

Parameters:

layerInstance (layer) – The layer to append.

Returns:

True if successful, False otherwise.

Return type:

bool

Raises:

ValueError – If layer already exists.

__enter__()

Context manager for a design database. Automatically closes when scope ends. See dgd for parameters.

__len__() int

Returns the number of layers in the dgd.

__iter__() Generator[layer]

Iterator to move through the layers in the database.

__getitem__(name: str) layer

Allows getting a layer by name.

__setitem__(name: str, layer: layer)

Allows setting a layer by name. Will save as a new layer or overwrite.

__delitem__(name: str)

Deletes a layer by name.

property layers: list[str]

List of layer names in database

property locked: bool

Database work lock status.

property open: bool

Database open status.

is_valid_layer_name(layer_name: str) bool

Tests if a layer name is valid or not.

New in version 2024.2.

get_valid_layer_name(layer_name: str) str

Returns a validated version of the provided layer name. Blank strings will still return blanks.

New in version 2024.2.

class layer(name: str)

Bases: object

Interface for Vulcan layers.

Parameters:

name (str) – The name to assign to the layer.

Returns:

The created layer

Return type:

layer

__eq__(other: layer) bool

Compares the layer with another given layer for equality.

Returns:

True if the layers are equal, False otherwise.

Return type:

bool

__ne__(other: layer) bool

Compares the layer with another given layer for inequality.

Returns:

True if the layers are not equal, False otherwise.

Return type:

bool

get_name() str

Gets the layer name.

set_name(name: str)

Sets the layer name.

Parameters:

name (str) – The name to set.

get_description() str

Gets the layer description.

set_description(description: str)

Sets the layer description.

Parameters:

description (str) – The description to set.

get_object(index: int) obj

Gets an object from a layer by index.

Parameters:

index (int) – The index of the object to get.

Returns:

The requested object.

Return type:

obj

set_object(index: int, object: obj) bool

Sets an object by index.

Parameters:
  • index (int) – The index of the object to set.

  • object (obj) – The object to set.

Returns:

True if successful, False otherwise.

Return type:

bool

find_object(name: str) obj

Finds an object by name.

Parameters:

name (str) – The name of the object to find.

Returns:

The requested object.

Return type:

obj

num_objects() int

Returns the number of objects in the layer.

delete_object(index: int) bool

Deletes an object by index from the layer.

Parameters:

index (int) – The index of the object to delete.

Returns:

True if successful, False otherwise.

Return type:

bool

clear_objects()

Deletes all objects from the layer.

append(object: obj)

Appends an object to the layer.

Parameters:

object (obj) – The object to append.

__iter__() Generator[obj]

Generator to move through layer objects.

__getitem__(index: int) obj

Gets an object at a specified index.

__setitem__(index: int, object: obj)

Assigns an object to the specified index.

Raises:

TypeError – If the object is not of the base type obj

get_objects_enumerate(types: list[type]) enumerate[int, obj]

Gets the objects of a specified types from a layer and layer indices.

Parameters:

types (list[type]) – List of object types to get from the layer.

Yields:

list[idx,obj] – Index of the Vulcan object of the specified types and the object.

Example

>>> types = [vulcan.polyline]
>>> for i, obj in layer.get_objects_enumerate(types):
>>>     for pt in obj:
>>>         pt += 5 # Shift the object by 5 in x/y/z
>>>     layer[i] = obj
get_objects(types: list[type]) Iterator[obj]

Gets the objects of a specified types from a layer. This is not suitable for putting objects back into layers with enumerate() since the objects are filtered and indices are unknown. To have indices for modifying objects, use get_objects_enumerate()

Parameters:

types (list) – List of object types to get from the layer.

Yields:

vulcan.obj – Vulcan object matching the specified types.

Example

>>> types = [vulcan.text, vulcan.text3d]
>>> for obj in get_objects(types):
>>>     print (type(obj))
property name: str

Layer name

property description: str

Layer description

class obj(*args, **kwargs)

Bases: object

Base class for shared methods in design object datatypes. This base class cannot be constructed and must be instantiated through one of the other derived types.

See Also: polyline text text3d arrow arrow3d dim_angle dim_arc dim_line dim_radius

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

clear()

Clear out an object’s data.

get_type() str

Get the object type name.

object_details() str

Gets the object’s information as a formatted report.

get_name() str

Gets the object name.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

get_layer() str

Gets the object layer.

get_description() str

Gets the object description.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

get_feature() str

Gets the object feature.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
get_group() str

Gets the object group.

set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

get_value() float

Gets the object value.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

get_colour() int

Gets the object colour.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

Gets the number of object links.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

get_linkdata() dict

Gets a copy of the object link data.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

get_primitive() dict

Gets a copy of the object primitive data.

set_primitive(dictionary: dict)

Sets the object primitive data.

get_attributes() attributes

Gets a reference to the object attribute data.

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

get_metadata() metadata

Gets a reference to the object metadata.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

get_section_widths() section_widths

Gets a reference to the object section width data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

property type: str

Object type

property name: str

Object name

property layer: str

Object layer

property description: str

Object description

property feature: str

Object feature code

property group: str

Object group

property value: float

Object value

property colour: int

Object colour

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property attributes: attributes

Object attribute data

property section_widths: section_widths

Object section width data

class point(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0, t: int = 0, name: str = '')

Bases: object

Interface for Vulcan design points.

This class allows accessing points from Vulcan objects with the additional w-tag/t/name values over the basic x/y/z values.

__init__(x: float = 0.0, y: float = 0.0, z: float = 0.0, w: float = 0.0, t: int = 0, name: str = '') None

Initialize a point.

Parameters:
  • x (float) – The x coordinate of the point.

  • y (float) – The y coordinate of the point.

  • z (float) – The z coordinate of the point.

  • w (float) – The w value of the point.

  • t (int) – The connected state of the point.

  • name (str) – The name of the point.

__iadd__(other: point) point

Add a point to a point.

__isub__(other: point) point

Subtract a point from a point.

__imul__(other: point) point

Multiply a point by a point.

__itruediv__(other: point) point

Divide a point by a point.

__idiv__(other: point) point

Divide a point by a point.

__add__(other: point) point

Add a point to a point.

__sub__(other: point) point

Subtract a point from a point.

__mul__(other: point) point

Multiply a point by a point.

__truediv__(other: point) point

Divide a point by a point.

__div__(other: point) point

Divide a point by a point.

__eq__(other: point) bool

Compares two points for equality.

distance(other: point) float

Get the distance between the point and another point.

Parameters:

other (point) – The point to get the distance to.

Returns:

The distance between the points.

Return type:

float

property xyz: Iterator[float]

Generator for the x/y/z portion of a point.

Yields:
  • double – Point x

  • double – Point y

  • double – Point z

property x: float

Point x value

property y: float

Point y value

property z: float

Point z value

property w: float

Point w value

property t: int

Point t (0/1 = connection)

property name: str

Point name

class polyline(points: list[point] = None)

Bases: obj

Interface for Vulcan design polylines.

__init__(points: list[point] = None) None
Parameters:

points (list[point]|list[float[3]], Optional) – Optional list of points to build polyline from. Points can be a list of point or a list of values that will be used to build the points from. The points can have x, y, z, w, t, or n in that order. Missing values will be defaulted.

get_linetype() list[int]

Gets the linetype as a list (style, thickness).

Style uses a 0 based index (0-7), while thickness uses a 1 based index (1-10).

set_linetype(style: list[int])

Sets the linetype from a style and thickness.

Style uses a 0 based index (0-7), while thickness uses a 1 based index (1-10).

Parameters:

style (list[int]) – A list of exactly length 2, containing the [style, thickness] to set.

get_pattern() int

Gets the pattern index of a line.

set_pattern(pattern: int)

Sets the pattern index of a line.

Parameters:

pattern (int) – The index of the pattern to set.

append(pt: point) bool

Adds a point to the end of a line.

Parameters:

pt (point) – The point to append.

Returns:

True if successful, False otherwise.

Return type:

bool

delete_point(k: int) bool

Deletes a point by index.

Parameters:

index (int) – The index of the point to delete.

Returns:

True if successful, False otherwise.

Return type:

bool

num_points() int

Returns the number of points in the polyline.

get_coordinates() list[list[float]]

Gets a list of coordinates from a polyline in x/y/z.

set_coordinates(pl: list[point] = None)

Sets the coordinates of a line from a list of x/y/z or vulcan.point

set_connected(start: int = -1, end: int = -1, connected: bool = True)

Sets the connected state between a series of points.

This will create a continuous connection between all points between the start and end points.

set_connected(1, 4, True) will connect points 1-2, 2-3, 3-4.

set_connected(-1, -1, True) will connect all points in their index order.

set_connected(2, 3, False) will disconnect points 2-3.

set_connected(-1, -1, False) will disconnect all points.

Parameters:
  • start (int) – The index of the point to start the connected chain. A value of -1 will start the connection from the point with the lowest index. Defaults to -1.

  • end (int) – The index of the point to end the connected chain. A value of -1 will end the connectection at the point with the highest index. Defaults to -1.

  • connected (bool) – A value of True will connect the points, False will disconnect the points.

is_clockwise() bool

Returns True if the polyline is clockwise.

set_direction(dir: int = 0)

Sets the direction of a polyline.

Parameters:

dir (int) – The direction to set; 0 for clockwise and 1 for counter clockwise.

make_clockwise()

Makes a polyline clockwise.

make_counter_clockwise()

Makes a polyline counter clockwise.

is_closed() bool

Returns true if a polyline is closed.

set_closed(closure: bool = True)

Sets the polyline to closed.

shift(x: float, y: float, z: float)

Shifts a polyline by an x/y/z distance.

Parameters:
  • x (float) – The amount to shift the line in the x direction.

  • y (float) – The amount to shift the line in the y direction.

  • z (float) – The amount to shift the line in the z direction.

scale(factor: float, center: point = None)

Scales a polyline based on a scale and center point.

Parameters:
  • factor (float) – The amount to scale the polyline by.

  • center (point) – The center point which the scale is applied from.

planar_area(plan: bool = True) float

Gets the planar area of a polyline (in plan or a best fit plane).

length(plan: bool = False) float

Gets the length of a polyline (in plan or 3D).

centroid() point

Gets the centroid of a polyline.

center_average() point

Gets the center of a polyline by an average of the points.

change_xyz() point

Gets the change in x/y/z (as a point)

filter(distance: float)

Filters a polyline by a distance tolerance.

point_inside(pt: point, plan: bool = True) bool

Check if a point is inside the polyline.

Parameters:
  • pt (point) – The point to check.

  • plan (bool, optional) – Whether to treat the polyline as planar. Defaults to True.

Returns:

True if the point is inside the polyline, False otherwise.

Return type:

bool

property linetype: list[int]

Polyline linetype

property pattern: int

Polyline pattern

property closed: bool

Polyline closure (bool)

property clockwise: bool

Polyline direction (bool)

property coordinates: list[list[float]]

Polyline coordinates

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_group() str

Gets the object group.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property section_widths: section_widths

Object section width data

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property type: str

Object type

property value: float

Object value

class text(text: str = '')

Bases: obj

Interface for Vulcan design text (2D).

num_lines() int

Returns the number of text lines.

get_line(line_num: int) str

Gets a line of text by index.

append(line: str)

Appends a line of text.

set_line(line_num: int, line: str)

Sets a line of text by index.

delete_line(line_num: int)

Deletes a line of text by index.

delete_all_lines()

Deletes all lines of text.

get_origin() point

Gets the text origin point.

set_origin(pt: point)

Sets the text origin point.

Parameters:

pt (point) – The point to set as the text origin.

get_angle() float

Gets the text angle.

set_angle(angle: float)

Sets the text angle.

Parameters:

angle (float) – The angle to set.

get_scale() str

Gets the text scale.

set_scale(scale: str)

Sets the text scale.

Parameters:

scale (str) – The scale to set.

get_height() float

Gets the text height.

set_height(height: float)

Sets the text height.

Parameters:

height (float) – The height to set.

get_width() float

Gets the text width.

set_width(width: float)

Sets the text width.

Parameters:

width (float) – The width to set.

get_font() str

Gets the text font.

set_font(font: str)

Sets the text font.

Parameters:

font (str) – The font to set.

is_framed() bool

Check if the text is framed.

Returns:

True if the text is framed, False otherwise.

Return type:

bool

set_framed(frame: bool = True)

Set the framed state of the text.

Parameters:

frame (bool, optional) – True sets the text as framed, False sets the text as not framed.

property origin: point

Text origin

property angle: float

Text angle

property scale: str

Text scale

property height: float

Text height

property width: float

Text width

property font: str

Text font

property framed: bool

Is text framed

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_group() str

Gets the object group.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property section_widths: section_widths

Object section width data

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property type: str

Object type

property value: float

Object value

class text3d(text: str = '')

Bases: obj

Interface for Vulcan design text (3D)

__init__(text: str = '') None

Interface for Vulcan design text (3D)

num_lines() int

Returns the number of text lines.

get_line(line_num: int) str

Gets a text line by index.

Parameters:

line_num (int) – The line number to get.

Returns:

The line of text.

Return type:

str

append(line: str)

Appends a new line of text.

Parameters:

line (str) – The line of text to append.

set_line(line_num: int, line: str)

Sets a line of text by index.

Parameters:
  • line_num (int) – The line number to set.

  • line (str) – The line of text to set.

delete_line(line_num: int)

Deletes a line of text.

Parameters:

line_num (int) – The line number to remove.

delete_all_lines()

Deletes all lines of text.

get_origin() point

Gets the origin point.

set_origin(pt: point)

Sets the origin point.

Parameters:

pt (point) – The point to set as the text origin.

get_direction() point

Gets the text direction (point with x/y/z)

set_direction(direction: point)

Sets the text direction.

Parameters:

direction (point) – The point containing the x/y/z direction to set.

get_normal() point

Gets the text normal.

set_normal(normal: point)

Sets the text normal.

Parameters:

normal (point) – The point to use as the normal.

get_scale() str

Gets the text scale.

set_scale(scale: str)

Sets the text scale.

Parameters:

scale (str) – The scale to set.

get_height() float

Gets the text height.

set_height(height: float)

Sets the text height.

Parameters:

height (float) – The height to set.

get_width() float

Gets the text width.

set_width(width: float)

Sets the text width.

Parameters:

width (float) – The width to set.

get_font() str

Gets the text font.

set_font(font: str)

Sets the text font.

Parameters:

font (str) – The font to set.

is_italic() bool

Gets the text italic setting(bool).

set_italic(italic: bool = True)

Sets the font italics.

Parameters:

italic (bool) – True to set the text as italic, False to set the text as not italic.

is_mirrored_vertical() bool

Check if the text is mirrored vertically.

set_mirrored_vertical(mirror: bool = True)

Set the text as mirrored vertically.

Parameters:

mirror (bool) – True to mirror the text, False to not mirror the text.

is_mirrored_horizontal() bool

Check if the text is mirrored horizontally.

set_mirrored_horizontal(mirror: bool = True)

Set the text as mirrored horizontally.

Parameters:

mirror (bool) – True to mirror the text, False to not mirror the text.

get_horizontal_align() str

Gets the horizontal alignment.

set_horizontal_align(alignment: str)

Sets the horizontal alignment.

Parameters:

alignment (str) – The alignment to set. Options are [“LEFT”, “CENTRE”, “RIGHT”]

get_vertical_align() str

Gets the vertical alignment.

set_vertical_align(alignment: str)

Sets the vertical alignment.

Parameters:

alignment (str) – The alignment to set. Options are [“BOTTOM”, “CENTRE”, “TOP”]

property origin: point

Text origin

property direction: point

Text direction

property normal: point

Text normal

property scale: str

Text scale

property height: float

Text height

property width: float

Text width

property font: str

Text font

property italic: bool

Text italic setting

property mirrored_vertical: bool

Is text mirrored vertically

property mirrored_horizontal: bool

Is text mirrored horizontally

property horizontal_align: str

Is text aligned horizontally

property vertical_align: str

Is text aligned vertically

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_group() str

Gets the object group.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property section_widths: section_widths

Object section width data

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property type: str

Object type

property value: float

Object value

class arrow

Bases: obj

Interface for Vulcan design arrows.

__init__()

Interface for Vulcan design arrows.

get_start() point

Gets the arrow starting point.

set_start(point: point)

Sets the arrow starting point.

Parameters:

point (point) – The point to use as the arrow start point.

get_end() point

Gets the arrow end point.

set_end(point: point)

Sets the arrow end point.

Parameters:

point (point) – The point to use as the arrow end point.

get_normal() point

Gets the arrow normal.

set_normal(point: point)

Sets the arrow normal.

Parameters:

point (point) – The point to use as the normal.

get_scale() str

Gets the arrow scale.

set_scale(scale: str)

Sets the arrow scale.

Parameters:

scale (str) – The scale to use.

is_auto_scale() bool

Check the arrow auto scale setting.

set_auto_scale(autoscale: bool = True)

Sets the arrow auto scale setting.

Parameters:

autoscale (bool) – True to auto scale, False to manually scale.

is_filled() bool

Check the arrow fill setting.

set_filled(filled: bool = True)

Sets the arrow fill setting.

Parameters:

filled (bool) – True to set the arrow as filled, False to not fill.

get_num_facets() int

Gets the number of facets.

set_num_facets(facets: int)

Sets the number of facets.

Parameters:

facets (int) – The number of facets to set.

get_scaled_head_length() float

Gets the scaled head length of the arrow.

get_head_length() float

Gets the arrow head length.

set_head_length(percentage: float)

Sets the arrow head length.

Parameters:

percentage (float) – The percentage of the arrow’s length to use as the head.

get_scaled_head_width() float

Gets the scaled head width of the arrow.

get_head_width() float

Gets the arrow head width.

set_head_width(percentage: float)

Sets the arrow head width.

Parameters:

percentage (float) – The percentage of the arrow’s width to use as the head.

get_relative_head_length() float

Gets the relative arrow head length.

set_relative_head_length(percentage: float)

Sets the relative arrow head length.

get_relative_head_width() float

Gets the relative arrow head width.

set_relative_head_width(percentage: float)

Sets the relative arrow head width.

get_arrow_type() str

Gets the arrow type (2D/3D).

set_arrow_type(type: str)

Sets the arrow type (2D/3D).

property start: point

Arrow start

property end: point

Arrow end

property normal: point

Arrow normal

property scale: str

Arrow scale

property num_facets: int

Arrow number of facets

property head_length: float

Arrow head length

property head_width: float

Arrow head width

property relative_head_length: float

Arrow relative head length

property relative_head_width: float

Arrow relative head width

property arrow_type: str

Arrow type (2D, 3D)

property auto_scale: bool

Arrow auto scale

property filled: bool

Arrow fill setting

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_group() str

Gets the object group.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property section_widths: section_widths

Object section width data

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property type: str

Object type

property value: float

Object value

class dimension(*args, **kwargs)

Bases: obj

Base class for Vulcan design dimensions.

get_font() str

Gets the dimension font.

set_font(name: str)

Sets the dimension font.

get_scaled_text_height() float

Gets the dimension scaled text height.

get_text_height() float

Gets the dimension text height.

set_text_height(height: float)

Sets the dimension text height.

get_text_map_size() float

Gets the dimension text map size.

set_text_map_size(size: float)

Sets the dimension text map size.

get_scale() str

Gets the dimension scale.

get_scale_factor(unit: str) float

Gets the dimension scale factor.

set_scale(scale: str)

Sets the dimension scale.

Parameters:

scale (str) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.

get_label() str

Gets the dimension label.

set_label(label: str)

Sets the dimension label.

get_tick_offset() float

Gets the dimension tick offset.

set_tick_offset(offset: float)

Sets the dimension tick offset.

get_tick_gap() float

Gets the dimension tick gap.

set_tick_gap(gap: float)

Sets the dimension tick gap.

get_tick_extent_size() float

Gets the dimension tick extent size.

set_tick_extent_size(size: float)

Sets the dimension tick extent size.

is_mirrored_horizontally() bool

Returns the dimension mirror setting (horizontal).

set_mirrored_horizontally(mirror: bool = True)

Sets the dimension mirror setting (horizontal).

is_mirrored_vertically() bool

Returns the dimension mirror setting (vertical).

set_mirrored_vertically(mirror: bool = True)

Sets the dimension mirror setting (vertical).

get_arrow_length() float

Gets the dimension arrow length.

set_arrow_length(length: float)

Sets the dimension arrow length.

get_arrow_width() float

Gets the dimension arrow width.

set_arrow_width(width: float)

Sets the dimension arrow width.

property font: str

Dimension font

property text_height: float

Dimension text height

property text_map_size: float

Dimension text map size

property scale: str

Dimension scale

property label: str

Dimension label

property tick_offset: float

Dimension tick offset

property tick_gap: float

Dimension tick gap

property tick_extent_size: float

Dimension tick extent size

property mirrored_horizontally: bool

Dimension mirror (horizontal)

property mirrored_vertically: bool

Dimension mirror (vertical)

property arrow_length: float

Dimension arrow length

property arrow_width: float

Dimension arrow width

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_group() str

Gets the object group.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property section_widths: section_widths

Object section width data

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property type: str

Object type

property value: float

Object value

class dim_angle

Bases: dimension

Interface for Vulcan design dimension angles.

__init__()

Interface for Vulcan design dimension angles.

get_origin() point

Gets the dimension origin.

set_origin(point: point)

Sets the dimension origin.

get_radius() point

Gets the dimension radius.

set_radius(point: point)

Sets the dimension radius.

get_sweep() point

Gets the dimension sweep.

set_sweep(point: point)

Sets the dimension sweep.

swap_points()

Swaps the dimension points.

property origin: point

Dimension origin point.

property radius: point

Dimension radius point.

property sweep: point

Dimension sweep point.

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property arrow_length: float

Dimension arrow length

property arrow_width: float

Dimension arrow width

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

property font: str

Dimension font

get_arrow_length() float

Gets the dimension arrow length.

get_arrow_width() float

Gets the dimension arrow width.

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_font() str

Gets the dimension font.

get_group() str

Gets the object group.

get_label() str

Gets the dimension label.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_scale() str

Gets the dimension scale.

get_scale_factor(unit: str) float

Gets the dimension scale factor.

get_scaled_text_height() float

Gets the dimension scaled text height.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_text_height() float

Gets the dimension text height.

get_text_map_size() float

Gets the dimension text map size.

get_tick_extent_size() float

Gets the dimension tick extent size.

get_tick_gap() float

Gets the dimension tick gap.

get_tick_offset() float

Gets the dimension tick offset.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

is_mirrored_horizontally() bool

Returns the dimension mirror setting (horizontal).

is_mirrored_vertically() bool

Returns the dimension mirror setting (vertical).

property label: str

Dimension label

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property mirrored_horizontally: bool

Dimension mirror (horizontal)

property mirrored_vertically: bool

Dimension mirror (vertical)

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property scale: str

Dimension scale

property section_widths: section_widths

Object section width data

set_arrow_length(length: float)

Sets the dimension arrow length.

set_arrow_width(width: float)

Sets the dimension arrow width.

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_font(name: str)

Sets the dimension font.

set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

set_label(label: str)

Sets the dimension label.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_mirrored_horizontally(mirror: bool = True)

Sets the dimension mirror setting (horizontal).

set_mirrored_vertically(mirror: bool = True)

Sets the dimension mirror setting (vertical).

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_scale(scale: str)

Sets the dimension scale.

Parameters:

scale (str) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_text_height(height: float)

Sets the dimension text height.

set_text_map_size(size: float)

Sets the dimension text map size.

set_tick_extent_size(size: float)

Sets the dimension tick extent size.

set_tick_gap(gap: float)

Sets the dimension tick gap.

set_tick_offset(offset: float)

Sets the dimension tick offset.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property text_height: float

Dimension text height

property text_map_size: float

Dimension text map size

property tick_extent_size: float

Dimension tick extent size

property tick_gap: float

Dimension tick gap

property tick_offset: float

Dimension tick offset

property type: str

Object type

property value: float

Object value

class dim_arc

Bases: dimension

Interface for Vulcan design dimension arcs.

__init__()

Interface for Vulcan design dimension arcs.

get_origin() point

Gets the dimension origin.

set_origin(point: point)

Sets the dimension origin.

get_radius() point

Gets the dimension radius.

set_radius(point: point)

Sets the dimension radius.

get_sweep() point

Gets the dimension sweep.

set_sweep(point: point)

Sets the dimension sweep.

swap_points()

Swaps the dimension points.

property origin: point

Dimension origin point.

property radius: point

Dimension radius point.

property sweep: point

Dimension sweep point.

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property arrow_length: float

Dimension arrow length

property arrow_width: float

Dimension arrow width

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

property font: str

Dimension font

get_arrow_length() float

Gets the dimension arrow length.

get_arrow_width() float

Gets the dimension arrow width.

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_font() str

Gets the dimension font.

get_group() str

Gets the object group.

get_label() str

Gets the dimension label.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_scale() str

Gets the dimension scale.

get_scale_factor(unit: str) float

Gets the dimension scale factor.

get_scaled_text_height() float

Gets the dimension scaled text height.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_text_height() float

Gets the dimension text height.

get_text_map_size() float

Gets the dimension text map size.

get_tick_extent_size() float

Gets the dimension tick extent size.

get_tick_gap() float

Gets the dimension tick gap.

get_tick_offset() float

Gets the dimension tick offset.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

is_mirrored_horizontally() bool

Returns the dimension mirror setting (horizontal).

is_mirrored_vertically() bool

Returns the dimension mirror setting (vertical).

property label: str

Dimension label

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property mirrored_horizontally: bool

Dimension mirror (horizontal)

property mirrored_vertically: bool

Dimension mirror (vertical)

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property scale: str

Dimension scale

property section_widths: section_widths

Object section width data

set_arrow_length(length: float)

Sets the dimension arrow length.

set_arrow_width(width: float)

Sets the dimension arrow width.

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_font(name: str)

Sets the dimension font.

set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

set_label(label: str)

Sets the dimension label.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_mirrored_horizontally(mirror: bool = True)

Sets the dimension mirror setting (horizontal).

set_mirrored_vertically(mirror: bool = True)

Sets the dimension mirror setting (vertical).

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_scale(scale: str)

Sets the dimension scale.

Parameters:

scale (str) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_text_height(height: float)

Sets the dimension text height.

set_text_map_size(size: float)

Sets the dimension text map size.

set_tick_extent_size(size: float)

Sets the dimension tick extent size.

set_tick_gap(gap: float)

Sets the dimension tick gap.

set_tick_offset(offset: float)

Sets the dimension tick offset.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property text_height: float

Dimension text height

property text_map_size: float

Dimension text map size

property tick_extent_size: float

Dimension tick extent size

property tick_gap: float

Dimension tick gap

property tick_offset: float

Dimension tick offset

property type: str

Object type

property value: float

Object value

class dim_line

Bases: dimension

Interface for Vulcan design dimension lines.

__init__()

Interface for Vulcan design dimension lines.

get_start() point

Gets the dimension start.

set_start(point: point)

Sets the dimension start.

get_end() point

Gets the dimension end.

set_end(point: point)

Sets the dimension end.

midpoint() point

Gets the dimension midpoint.

get_normal() point

Gets the dimension normal.

set_normal(point: point)

Sets the dimension normal.

swap_points()

Swaps the dimension points.

property start: point

Dimension start point.

property end: point

Dimension end point.

property normal: point

Dimension normal direction.

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property arrow_length: float

Dimension arrow length

property arrow_width: float

Dimension arrow width

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

property font: str

Dimension font

get_arrow_length() float

Gets the dimension arrow length.

get_arrow_width() float

Gets the dimension arrow width.

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_font() str

Gets the dimension font.

get_group() str

Gets the object group.

get_label() str

Gets the dimension label.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_scale() str

Gets the dimension scale.

get_scale_factor(unit: str) float

Gets the dimension scale factor.

get_scaled_text_height() float

Gets the dimension scaled text height.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_text_height() float

Gets the dimension text height.

get_text_map_size() float

Gets the dimension text map size.

get_tick_extent_size() float

Gets the dimension tick extent size.

get_tick_gap() float

Gets the dimension tick gap.

get_tick_offset() float

Gets the dimension tick offset.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

is_mirrored_horizontally() bool

Returns the dimension mirror setting (horizontal).

is_mirrored_vertically() bool

Returns the dimension mirror setting (vertical).

property label: str

Dimension label

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property mirrored_horizontally: bool

Dimension mirror (horizontal)

property mirrored_vertically: bool

Dimension mirror (vertical)

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property scale: str

Dimension scale

property section_widths: section_widths

Object section width data

set_arrow_length(length: float)

Sets the dimension arrow length.

set_arrow_width(width: float)

Sets the dimension arrow width.

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_font(name: str)

Sets the dimension font.

set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

set_label(label: str)

Sets the dimension label.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_mirrored_horizontally(mirror: bool = True)

Sets the dimension mirror setting (horizontal).

set_mirrored_vertically(mirror: bool = True)

Sets the dimension mirror setting (vertical).

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_scale(scale: str)

Sets the dimension scale.

Parameters:

scale (str) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_text_height(height: float)

Sets the dimension text height.

set_text_map_size(size: float)

Sets the dimension text map size.

set_tick_extent_size(size: float)

Sets the dimension tick extent size.

set_tick_gap(gap: float)

Sets the dimension tick gap.

set_tick_offset(offset: float)

Sets the dimension tick offset.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property text_height: float

Dimension text height

property text_map_size: float

Dimension text map size

property tick_extent_size: float

Dimension tick extent size

property tick_gap: float

Dimension tick gap

property tick_offset: float

Dimension tick offset

property type: str

Object type

property value: float

Object value

class dim_radius

Bases: dimension

Interface for Vulcan design dimension radii.

__init__()

Interface for Vulcan design dimension radii.

get_start() point

Gets the dimension start.

set_start(point: point)

Sets the dimension start.

get_end() point

Gets the dimension end.

set_end(point: point)

Sets the dimension end.

get_normal() point

Gets the dimension normal.

set_normal(point: point)

Sets the dimension normal.

swap_points()

Swaps the dimension points.

property start: point

Dimension start point.

property end: point

Dimension end point.

property normal: point

Dimension normal direction.

__eq__(object: obj) bool

Compares two objects for equality.

__ne__(object: obj) bool

Compares two objects for inequality.

property arrow_length: float

Dimension arrow length

property arrow_width: float

Dimension arrow width

property attributes: attributes

Object attribute data

clear()

Clear out an object’s data.

property colour: int

Object colour

property description: str

Object description

property feature: str

Object feature code

property font: str

Dimension font

get_arrow_length() float

Gets the dimension arrow length.

get_arrow_width() float

Gets the dimension arrow width.

get_attributes() attributes

Gets a reference to the object attribute data.

get_colour() int

Gets the object colour.

get_description() str

Gets the object description.

get_feature() str

Gets the object feature.

get_font() str

Gets the dimension font.

get_group() str

Gets the object group.

get_label() str

Gets the dimension label.

get_layer() str

Gets the object layer.

Gets the object link.

Parameters:

k (int) – Index of the link record to get.

get_linkdata() dict

Gets a copy of the object link data.

get_linktype(k: int) int

Gets the object link type.

Parameters:

k (int) – Index of the link record to get the type of.

get_metadata() metadata

Gets a reference to the object metadata.

get_name() str

Gets the object name.

get_primitive() dict

Gets a copy of the object primitive data.

get_scale() str

Gets the dimension scale.

get_scale_factor(unit: str) float

Gets the dimension scale factor.

get_scaled_text_height() float

Gets the dimension scaled text height.

get_section_widths() section_widths

Gets a reference to the object section width data.

get_text_height() float

Gets the dimension text height.

get_text_map_size() float

Gets the dimension text map size.

get_tick_extent_size() float

Gets the dimension tick extent size.

get_tick_gap() float

Gets the dimension tick gap.

get_tick_offset() float

Gets the dimension tick offset.

get_type() str

Get the object type name.

get_value() float

Gets the object value.

property group: str

Object group

is_mirrored_horizontally() bool

Returns the dimension mirror setting (horizontal).

is_mirrored_vertically() bool

Returns the dimension mirror setting (vertical).

property label: str

Dimension label

property layer: str

Object layer

property linkdata: dict

Object link data

property metadata: metadata

Object metadata

property mirrored_horizontally: bool

Dimension mirror (horizontal)

property mirrored_vertically: bool

Dimension mirror (vertical)

property name: str

Object name

Gets the number of object links.

object_details() str

Gets the object’s information as a formatted report.

property scale: str

Dimension scale

property section_widths: section_widths

Object section width data

set_arrow_length(length: float)

Sets the dimension arrow length.

set_arrow_width(width: float)

Sets the dimension arrow width.

set_attributes(attr: attributes)

Sets the object attribute data.

Parameters:

attr (attributes) – The attributes to set.

set_colour(colour: int)

Sets the object colour.

Parameters:

colour (int) – The index of the colour to set.

set_description(desc: str)

Sets the object description.

Parameters:

desc (str) – The description to set.

set_feature(feature: str)

Sets the object feature.

Defaults to searching the paths: VULCAN_CORPORATE > CWD > ENVIS_RESO. First found will be used.

Note

Layer information is not set automatically like in Vulcan.

Parameters:

feature (str) – The feature to set.

set_feature_with_file(feature: str, ignoreMissingFeatures: bool = True, featureFile: str = '')

Sets the object feature with a specific feature file.

Blank file will search the same as set_feature. If ignore flag is set, missing files and invalid feature codes will be set without attributes.

Note

Layer information is not set automatically like in Vulcan.

Parameters:
  • feature (str) – The feature to set.

  • ignoreMissingFeatures (bool) – Whether to ignore missing feature codes.

  • featureFile (str) – The filepath to the feature file.

Raises:
set_font(name: str)

Sets the dimension font.

set_group(group: str)

Sets the object group.

Parameters:

group (str) – The group to set.

set_label(label: str)

Sets the dimension label.

Sets the object link.

Parameters:
  • k (int) – The index of the link record to set.

  • type (int) – The type of the link data.

  • value (str) – The value to set.

set_linkdata(dictionary: dict)

Sets the object link data from a dictionary.

set_metadata(meta: metadata)

Sets the object metadata.

Parameters:

meta (metadata) – The metadata to set.

set_mirrored_horizontally(mirror: bool = True)

Sets the dimension mirror setting (horizontal).

set_mirrored_vertically(mirror: bool = True)

Sets the dimension mirror setting (vertical).

set_name(name: str)

Sets the object name.

Parameters:

name (str) – The name to set.

set_primitive(dictionary: dict)

Sets the object primitive data.

set_scale(scale: str)

Sets the dimension scale.

Parameters:

scale (str) – The scale to set. This is a string in the form of a ratio, i.e. “1:1000”.

set_section_widths(sect: section_widths)

Sets the object section width data.

Parameters:

sect (section_widths) – The section width data to set.

set_text_height(height: float)

Sets the dimension text height.

set_text_map_size(size: float)

Sets the dimension text map size.

set_tick_extent_size(size: float)

Sets the dimension tick extent size.

set_tick_gap(gap: float)

Sets the dimension tick gap.

set_tick_offset(offset: float)

Sets the dimension tick offset.

set_value(value: float)

Sets the object value.

Parameters:

value (float) – The value to set.

property text_height: float

Dimension text height

property text_map_size: float

Dimension text map size

property tick_extent_size: float

Dimension tick extent size

property tick_gap: float

Dimension tick gap

property tick_offset: float

Dimension tick offset

property type: str

Object type

property value: float

Object value

class callback(func: Callable = None)

Bases: swig_callback

Callback creator for Vulcan utilities. Create a callback and pass it to a function that uses it.

Example

>>> def my_func(*args, **kwargs):
>>>     return {"result" : "new data"}
>>> cb = vulcan.callback(my_func)
set_callback(func: Callable)

Sets a callback from a callable function.

__call__(*args, **kwargs)

Executes stored function and passes the return back to the C++ code.

`*args` and `**kwargs` are passed through to the callback.

class attributes

Bases: object

Class for accessing object attribute data.

__init__()

Class for accessing object attribute data.

template_list() list[str]

List of templates defined for the object.

attribute_list(templateName: str, templateVariant: dict = {}) list[str]

List of attributes in a given template. Ordered by the second argument template

get_template(temp: str) dict

Gets the dictionary for a given template.

set_template(temp: str, data: dict)

Sets the attributes of a template from a dictionary.

get_attribute(temp: str, attribute: str) dict

Gets a single attribute.

get_date_attribute(temp: str, attribute: str) datetime.datetime

Gets a date attribute as a Python datetime object.

set_attribute(temp: str, attribute: str, value: dict)

Sets a single attribute.

as_dict() dict

Gets the attribute data as a dictionary.

from_dict(data: dict)

Sets the attribute data from a dictionary.

class metadata

Bases: object

Class for manipulating object metadata.

__init__()

Class for manipulating object metadata.

num_fields() int

Returns the number of metadata fields.

field_list() list[str]

Returns the list of metadata fields.

has_field(field: str) bool

Returns true if a field exists in the metadata.

remove_field(field: str)

Removes a field.

get_value(field: str) str

Gets a field value.

set_field(field: str, value: str)

Sets a field value.

get_timestamp(field: str) datetime.datetime

Gets a timestamp of a field.

as_dict() dict

Gets the metadata as a dictionary.

from_dict(data: dict)

Builds metadata from a dictionary.

class section_widths

Bases: object

Controls section widths of an object

__init__()

Controls section widths of an object

set_cross_sections(enable: bool = True)

Sets the use of cross sections.

get_cross_sections() bool

Gets the cross section use value.

enable_section_width(enable: bool = True)

Enables section width use.

use_section_width() bool

Gets the value of section width use.

set_front_width(width: float)

Sets the section front width.

get_front_width() float

Gets the section front width.

set_back_width(width: float)

Sets the section back width.

get_back_width() float

Gets the section back width.

property cross_sections: bool

Section widths cross sections setting.

property cross_points: bool

Section widths cross points setting.

property enable: bool

Section widths section width setting.

property front_width: float

Section widths front width.

property back_width: float

Section widths back width.

class compare_isis(isis_name_0: str = '', isis_name_1: str = '')

Bases: object

Interface to allow comparing two isis databases.

__init__(isis_name_0: str = '', isis_name_1: str = '') None

Initializes a new compare_isis object.

set_isis(isis_name_0: str, isis_name_1: str)

Sets the isis files to use for comparison.

clear()

Clears the comparison information.

compare() bool

Compares the two isis databases provided.

Returns:

True if equal, False otherwise.

Return type:

bool

set_verbose_level(level: int)

Sets the verbosity of the comparison.

get_verbose_level() int

Get the verbosity level of the comparison.

set_check_design(on_off: bool)

Sets whether to check designs when comparing.

get_check_design() bool

Get whether to check designs when comparing.

set_check_key(on_off: bool, key_match: str = '')

Set whether to check key when comparing.

get_check_key() bool

Check whether key is included for comparison.

get_check_key_match(self) std::string
set_check_fields(on_off: bool, tol: float = 0.0001)

Set whether to check fields when comparing.

get_check_fields() bool

Whether or not fields will be checked when comparing for equality.

get_check_fields_tolerance() float

Ges the tolerance used for checking field equality.

add_field_to_test(table: str, field: str)

Add a field to check during comparison.

get_number_of_fields_to_test() int

Get the number of fields checked during comparison.

get_test_field_table(i: int) str

Get the table that a field belongs to.

Parameters:

i (int) – The index of the field being tested.

Returns:

The name of the table.

Return type:

str

get_test_field(i: int) str

Get the name of a field.

Parameters:

i (int) – The index of the field being tested.

Returns:

The name of the field.

Return type:

str

class compare_tris(tri_name_0: str = '', tri_name_1: str = '')

Bases: object

Interface to compare two triangulations.

__init__(tri_name_0: str = '', tri_name_1: str = '') None

Initializes a new compare_tris object.

set_tris(tri_name_0: str, tri_name_1: str)

Sets the triangulation files to use for comparison.

clear()

Clears the comparison information.

compare() bool

Compares the two triangulations provided.

Returns:

True if equal, False otherwise.

Return type:

bool

set_verbose_level(level: int)

Sets the verbosity of the comparison.

get_verbose_level() int

Get the verbosity level of the comparison.

set_check_triangles(onOff: bool)

Sets whether to check triangles when comparing.

get_check_triangles() bool

Check whether triangles are included for comparison.

set_check_surface_area(onOff: bool, tol: float = 0.0001)

Sets whether to check surface area when comparing.

get_check_surface_area() bool

Check whether surface area is included for comparison.

get_surface_area_tolerance() float

Get the tolerance allowed when comparing surface areas.

set_check_volume(onOff: bool, tol: float = 0.0001)

Sets whether to check volume when comparing.

get_check_volume() bool

Check whether volume is included for comparison.

get_volume_tolerance() float

Get the tolerance allowed when comparing volumes.

set_check_extents(onOff: bool, tol: float = 0.0001)

Sets whether to check extents when comparing.

get_check_extents() bool

Check whether extents are included for comparison.

get_extents_tolerance() float

Get the tolerance allowed when comparing extents.

set_check_properties(arg2: bool)

Sets whether to check properties when comparing.

get_check_properties() bool

Check whether properties are included for comparison.

class compare_grids(grid_name_0: str = '', grid_name_1: str = '')

Bases: object

Interface to allow comparing two grids.

__init__(grid_name_0: str = '', grid_name_1: str = '') None

Initializes a new compare_grids object.

set_grids(grid_name_0: str, grid_name_1: str)

Sets the grid files to use for comparison.

clear()

Clears the comparison information.

compare() bool

Compares the two grids provided.

Returns:

True if equal, False otherwise.

Return type:

bool

set_verbose_level(level: int)

Sets the verbosity level of the comparison.

get_verbose_level() int

Get the verbosity level of the comparison.

set_check_value(on_off: bool, tol: float = 0.0001)

Sets whether to include values when comparing.

get_check_value() bool

Check whether values are included for comparison.

get_value_tolerance() float

Get the tolerance allowed when comparing values.

set_check_mask(on_off: bool)

Sets whether to include masks when comparing.

get_check_mask() bool

Check whether masks are included for comparison.

set_check_origin(on_off: bool, tol: float = 0.0001)

Sets whether to include origin when comparing.

get_check_origin() bool

Check whether the origin is included for comparison.

get_origin_tolerance() float

Get the tolerance allowed when comparing origins.

set_check_extents(on_off: bool, tol: float = 0.0001)

Sets whether to extents are included for comparison.

get_check_extents() bool

Check whether extents are included for comparison.

get_extents_tolerance() float

Get the tolerance allowed when comparing extents.

set_check_cell_spacing(on_off: bool, tol: float = 0.0001)

Sets whether cell spacing is included for comparison.

get_check_cell_spacing() bool

Check whether cell spacing is included for comparison.

get_cell_spacing_tolerance() float

Get the tolerance allowed when comparing cell spacing.

class compare_dgds(dgd_name_0: str = '', dgd_name_1: str = '')

Bases: object

Interface to allow comparing two dgds.

__init__(dgd_name_0: str = '', dgd_name_1: str = '') None

Initializes a new compare_dgds object.

set_dgds(dgd_name_0: str, dgd_name_1: str)

Sets the dgd files to use for comparison.

clear()

Clears the comparison information.

compare(layer_name: str = '') bool

Compares the two dgds provided.

Returns:

True if equal, False otherwise.

Return type:

bool

set_verbose_level(level: int)

Sets the verbosity level of the comparison.

get_verbose_level() int

Get the verbosity level of the comparison.

set_tolerance(tol: float = 0.0001)

Set the tolerance to use when comparing numeric values.

get_tolerance() float

Get the tolerance allowed when comparing numeric values.

set_check_object_name(on_off: bool)

Sets whether to include object names for comparison.

get_check_object_name() bool

Check whether object names are included for comparison.

set_check_object_description(on_off: bool)

Sets whether to include object descriptions for comparison.

get_check_object_description() bool

Check whether object descriptions are included for comparison.

set_check_colours(on_off: bool)

Sets whether to include colours for comparison.

get_check_colours() bool

Check whether colours are included for comparison.

class compare_blockmodels(model_name_0: str = '', model_name_1: str = '')

Bases: object

Interface to allow comparing two block models.

__init__(model_name_0: str = '', model_name_1: str = '') None

Initializes a new compare_blockmodels object.

set_blockmodels(model_name_0: str, model_name_1: str)

Sets the block model files to use for comparison.

clear()

Clears the comparison information.

compare() bool

Compares the two block models provided.

Returns:

True if equal, False otherwise.

Return type:

bool

set_verbose_level(level: int)

Sets the verbosity level of the comparison.

get_verbose_level() int

Get the verbosity level of the comparison.

set_check_nblocks(on_off: bool)

Sets whether to include number of blocks for comparison.

get_check_nblocks() bool

Check whether number of blocks are included for comparison.

set_check_origin(on_off: bool, tol: float = 0.0001)

Sets whether to include origins for comparison.

get_check_origin() bool

Check whether origins are included for comparison.

get_origin_tolerance() float

Get the tolerance allowed when comparing origins.

set_check_rotation(on_off: bool, tol: float = 0.0001)

Sets whether to check rotation when comparing.

get_check_rotation() bool

Check whether rotation is included for comparison.

get_rotation_tolerance() float

Get the tolerance allowed when comparing rotations.

set_check_extent(on_off: bool, tol: float = 0.0001)

Sets whether to check extents when comparing.

get_check_extent() bool

Check whether extents are included for comparison.

get_extent_tolerance() float

Get the tolerance allowed when comparing extents.

set_check_schema(on_off: bool, tol: float = 0.0001)

Sets whether to check schemas when comparing.

get_check_schema() bool

Check whether schemas are included for comparison.

get_schema_tolerance() float

Get the tolerance allowed when comparing schemas.

set_check_variable_list(on_off: bool)

Sets whether to include variable lists for comparison.

get_check_variable_list() bool

Check whether variable lists are included for comparison.

set_check_variable_value(on_off: bool, tol: float = 0.0001)

Sets whether to include variable values when comparing.

get_check_variable_value() bool

Check whether variable values are included for comparison.

get_variable_value_tolerance() float

Get the tolerance allowed when comparing variable values.

set_specific_variable_check(variable: str) bool

Set a specific variable to be checked during comparison.

Parameters:

variable (str) – The variable to check.

get_specific_check_variable() str

Check which specific variable is included for comparison.

enum field_type(value)

Bases: IntEnum

Options for the field types.

Member Type:

int

Valid values are as follows:

ERROR = <field_type.ERROR: -1>
CHAR = <field_type.CHAR: 0>
INT32 = <field_type.INT32: 1>
FLOAT32 = <field_type.FLOAT32: 2>
FLOAT64 = <field_type.FLOAT64: 3>
MISSING = <field_type.MISSING: 4>
enum design_type(value)

Bases: StrEnum

Options for the design types.

Member Type:

str

Valid values are as follows:

BLOCKOUT = <design_type.BLOCKOUT: 'Blockout'>
DRILLING = <design_type.DRILLING: 'Drilling'>
GEOTECH = <design_type.GEOTECH: 'Geotech'>
class Synonyms

Bases: object

class Drilling

Bases: object

enum Table(value)

Bases: StrEnum

Options for drilling table synonyms.

Member Type:

str

Valid values are as follows:

HOLE_ID = <Table.HOLE_ID: 'HoleId'>
LOCATION = <Table.LOCATION: 'Location'>
HOLE_ID_LOCATION = <Table.HOLE_ID_LOCATION: 'HoleId,Location'>
GEOLOGICAL = <Table.GEOLOGICAL: 'Geological'>
ASSAY = <Table.ASSAY: 'Assay'>
ANALYTICAL = <Table.ANALYTICAL: 'Analytical'>
SURVEY = <Table.SURVEY: 'Survey'>
GEOTECH = <Table.GEOTECH: 'Geotech'>
enum Hole_Id(value)

Bases: StrEnum

Options for drilling holeid synonyms.

Member Type:

str

Valid values are as follows:

HOLE_ID = <Hole_Id.HOLE_ID: 'HoleId'>
enum Location(value)

Bases: StrEnum

Options for drilling location synonyms.

Member Type:

str

Valid values are as follows:

EASTING = <Location.EASTING: 'Easting'>
NORTHING = <Location.NORTHING: 'Northing'>
ELEVATION = <Location.ELEVATION: 'Elevation'>
TOTAL_DEPTH = <Location.TOTAL_DEPTH: 'TotalDepth'>
enum Geological(value)

Bases: StrEnum

Options for drilling geological synonyms.

Member Type:

str

Valid values are as follows:

HORIZON = <Geological.HORIZON: 'Horizon'>
ROCK_TYPE = <Geological.ROCK_TYPE: 'RockType'>
PLY = <Geological.PLY: 'Ply'>
SAMPLE_NUM = <Geological.SAMPLE_NUM: 'SampleNum'>
TOP_DEPTH = <Geological.TOP_DEPTH: 'TopDepth'>
BOTTOM_DEPTH = <Geological.BOTTOM_DEPTH: 'BottomDepth'>
NEXT_MODIFIER = <Geological.NEXT_MODIFIER: 'NextModifier'>
CONTINUATION = <Geological.CONTINUATION: 'Continuation'>
PERCENTAGE = <Geological.PERCENTAGE: 'Percentage'>
enum Assay(value)

Bases: StrEnum

Options for drilling assay synonyms.

Member Type:

str

Valid values are as follows:

HORIZON = <Assay.HORIZON: 'Horizon'>
BOTTOM_DEPTH = <Assay.BOTTOM_DEPTH: 'BottomDepth'>
ASSAY1 = <Assay.ASSAY1: 'Assay1'>
ASSAY2 = <Assay.ASSAY2: 'Assay2'>
ASSAY3 = <Assay.ASSAY3: 'Assay3'>
ASSAY4 = <Assay.ASSAY4: 'Assay4'>
enum Analytical(value)

Bases: StrEnum

Options for drilling analytical synonyms.

Member Type:

str

Valid values are as follows:

HORIZON = <Analytical.HORIZON: 'Horizon'>
BOTTOM_DEPTH = <Analytical.BOTTOM_DEPTH: 'BottomDepth'>
ANALYTICAL1 = <Analytical.ANALYTICAL1: 'Analytical1'>
ANALYTICAL2 = <Analytical.ANALYTICAL2: 'Analytical2'>
ANALYTICAL3 = <Analytical.ANALYTICAL3: 'Analytical3'>
ANALYTICAL4 = <Analytical.ANALYTICAL4: 'Analytical4'>
enum Survey(value)

Bases: StrEnum

Options for drilling survey synonyms.

Member Type:

str

Valid values are as follows:

INCLINATION = <Survey.INCLINATION: 'Inclination'>
BEARING = <Survey.BEARING: 'Bearing'>
INTERCEPT_DEPTH = <Survey.INTERCEPT_DEPTH: 'InterceptDepth'>
enum Geotech(value)

Bases: StrEnum

Options for drilling geotech synonyms.

Member Type:

str

Valid values are as follows:

DEPTH = <Geotech.DEPTH: 'Depth'>
ALPHA = <Geotech.ALPHA: 'Alpha'>
BETA = <Geotech.BETA: 'Beta'>
__init__()
class Blockout

Bases: object

enum Table(value)

Bases: StrEnum

Options for blockout table synonyms.

Member Type:

str

Valid values are as follows:

BLAST_SOLID_POINTS = <Table.BLAST_SOLID_POINTS: 'blast_solid_points'>
BLAST_SOLID_TRIS = <Table.BLAST_SOLID_TRIS: 'blast_solid_tris'>
GRADE_BLOCK_SOLID_POINTS = <Table.GRADE_BLOCK_SOLID_POINTS: 'grade_block_solid_points'>
GRADE_BLOCK_SOLID_TRIS = <Table.GRADE_BLOCK_SOLID_TRIS: 'grade_block_solid_tris'>
STRING_HEADER = <Table.STRING_HEADER: 'string_header'>
STRING_POINTS = <Table.STRING_POINTS: 'string_points'>
STRING_TRIANGLES = <Table.STRING_TRIANGLES: 'string_triangles'>
POLY_POINTS = <Table.POLY_POINTS: 'poly_points'>
GRADE_BLOCKS = <Table.GRADE_BLOCKS: 'grade_blocks'>
BLOCK_MODEL_GRADES = <Table.BLOCK_MODEL_GRADES: 'block_model_grades'>
BLOCK_MODEL_GRADE_BLOCKS = <Table.BLOCK_MODEL_GRADE_BLOCKS: 'block_model_grade_blocks'>
FACE_POINTS = <Table.FACE_POINTS: 'face_points'>
HOLE_COLLARS = <Table.HOLE_COLLARS: 'hole_collars'>
enum Blast_Solid_Points(value)

Bases: StrEnum

Options for blockout blast solid points synonyms.

Member Type:

str

Valid values are as follows:

POINT_NO = <Blast_Solid_Points.POINT_NO: 'point_no'>
EASTING = <Blast_Solid_Points.EASTING: 'Easting'>
NORTHING = <Blast_Solid_Points.NORTHING: 'Northing'>
ELEVATION = <Blast_Solid_Points.ELEVATION: 'Elevation'>
enum Blast_Solid_Tris(value)

Bases: StrEnum

Options for blockout blast solid tris synonyms.

Member Type:

str

Valid values are as follows:

TRI_NO = <Blast_Solid_Tris.TRI_NO: 'tri_no'>
POINT1 = <Blast_Solid_Tris.POINT1: 'point1'>
POINT2 = <Blast_Solid_Tris.POINT2: 'point2'>
POINT3 = <Blast_Solid_Tris.POINT3: 'point3'>
enum Grade_Block_Solid_Points(value)

Bases: StrEnum

Options for blockout grade block solid points synonyms.

Member Type:

str

Valid values are as follows:

POINT_NO = <Grade_Block_Solid_Points.POINT_NO: 'point_no'>
EASTING = <Grade_Block_Solid_Points.EASTING: 'Easting'>
NORTHING = <Grade_Block_Solid_Points.NORTHING: 'Northing'>
ELEVATION = <Grade_Block_Solid_Points.ELEVATION: 'Elevation'>
enum Grade_Block_Solid_Tris(value)

Bases: StrEnum

Options for blockout grade block solid tris synonyms.

Member Type:

str

Valid values are as follows:

TRI_NO = <Grade_Block_Solid_Tris.TRI_NO: 'tri_no'>
POINT1 = <Grade_Block_Solid_Tris.POINT1: 'point1'>
POINT2 = <Grade_Block_Solid_Tris.POINT2: 'point2'>
POINT3 = <Grade_Block_Solid_Tris.POINT3: 'point3'>
enum String_Header(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

STRING_NO = <String_Header.STRING_NO: 'string_no'>
STRING_TYPE = <String_Header.STRING_TYPE: 'string_type'>
enum String_Points(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

STRING_NO = <String_Points.STRING_NO: 'string_no'>
POINT_NO = <String_Points.POINT_NO: 'point_no'>
EASTING = <String_Points.EASTING: 'Easting'>
NORTHING = <String_Points.NORTHING: 'Northing'>
ELEVATION = <String_Points.ELEVATION: 'Elevation'>
enum String_Triangles(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

STRING_NO = <String_Triangles.STRING_NO: 'string_no'>
TRI_NO = <String_Triangles.TRI_NO: 'tri_no'>
POINT1 = <String_Triangles.POINT1: 'point1'>
POINT2 = <String_Triangles.POINT2: 'point2'>
POINT3 = <String_Triangles.POINT3: 'point3'>
enum Poly_Points(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

POINT_NO = <Poly_Points.POINT_NO: 'point_no'>
EASTING = <Poly_Points.EASTING: 'Easting'>
NORTHING = <Poly_Points.NORTHING: 'Northing'>
ELEVATION = <Poly_Points.ELEVATION: 'Elevation'>
enum Grade_Blocks(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

VOLUME = <Grade_Blocks.VOLUME: 'volume'>
EASTING = <Grade_Blocks.EASTING: 'Easting'>
NORTHING = <Grade_Blocks.NORTHING: 'Northing'>
ELEVATION = <Grade_Blocks.ELEVATION: 'Elevation'>
EASTING_USER = <Grade_Blocks.EASTING_USER: 'Easting_user'>
NORTHING_USER = <Grade_Blocks.NORTHING_USER: 'Northing_user'>
ELEVATION_USER = <Grade_Blocks.ELEVATION_USER: 'Elevation_user'>
enum Block_Model_Grades(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

BLOCK_MODEL = <Block_Model_Grades.BLOCK_MODEL: 'block_model'>
VOLUME = <Block_Model_Grades.VOLUME: 'volume'>
enum Block_Model_Grade_Blocks(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

BLOCK_MODEL = <Block_Model_Grade_Blocks.BLOCK_MODEL: 'block_model'>
VOLUME = <Block_Model_Grade_Blocks.VOLUME: 'volume'>
enum Face_Points(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

POINT_NO = <Face_Points.POINT_NO: 'point_no'>
EASTING = <Face_Points.EASTING: 'Easting'>
NORTHING = <Face_Points.NORTHING: 'Northing'>
ELEVATION = <Face_Points.ELEVATION: 'Elevation'>
enum Hole_Collars(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

HOLE_NO = <Hole_Collars.HOLE_NO: 'hole_no'>
EASTING = <Hole_Collars.EASTING: 'Easting'>
NORTHING = <Hole_Collars.NORTHING: 'Northing'>
ELEVATION = <Hole_Collars.ELEVATION: 'Elevation'>
INTERCEPT_DEPTH = <Hole_Collars.INTERCEPT_DEPTH: 'InterceptDepth'>
BEARING = <Hole_Collars.BEARING: 'Bearing'>
INCLINATION = <Hole_Collars.INCLINATION: 'Inclination'>
__init__()
class Geotech

Bases: object

enum Table(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

HEADER = <Table.HEADER: 'Header'>
GEOTECH = <Table.GEOTECH: 'Geotech'>
enum Header(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

AREA = <Header.AREA: 'Area'>
enum Geotech(value)

Bases: StrEnum

Member Type:

str

Valid values are as follows:

SITE_ID = <Geotech.SITE_ID: 'SiteId'>
TYPE = <Geotech.TYPE: 'Type'>
EASTING = <Geotech.EASTING: 'Easting'>
NORTHING = <Geotech.NORTHING: 'Northing'>
ELEVATION = <Geotech.ELEVATION: 'Elevation'>
DIP = <Geotech.DIP: 'Dip'>
DIP_DIRECTION = <Geotech.DIP_DIRECTION: 'DipDirection'>
SOURCE = <Geotech.SOURCE: 'Source'>
COMMENT = <Geotech.COMMENT: 'Comment'>
FAULT = <Geotech.FAULT: 'Fault'>
STRIKE = <Geotech.STRIKE: 'Strike'>
ORIENTATION = <Geotech.ORIENTATION: 'Orientation'>
LENGTH = <Geotech.LENGTH: 'Length'>
SPACING = <Geotech.SPACING: 'Spacing'>
THROW = <Geotech.THROW: 'Throw'>
SCAN_DISTANCE = <Geotech.SCAN_DISTANCE: 'ScanDistance'>
WEIGHT = <Geotech.WEIGHT: 'Weight'>
__init__()
__init__()
class isis_field(*args, **kwargs)

Bases: object

Exposes an interface to edit Isis fields. Can be created by calling isis_table.add_field()

is_numeric()

Check whether the field type is numeric.

Returns:

True if numeric; false otherwise.

Return type:

bool

property name: str

The name of the field.

property description: str

The description of the field.

property length: int

The length of the field.

property decimals: int

The decimal precision of the field.

property default_value: str

The default value of the field.

property type: field_type

The type of the field.

property synonym: str

The synonym of the field.

map_odbc_column(odbc_column_name: str)

Map an ODBC source column to this Isis field.

Parameters:

odbc_column_name (str) – The name of the column in the data source.

Warning

This function performs no validation. It is up to the caller to ensure inputs match the data source.

See also

isis_design.apply_odbc_mappings

Apply ODBC data source changes.

class isis_table(*args, **kwargs)

Bases: object

Exposes an interface to edit Isis tables. Can be created by calling isis_design.add_table()

get_field(self, field: 'int') 'isis_field'

Get a given field from the table.

Parameters:

field (int|str) – The index (or name) of the field within the table.

Returns:

The field with the given index/name.

Return type:

isis_field

Raises:

IndexError – If index/name doesn’t exist on the table.

get_field_index(field_name: str) int

Get the index of a field.

Parameters:

field_name (str) – The name of the field to find.

Returns:

The index of the given field within the table.

Return type:

int

num_fields() int

Get the number of fields associated with the table.

Returns:

The number of associated fields.

Return type:

int

property name: str

The name of the table.

property description: str

The description of the table.

property synonym: str

The synonym of the table.

add_field(field_name: str, field_type: field_type = field_type.ERROR, field_synonym: str = '', field_description: str = '', field_length: int = 12, decimal_precision: int = 3)

Add a new field to the table.

Parameters:
  • field_name (str) – The name to assign to the new field.

  • field_type (field_type) – The type to assign to the field. Defaults to field_type.ERROR See vulcan.field_type for options.

  • field_synonym (str) – The synonym to assign to the field. See vulcan.Synonyms for options.

  • field_description (str (Optional)) – The description to assign to the field.

  • field_length (int) – The length to assign to the new field. Defaults to 12.

  • decimal_precision (int) – The number of decimal places the field is accurate to. Defaults to 3 for float type fields, 0 otherwise.

Returns:

The new field.

Return type:

isis_field

Raises:

ValueError – If field length is less than 1, text field length is greater than 256, numeric field length is greater than 1024, precision is less than 0, field name is empty or contains whitespace, or field type is MISSING or ERROR.

delete_field(self, field_index: 'int') 'bool'

Remove a field from the table.

Parameters:

field_index (int) – The index of the field to remove.

Returns:

True if successful.

Return type:

bool

Raises:

IndexError – If field_index doesn’t exist.

Overload

delete_field(self, field_name: ‘str’) -> ‘bool’

Remove a field from the table.

Parameters:

field_name (str) – The name of the field to remove.

Returns:

True if successful.

Return type:

bool

Raises:

IndexError – If field with name doesn’t exist.

map_odbc_table(odbc_table_name: str, odbc_sort_column_name: str = '')

Map an ODBC source table to this Isis table.

Parameters:
  • odbc_table_name (str) – The name of the table in the data source.

  • odbc_sort_column_name (str, optional) – The column in the data source to sort the table rows by. Data is not guaranteed to be in any order if this is not set.

Warning

This function performs no validation. It is up to the caller to ensure inputs match the data source.

See also

isis_design.apply_odbc_mappings

Apply ODBC data source changes.

class isis_design(*args, **kwargs)

Bases: object

Exposes an interface to create and edit Isis database designs. Must be instantiated with isis_design.create_design() or isis_design.load_design()

static create_design(type: design_type, description: str = '') isis_design

Create a new design.

Parameters:
  • design_type (design_type) – The type of the design.

  • description (str) – The description of the design.

Returns:

The new design.

Return type:

isis_design

static load_design(design_file: str) isis_design

Load an existing design.

Parameters:

design_file (str) – The path of the existing design file to load.

Returns:

The loaded design.

Return type:

isis_design

Raises:

OSError – If design_file can’t be found.

save_design(design_file: str) bool

Save the design to file.

Parameters:

design_file (str) – The file path to save the design to.

Returns:

True if design saves successfully. If false, failures can be checked with get_errors().

Return type:

bool

Raises:
  • ValueError – If design is invalid.

  • OSError – If design_file is an already existing file

is_valid() bool

Checks if the design is valid. Also occurs when saving.

Returns:

True if design saves successfully. If false, failures can be checked with get_errors().

Return type:

bool

Raises:

ValueError – If design is invalid.

add_table(table_name: str, table_synonym: str = None, table_description: str = None)

Add a table to the design.

Parameters:
  • table_name (str.) – The name to give the newly constructed table.

  • table_synonym (str) – The synonym to assign to the table. See vulcan.Synonyms for options.

  • table_description (str (Optional)) – The description to assign to the table. Defaults to ‘Created via Python script.’.

Returns:

The table added to the design.

Return type:

isis_table

Raises:

ValueError – If table name is empty or contains whitespace.

get_field_index(table: int | str, field_name: str) int

Return the index of a field within a given table.

Parameters:
  • table (int | str) – The index (or name) of the table within the design to search for the given field.

  • field_name (str) – The name of the field to search for.

Returns:

The index of the field within the given table.

Return type:

int

Raises:

IndexError – If table doesn’t exist.

get_field_name(table: int | str, field_index: int) str

Return the name of a field within a given table.

Parameters:
  • table (int | str) – The index (or name) of the table within the design to search for the given field.

  • field_index (int) – The index of the field within the given table.

Returns:

The name of the given field within the given table.

Return type:

str

Raises:

IndexError – If table or field_index don’t exist.

get_field_type(table: int | str, field: int | str) field_type

Return the type of a field within a given table.

Parameters:
  • table (int | str) – The index (or name) of the table within the design to search for the given field.

  • field (int | str) – The index (or name) of the field within the given table.

Returns:

The type of the given field within the given table.

Return type:

field_type

Raises:

IndexError – If table or field don’t exist.

get_table_description(table: int | str) str

Return the description of a given table.

Parameters:

table (int | str) – The index (or name) of the table within the design to get the description from.

Returns:

The description of the table.

Return type:

str

Raises:

IndexError – If table doesn’t exist.

get_field_description(table: int | str, field: int | str) str

Return the description of a given field.

Parameters:
  • table (int | str) – The index (or name) of the field’s parent table within the design.

  • field (int | str) – The index (or name) of the field within its table.

Returns:

The description of the field.

Return type:

str

Raises:

IndexError – If table or field don’t exist.

get_field_length(table: int | str, field: int | str) int

Return the length of a given field.

Parameters:
  • table (int | str) – The index (or name) of the field’s parent table within the design.

  • field (int | str) – The index (or name) of the field within its table.

Returns:

The length of the given field.

Return type:

int

Raises:

IndexError – If table or field don’t exist.

num_decimals(self, table_index: 'int', field_index: 'int') 'int'

Return the number of decimal places a given field is accurate to.

Parameters:
  • table_index (int) – The index of the field’s parent table within the design.

  • field_index (int) – The index of the field within its table.

Returns:

The number of decimal places.

Return type:

int

Raises:

IndexError – If table_index or field_index don’t exist.

Overload

num_decimals(self, table_name: ‘str’, field_name: ‘str’) -> ‘int’

Return the number of decimal places a given field is accurate to.

Parameters:
  • table_name (str) – The name of the field’s parent table within the design.

  • field_name (int) – The name of the field within its table.

Returns:

The number of decimal places.

Return type:

int

Raises:

IndexError – If table_name or field_name don’t exist.

set_field_type(table: int | str, field: int | str, field_type: field_type) bool

Set the field type of a given field.

Parameters:
  • table (int | str) – The index (or name) of the field’s parent table within the design.

  • field (int | str) – The index (or name) of the field within its table.

  • field_type (field_type) – The type to set the field to.

Returns:

True if successful; false otherwise.

Return type:

bool

Raises:
set_field_length(table: int | str, field: int | str, field_length: int) bool

Set the field length of a given field.

Parameters:
  • table (int|str) – The index of the field’s parent table within the design.

  • field (int|str) – The index of the field within its table.

  • field_length (int) – The length to set the field to.

Returns:

True if successful; false otherwise.

Return type:

bool

Raises:
  • ValueError – If field length is less than 1, greater than 256 for text fields, or greater than 1024 for numeric fields.

  • IndexError – If table or field don’t exist.

property version_major: int

Return the major version number of the design.

property version_minor: int

Return the minor version number of the design.

get_table_name(table_index: int) str

Return the name of a table at a given index.

Parameters:

table_index (int) – The index of the table within the design,

Returns:

The name of the table at the given index.

Return type:

str

Raises:

IndexError – If table_index doesn’t exist.

get_table_index(table_name: str) int

Find a table with the given name.

Parameters:

table_name (str) – The name of the table to find.

Returns:

The index of the table with the given name.

Return type:

int

num_tables() int

Return the number of tables within the design.

num_fields(table_index: int | str) int

Return the number of fields within a given table.

Parameters:

table_index (int|str) – The index (or name) of the table to retrieve number of fields from.

Returns:

The number of fields within the given table.

Return type:

int

Raises:

IndexError – If table_index doesn’t exist.

get_table(table: int | str) isis_table

Return the table at a given index.

Parameters:

table (int|str) – The index (or name) of the table within the design.

Returns:

The table at the given index.

Return type:

isis_table

Raises:

IndexError – If table doesn’t exist.

property description: str

The description of the design.

property type: design_type

The type of the design.

get_dsr() [<class 'int'>, <class 'float'>, <class 'float'>]

Return the design’s Dsr style, interval and tolerance.

Returns:

  • int – The Dsr style.

  • double – The Dsr interval.

  • double – The Dsr tolerance.

  • A return of [0, 0.0, 0.0] indicates there is no Dsr defined

set_dsr_style(style: int)

Set the Dsr style.

set_dsr_interval(interval: float)

Set the Dsr interval.

set_dsr_tolerance(tolerance: float)

Set the Dsr tolerance.

clear_keys()

Clear the keys from the design.

num_keys() int

Get the number of keys in the design.

has_key(table: int | str, field: int | str) bool
add_key(table: int | str, field: int | str) bool

Add a key at the given table/field.

remove_key(table: int | str, field: int | str) bool

Remove a key at the given table/field.

set_odbc_data_source(data_source: str, username: str = '', password: str = '')

Set an odbc data source for the design.

Parameters:
  • data_source (str) – The DSN of the data source to set.

  • username (str, optional) – The username to access the data source.

  • password (str, optional) – The password to access the data source.

Warning

This function performs no validation. It is up to the caller to ensure inputs match the data source.

See also

apply_odbc_mappings

Apply ODBC data source changes.

apply_odbc_mappings()

Apply the currently set mappings for DSN, tables and fields to the design.

This function is required for any currently set source information to take effect.

remove_odbc_mappings()

Remove all the ODBC mappings applied to the design, tables and fields.

get_errors() list[str]

Get the list of errors identified by the design.

Returns:

The list of errors identified by the design during save or load.

Return type:

list[str]

clear()

Reset the design to default values, clearning any tables, fields, synonyms, keys and errors.