Table of Contents
A standard interface to the Intersect Surfaces tool. The Intersect Surfaces tool has a comprehensive set of options for generating new surfaces from the intersection of two existing surfaces.
- Example #1:
from grail.engines import sit
def callback():
print '.',
return False #Do not terminate
#read surfaces in from shl files
prim_shl = shlfile.open(prim_shl_path)
prim_pts, prim_fcs = prim_shl.read_shell()
prim_shl.close()
sec_shl = shlfile.open(sec_shl_path)
sec_pts, sec_fcs = sec_shl.read_shell()
sec_shl.close()
#set-up attributes
prim_attr = {"name":"primary", "tons":2345.6}
sec_attr = {"name":"secondary", "tons":888.8}
sitop = sit.SITOp()
sitop.opt_op(sit.opMERGE_CUT_DIFF)
sitop.opt_merge_primary(sit.mergeNONE)
sitop.opt_merge_secondary(sit.mergeNONE)
sitop.opt_is_merge_result(True)
sitop.opt_area(10.0)
sitop.opt_progress(callback)
sitop.add_primary(prim_pts, prim_fcs, prim_attr)
sitop.add_secondary(sec_pts, sec_fcs, sec_attr)
sitop.add_limit(boundingPoly)
sitop.opt_limit_primary(True)
sitop.opt_limit_secondary(True)
sitop.opt_limit_options(1)
shells = sitop.process() #returns a list of tuples
for i in range(len(shells)):
pts, faces, attribs = shells[i]
The following constants are used to define an intersect operation type. Operations are listed in the same order as they appear on the dialog. Refer to MineSight® 3-D Helpdoc (Intersect Surfaces) for more information on each of these operations.
Note
This module does not implement the Line Of Intersection operation. This operation can be performed using the Union engine.
The following constants are used to define merge options:
The following constants are used to define limit options:
class SITOp()
A SITOp object is used to specify intersect options and begin the intersect operation. Constructor takes no arguments.
Methods
- opt_op(op)
- Sets the operation type to be performed. See Constants.
- opt_merge_primary(op)
- Option to merge primary surfaces before operation. See Constants.
- opt_merge_secondary(op)
- Option to merge secondary surfaces before operation. See Constants.
- opt_is_merge_result(True)
- Option to merge all surfaces in the result into one shell. Argument can be True (1) or False (0).
- opt_area(minArea)
- Option to specify the minimum size of the surface element to use. Surfaces with the area that is smaller than specified value will be ignored and left unmodified.
- opt_norm(x, y, z)
- Set orientation in which intersection happens (horizontal plane is used by default).
- opt_progress(callback)
- Option to show progress during execution. The callback function will be run during the execution of the surface intersector. The callback function will terminate the execution if True (1) is returned.
- add_primary(prim_pts, prim_fcs, attrs=None)
- Set primary surface. Primary attributes can be specified if needed. Attributes can be stored in any data structure (list, dictionary, etc.). By default, attributes are set to None.
- add_secondary(sec_pts, sec_fcs, attrs=None)
- Set secondary surface. Secondary attributes can be specified if needed. Attributes can be stored in any data structure (list, dictionary, etc.). By default, attributes are set to None.
- add_limit(point_list)
- Set limiting polygon. Either the Primary or Secondary surfaces can be limited to the area enclosed by the limiting polygon.
- opt_limit_primary(op)
- Option to limit primary surface by limiting polygon. See Constants.
- opt_limit_secondary(op)
- Option to limit secondary surface by limiting polygon. See Constants.
- opt_limit_options(op)
- Set the limit options. See Constants.
- opt_verify_surfaces(True)
- Option to verify that input surfaces are not solids and are not self-overlapping. If a problem is found, an EngineError exception is raised.
- process()
- The main function to perform the operation on the surfaces. Returns a list of tuples containing: (point_list, face_list, attributes). Note that attributes of the primary group have higher priority than those of the secondary group.
The following "high-level" functions will process the two shells with the most commonly-used options. These functions save you the time of setting-up the SITOp structure.
intersectSurfaces(prim_pts, prim_fcs, sec_pts, sec_fcs, operation)
Run surface intersector on two surfaces.
- Arguments:
- prim_pts : point_list (see Standard Definitions).
- point_list for primary surface.
- prim_fcs : face_list (see Standard Definitions).
- face_list for primary surface.
- sec_pts : point_list (see Standard Definitions).
- point_list for secondary surface.
- sec_fcs : face_list (see Standard Definitions).
- face_list for secondary surface.
- operation : integer (constant specifying the operation type. See Constants.)
- intersect operation
- Returns:
- A tuple containing: point_list, face_list (see Standard Definitions). An EngineError is raised if no result is found.
intersectSurfacesFromFile(primary_MSR_path, secondary_MSR_path, result_MSR_path, operation)
Run surface intersector on MineSight Resource files containing surfaces.
- Arguments:
- primary_MSR_path : string
- file path of the MSR file containing the primary surface(s). An IOError is raised if file does not exist.
- secondary_MSR_path : string
- file path of the MSR file containing the secondary surface(s). An IOError is raised if file does not exist.
- result_MSR_path : string
- file path of an MSR file where the resulting surface(s) will be stored. If the file does not exist, it will be created.
- operation : integer (constant specifying the operation type. See Constants.)
- intersect operation
intersectSurfacesLimit(prim_pts, prim_fcs, sec_pts, sec_fcs, operation, limitPointList)
Run surface intersector on two surfaces. Limit the surfaces (and result) to the area enclosed by the limitPointList.
- Arguments:
- prim_pts : point_list (see Standard Definitions).
- point_list for primary surface.
- prim_fcs : face_list (see Standard Definitions).
- face_list for primary surface.
- sec_pts : point_list (see Standard Definitions).
- point_list for secondary surface.
- sec_fcs : face_list (see Standard Definitions).
- face_list for secondary surface.
- operation : integer (constant specifying the operation type. See Constants.)
- intersect operation
- limitPointList : point_list (see Standard Definitions).
- point_list of the limiting polygon
- Returns:
- A tuple containing: point_list, face_list (see Standard Definitions). An EngineError is raised if no result is found.