GXPLY class

class geosoft.gx.GXPLY
The PLY object contains the definitions for one or more
polygons, and does import and export of polygon files.
add_polygon((GXVV)arg1, (GXVV)arg2) → None:
Add a polygon to the polygon file.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

add_polygon_ex((GXVV)arg1, (GXVV)arg2, (int)arg3) → None:
Add a polygon to the polygon file.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

area() → float:
Compute the Area of a polygon
Returns:Area of a polygon
Return type:float

New in version 5.1.3.

Note:

Excluded polygons have negative area.
change_ipj((GXIPJ)arg1) → None:
Set the projection.
Parameters:arg1 (geosoft.gx.GXIPJ) – IPJ to place in the PLY
Returns:Nothing
Return type:None

New in version 5.0.5.

Note:

The PLY is re-projected to the new projection.
clear() → None:
Clear/remove all polygons from the PLY.
Returns:Nothing
Return type:None

New in version 5.1.8.

clip_area((float)arg1, (float)arg2, (float)arg3, (float)arg4) → int:
Clip a polygon to an area
Parameters:
  • arg1 (float) – min X
  • arg2 (float) – min Y
  • arg3 (float) – max X
  • arg4 (float) – max y
Returns:

PLY_CLIP constants

Return type:

int

New in version 5.1.3.

clip_line_int((float)arg1, (float)arg2, (float)arg3, (float)arg4, (GXVV)arg5, (float)arg6, (int_ref)arg7) → int:
Clips a line in or out of the polygons for intersections (GS_DOUBLE).
Intersections are returned as fiducials down the line stored in VV
starting at the first point of the line.
Examples:
No intersection: PLY_LINE_CLIP_OUTSIDE, 0 intersections
Starts outside, ends inside: PLY_LINE_CLIP_OUTSIDE, 1 intersection
Starts outside, intersects then ends inside or outside: PLY_LINE_CLIP_OUTSIDE, 2 intersections
Starts inside, ends inside : PLY_LINE_CLIP_INSIDE, 1 intersection (gives end-of-line)
Starts inside, ends outside : PLY_LINE_CLIP_INSIDE, 1 intersection
Parameters:
  • arg1 (float) – min X of line to clip
  • arg2 (float) – min Y of line to clip
  • arg3 (float) – max X of line to clip
  • arg4 (float) – max y of line to clip
  • arg5 (geosoft.gx.GXVV) – DOUBLE VV holding intersection fids
  • arg6 (float) – data element increment (precision)
  • arg7 (geosoft.gx.int_ref) – First point value (PLY_LINE_CLIP constants value)
Returns:

0, Terminates on error (you can ignore this value)

Return type:

int

New in version 6.3.0.

clip_ply((GXPLY)arg1, (GXPLY)arg2) → int:
Clip one polygon against another
Parameters:
Returns:

PLY_CLIP constants

Return type:

int

New in version 5.1.3.

Note:

Resulting clipped polygon only has inclusive
regions of the clipped area.  Exclusion polygons
are treated as included areas.
copy((GXPLY)arg1) → None:
Destroys a PLY Object
Parameters:arg1 (geosoft.gx.GXPLY) – source
Returns:Nothing
Return type:None

New in version 5.0.0.

static create((GXContext)ctx) → GXPLY:
Creates a Polygon Object.
Parameters:ctx (geosoft.gx.GXContext) – The GX execution context
Returns:PLY Handle
Return type:geosoft.gx.GXPLY

New in version 5.0.0.

static create_s((GXContext)ctx, (GXBF)arg1) → GXPLY:
Create an PLY Object from a BF
Parameters:
Returns:

PLY Handle

Return type:

geosoft.gx.GXPLY

New in version 5.1.0.

extent((float_ref)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4) → None:
Get the extent of the current polygon.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

If there are no polygons in the PLY object, returns dummies.
get_description((str_ref)arg1) → None:
Get the PLY description string
Parameters:arg1 (geosoft.gx.str_ref) – polygon description
Returns:Nothing
Return type:None

