GXTPAT class

class GXTPAT(handle=0)

GXTPAT class.

The full name of the pattern. ex: “felsic volcanics” Code: Short-form of the pattern description. This is the value which typically appears (for instance) in the “Rock code” channel in a Wholeplot From-To data group. ex: “FVOL” The code is CASE-SENSITIVE.

Label: Text to use as a short-form in labels, graphs etc. By default, this is the same as the code. ex: “FVol.” Pattern Attributes: (See DEFAULT.`GXPAT <geosoft.gxapi.GXPAT>` in srcetc for more inforation) Pattern: The Pattern Index; defined in DEFAULT.`GXPAT <geosoft.gxapi.GXPAT>`, or in the user’s USER.`GXPAT <geosoft.gxapi.GXPAT>` file. If not specified, defaults to 0 (solid fill). Size: The pattern tile size. If not specified, defaults to 2.0mm. Density: The tiling density. If not specified, defaults to 1.0. Thickness: The line thickness in the tile, expressed as a integer percentage (0-100) of the tile size. Color: The pattern line work color. If not specified, defaults to black.

Background color: The pattern background color. If not specified, defaults to transparent (C_ANY_NONE)

Symbols:

Symbol Font The name of the symbol font to use for a given symbol index

Symbol Number Index into the font.

Symbol Rotation: Rotation in degrees CCW.

Symbol Scaling Additional scale factor to apply to symbol size (Default 1.0)

add_color(code, label, descr, color)

Add a new color to the list

Parameters:
  • code (str) – Code (required - CASE SENSITIVE)
  • label (str) – Label (optional, can be “”)
  • descr (str) – Description (optional, can be “”)
  • color (int) – Color (use GXMVIEW.color to convert to int).

New in version 7.0.

License: Geosoft Open License

Note: The new code must be unique; not in the existing list.

code(code)

Find the index of a given thematic pattern

Parameters:code (str) – Pattern code (case sensitive)
Returns:The code index, -1 if not found
Return type:int

New in version 7.0.

License: Geosoft Open License

classmethod create()

Creates an empty thematic pattern object.

Returns:GXTPAT object
Return type:GXTPAT

New in version 7.0.

License: Geosoft Open License

get_solid_pattern(index, code, label, descr, color)

Get solid pattern info from the GXTPAT.

Parameters:
  • index (int) – Index
  • code (str_ref) – Returned Code
  • label (str_ref) – Returned Label
  • descr (str_ref) – Returned Description
  • color (int_ref) – Color.

New in version 7.0.

License: Geosoft Open License

Note: Returns the solid color, pattern foreground color, or symbol color, along with the code, label and description.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
load_csv(file)

Load thematic patterns from a CSV file

Parameters:file (str) – Thematic Pattern file name

New in version 7.0.

License: Geosoft Open License

Note: The type of thematic patterns file is recognized from the types of fields found inside it.

The following fields are identified. Only the “CODE” field is required, as the “default” thematic pattern is a solid black color.

CODE The pattern code (required by all types - CASE SENSITIVE) LABEL Longer text identifier to use in legends etc. (up to 31 characters) DESCRIPTION Much longer text string (up to 127 characters).

COLOR Line color used in patterns, and for solid colors, the color. If only this field is found (and none below), the pattern file is assumed to be type TPAT_TYPE_COLOR.

PATTERN Geosoft pattern ID. PAT_SIZE Pattern tile size, or symbol size (default 2mm) PAT_DENSITY Pattern tile density (default 1.0) PAT_THICKNESS Pattern line thickness as % of size (default 5) BACK_COLOR Background color for the pattern. Also used for symbols (Default background is transparent).

SYMBFONT Symbol font (e.g. “symbols.gfn”) SYMBNUM Symbol number of the current font SYMBROT Symbol rotation SYMBSCL Additional scaling factor applied to the current size

classmethod null()

A null (undefined) instance of GXTPAT

Returns:A null GXTPAT
Return type:GXTPAT
setup_translation_vv(ltb, field, vv_values)

Initializes a GXVV used to map GXTPAT indices to output values

Parameters:
  • ltb (GXLTB) – Table containing GXTPAT codes as the key
  • field (int) – Field in GXLTB with the output values (numeric or string)
  • vv_values (GXVV) – Returned values for each GXTPAT index

New in version 7.3.

License: Geosoft Open License

Note: The input GXLTB object should have key values matching the GXTPAT codes. Whether the matches are case sensitive or not is dependent on how the GXLTB oject was created (see ltb.h). The GXLTB field values are converted to the output GXVV type.

size()

Returns the number of rows (items) in the GXTPAT object.

Returns:Number of GXTPAT items.
Return type:int

New in version 7.0.

License: Geosoft Open License

TPAT_STRING_SIZE constants

Default string sizes.

TPAT_CODE_SIZE

Tpat code size

gxapi.TPAT_CODE_SIZE = 21
TPAT_LABEL_SIZE

Tpat label size

gxapi.TPAT_LABEL_SIZE = 32
TPAT_DESC_SIZE

Tpat desc size

gxapi.TPAT_DESC_SIZE = 128
TPAT_SYMBFONT_SIZE

Tpat symbfont size

gxapi.TPAT_SYMBFONT_SIZE = 32