grail.engines.union Module

Version: 16.2

Table of Contents

Description

A standard interface to the union (solid/solid intersection) standalone engine executable.

Examples

Example #1:
from grail.engines import union

#this function call will return the solid intersection (point_list, face_list)
points, faces = union.union(pointList1=cube1_pts,
                            
faceList1=cube1_faces,
                            
pointList2=cube2_pts,
                            
faceList2=cube2_faces,
                            
O1="nss")
Example #2:
from grail.engines import union

#this function call will return the line(s) of intersection between two surfaces (a list of point_lists)
pointlists = union.union(pointList1=surf1_pts,
                         
faceList1=surf1_faces,
                         
pointList2=surf2_pts,
                         
faceList2=surf2_faces,
                         
O1="r")
Example #3:
from grail.engines import union

#this function call will return the volume of the solid (a float)
volume = union.union(pointList1=cube1_pts, faceList1=cube1_faces, O1="vss")

Standard Definitions

point_list:
A list of points, defined as: [[x0, y0, z0], ..., [xN, yN, zN]].
coded_point_list:
A tuple containing two items: the first item is a code (string), the second is the corresponding point_list. This data type is intended to mimic the srv file format. The code should match with an accompanying parameter file (survey code file). For example, ['BENCH', [[x0, y0, z0], ..., [xN, yN, zN]]]
face_list:

All face lists are described such that the first index indicates how many faces are in the face. For example,

[3, 1, 2, 3, 3, 4, 5, 6]

States that there are 3 vertexes in the first face, and those vertexes are 1, 2, 3. Then the next face contains 3 vertexes, which are 4, 5, 6. This may seem a bit confusing, but using this structure buys us some definite efficiencies. Note that all faces in MineSight® products have 3 vertexes.

Functions

Note

Be careful with the filepath strings used in these functions. Since the backslash character is used in Python as an escape character, it is best to use forward slashes (or two backslashes) in the filepaths.

Most arguments in these functions correspond to an option in the Standalone engine. All arguments in these functions have a default value of 'None', which makes the arguments optional. If left unspecified, the option will not be included in the call to the engine executable. Calls to these functions must use `keyword arguments` (keywords are the formal parameter names). See the examples below for more details.

union(pointList1, faceList1, pointList2, faceList2, O1, O2, area, center, offset, dec, self, merge, e, exp, z, dat, debug)

Solid/solid intersection engine. The function returns the resulting solid/surface (unless you specify the 'volume' operation, then it will return an integer).

Arguments:
pointList1 : point_list (see Standard Definitions).
point_list for solids/surface for group 1.
faceList1 : face_list (see Standard Definitions).
face_list for solids/surface for group 1.
pointList2 : point_list (see Standard Definitions).
point_list for solids/surface for group 2.
faceList2 : face_list (see Standard Definitions).
face_list for solids/surface for group 2.
O1 | O2 : string

Consists of one or three characters (to set OPERATION, TYPE, and MODE) followed by an output filename (or file name prefix for multiple mode output). Note that only OPERATION is needed to output survey data.

OPERATION - Defines action to perform:

i - Get internal pieces of intersections.

e - Get external pieces of intersections.

c - Get co-planar pieces of intersections.

I - Get all but internal pieces of intersections.

E - Get all but external pieces of intersections.

C - Get all but co-planar pieces of intersections.

a - Get all pieces broken at intersections.

x - Get intersected data.

t - Get not intersected data.

n - Get intersection of solids.

u - Get union of solids.

1 - Get difference 1 - 2 of solids.

2 - Get difference 2 - 1 of solids.

f - Split at self-intersections.

p - Get patches.

z - Decimate solids.

s - Report self-intersections.

b - Disassembly solids.

X - Explode solids.

P - Expand solids.

m - Minimize shell.

o - Close openings.

d - Show duplicate triangles.

l - Delete duplicate triangles.

q - Delete all duplicate triangles.

v - Report volume (returns a float).

g - Show edges of surfaces (returns a list of point_lists).

p - Show intersection polygons (returns a list of point_lists).

r - Show raw intersection polygons (returns a list of point_lists).

TYPE - Filters data on certain criteria:

s - Solid.

MODE - Define the way the data is output:

s - Singular: write everything in one file.

m - Multiple: write pieces with the same attribute in same file.

p - Parts: Write unconnected pieces in separate files.

area : integer
Compute area. Set value to 1 to turn on this option.
center : integer
Compute center of mass. Set value to 1 to turn on this option.
offset : integer
Set offset for expanding or shrinking of solids.
dec : integer
Switch triangle decimation on and set maximal tolerance for co-planar and co-linear offset.
self : integer
Tolerance for reporting self-intersected triangles.
merge : integer

Re-arrange solids within the same group by:

0 - keeping all solids separate (default).

1 - merging solids with the same attributes.

2 - merging all solids.

e : integer

Type of solid exapansion:

0 - isotrotical (default);

1 - anisotropical, in horizontal plane;

2 - anisotropical, two directional, up and down;

3 - anisotropical, one directional, up.

exp : string
ASCII file with co-ordinates of two points in free format
z : integer
Preferences: 0-speed, 1-consistency, 2-reliability.
dat : string
Define a directory with input files.
debug : integer
Debug option will output the command string used to call the engine executable and will relay any output messages from the engine. Set value to 1 to turn on this option.
Returns:
Most options return a tuple containing: point_list, face_list (see Standard Definitions). Exceptions include options v, g, p, r.