New in version 5.1.0.

get_ipj((GXIPJ)arg1) → None:
Get the projection.
Parameters:arg1 (geosoft.gx.GXIPJ) – IPJ in which to place the PLY projection
Returns:Nothing
Return type:None

New in version 5.0.5.

get_polygon((GXVV)arg1, (GXVV)arg2, (int)arg3) → None:
Get a polygon from the PLY
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

get_polygon_ex((GXVV)arg1, (GXVV)arg2, (int)arg3, (int_ref)arg4) → None:
Get a polygon from the PLY
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

is_null() → bool

Check if the instance of geosoft.gx.GXPLY is null (undefined)

Returns:True if this is a null instance of geosoft.gx.GXPLY, False otherwise.
Return type:bool`
load_table((str)arg1) → None:
Loads Polygons from a Polygon file.
Parameters:arg1 (str) – Name of the polygon file File contains coordinates of one or more polygons
Returns:Nothing
Return type:None

New in version 5.0.0.

static null() → GXPLY

A null (undefined) instance of geosoft.gx.GXPLY

Returns:A null geosoft.gx.GXPLY
Return type:geosoft.gx.GXPLY
num_poly() → int:
Get the number of polygons.
Returns:number of polygons in the PLY.
Return type:int

New in version 5.0.0.

rectangle((float)arg1, (float)arg2, (float)arg3, (float)arg4) → None:
Creates a polygon from a rectangular area.
Parameters:
  • arg1 (float) – Min X
  • arg2 (float) – Min Y
  • arg3 (float) – Max X
  • arg4 (float) – Max Y
Returns:

Nothing

Return type:

None

New in version 5.0.5.

rotate((float)arg1, (float)arg2, (float)arg3) → None:
Rotate a polygon about a point.
Parameters:
  • arg1 (float) – Rotation point, X
  • arg2 (float) – Rotation point, Y
  • arg3 (float) – Rotation angle, CCW in degrees
Returns:

Nothing

Return type:

None

New in version 5.0.0.

save_table((str)arg1) → None:
Save Polygons to a Polygon file.
Parameters:arg1 (str) – Name of the polygon file
Returns:Nothing
Return type:None

New in version 5.0.0.

serial((GXBF)arg1) → None:
Serialize an PLY to a BF
Parameters:arg1 (geosoft.gx.GXBF) – BF to serialize to
Returns:Nothing
Return type:None

New in version 5.1.0.

set_description((str)arg1) → None:
Set the PLY description string
Parameters:arg1 (str) – polygon description
Returns:Nothing
Return type:None

New in version 5.1.0.

set_ipj((GXIPJ)arg1) → None:
Set the projection.
Parameters:arg1 (geosoft.gx.GXIPJ) – IPJ to place in the PLY
Returns:Nothing
Return type:None

New in version 5.0.5.

Note:

This changes the projection information only.
thin((float)arg1) → None:
Thin polygons to a desired resolution
Parameters:arg1 (float) – thining resolution
Returns:Nothing
Return type:None

New in version 5.1.3.

Note:

Points on the polygon that deviate from a line drawn between
neighboring points by more than the thining resolution will
be removed.

PLY_CLIP constants

Polygon clipping mode
gx.PLY_CLIP_NO_INTERSECT = 0
The polygons do not intersect
gx.PLY_CLIP_INTERSECT = 1
The polygons do intersect
gx.PLY_CLIP_A_IN_B = 2
Polygon A is completly inside polygon B
gx.PLY_CLIP_B_IN_A = 3
Polygon B is completly inside polygon A

PLY_LINE_CLIP constants

Polygon line clip indicator
gx.PLY_LINE_CLIP_INSIDE = 0
The start point of the line is inside
gx.PLY_LINE_CLIP_NO_INTERSECT = 0
This name is a misnomer - it should have been PLY_LINE_CLIP_INSIDE, but is retained to support legacy code
gx.PLY_LINE_CLIP_OUTSIDE = 1
The start point of the line is outside
gx.PLY_LINE_CLIP_ERROR = 2