Table of Contents
This module was designed to allow script writers to accomplish three main goals,
to set and get database attributes.
This allows you to set and get database values for attributes that exist within your database via the xGetAttr and vSetAttr functions.
To generate transient data that would not be stored permanently within the database.
This provides you with the ability to highlight data and provide immediate feedback to the users when they execute your script.
to add raw data straight into the database.
A generic, all purpose, add to database functionality provided by the vAddGeometry.
In general, most script writers will only concern themselves with Item 1 and modifying their attributes via the Attribute Functions. The remaining items are fairly complex and are not expected to be within the realm of every script writer.
The functions can be divided into three main groups,
Provides access to the attributes within the database directly.
Returns the attribute type for the given attribute name for a given geometry cut key. This will return a string that can be one of the following geomview constants,
- INTEGER_ATTR
- DOUBLE_ATTR
- STRING_ATTR
If the attribute type is not found or not one of the above types, then the Python None will be returned.
Sets the value for a given attribute. If the attribute name does not exist within the geometry view of the database, then this function does nothing.
If the type for the value is not the same as the type for the attribute then this function will generate a TypeError exception. One way to to help ensure that you are always inputting the correct attribute, is to wrap your input value with either one of the python built-in functions str, int, or float functions [1]. For example, consider that you want to set a "length" attribute that is of type DOUBLE_ATTR,
notice that the val is a string, but by wrapping it with the float built-in function, we can call on Python to attempt to make sure the input value is of the right type.
If a custom attribute exists, but is not part of the given IP Plan, then a ValueError is generated indicating what custom attribute can not be accessed correctly. Ensure your IP Plan has the custom attribute added to its list of attributes and attempt to call this function again.
Note
That setting the the attribute within the database does not update the Reserves Dictionary. The reserves dictionary is initialized once per script execution only, and then acts as a read-only entity during the lifetime of the script.
Refreshes the cut styling of the geometry view.
Use this after modifying the values of the cutoff styling attribute to update the styling for all cuts. This is the equivilent of clicking Edit->Refresh Styling in the Cut Design dialog.
Warning
The usage of this of this function is highly dependent on the internal knowledge of the MineSight®-3D and MineSight® Interactive Planner systems. It is not expected that script writer's know or understand all the details described below.
This performs a raw, direct dump of data into the database. You will not see any results in the viewer. The behavior of this function is fundamentally different from the other modules.
The objectid is the name of the Plan that you wish to add the geometry to.
The segementid correpsonds to the name of the new geometry you wish to insert at the given objectid. If the segmentid is blank, then a new on will be generated.
The exposed is a suggestion on wheter to expose the points (1) or to store the points as a blob. As of v3.60, this is a merely a suggestion, and may or may not be heeded.
If the force flag is set to true (1), and there is already a geometry with the given segementid and objectid defined, then the new geometry will replace the existing one.
geom is a dictionary that should have the following key, value pair layout.
- Type
- Can be either one of the following strings: "Polyline", "Polygon" "Marker", and "Shell". String value is case sensitive.
- Attributed
- 1 if it is attribute 0 otherwise.
- PointList
A list of point triplets of the form:
[[x0, y0, z0], ..., [xN, yN, zN]]- FaceList
A list of vertex indice triples. In the form:
[[v0_0, v0_1, v0_2], ..., [vN_M, ...]]where each triplet corresponds to a face.
You can use the agdm.agdmfl_from_fl and agdm.agdmfl_as_fl routines found in grail.agdm to help convert between the facelist used in grail.ag and the one used here. See the Face List Helper Functions section in the grail.agdm documentation.
- NumFaces
- The length of the list supplied to FaceList.
- NumPoints
- The length of the list supplied to PointList.
- Planar
- Set to 1 if the geometry is planar, otherwise set to 0.
- NumAttr
- Number of attributes in the AttrList.
AttrList A list of attribute dictionaries. Each attribute dictionary should have the following key, value pairs,
- Name
- Name of the attribute
- Type
- Type of the attribute. This can be one of the following strings: "String", "Real", "Integer". Type values are case sensitive.
- Value
- Value for the attribute. The type of value should match the type specified for Type.
You may find that the Geometry Dictionary Helper Functions and helper functions found in grail.agdm
[1] | "Built-in Functions". Python Library Reference. 30 May 2003. 23 June 2004. <http://www.python.org/doc/2.2.3/lib/built-in-funcs.html> |