GXDOCU class

class geosoft.gx.GXDOCU
Class to work with documents
copy((GXDOCU)arg1) → None:
Copy DOCU
Parameters:arg1 (geosoft.gx.GXDOCU) – source DOCU
Returns:Nothing
Return type:None

New in version 5.1.1.

static create((GXContext)ctx) → GXDOCU:
Create a document onject
Parameters:ctx (geosoft.gx.GXContext) – The GX execution context
Returns:DOCU Object
Return type:geosoft.gx.GXDOCU

New in version 5.1.1.

static create_s((GXContext)ctx, (GXBF)arg1) → GXDOCU:
Create from a serialized source
Parameters:
Returns:

DOCU Object

Return type:

geosoft.gx.GXDOCU

New in version 5.1.1.

doc_name((str_ref)arg1) → None:
The document name.
Parameters:arg1 (geosoft.gx.str_ref) – buffer to fill with document name
Returns:Nothing
Return type:None

New in version 5.1.1.

file_name((str_ref)arg1) → None:
The original document file name.
Parameters:arg1 (geosoft.gx.str_ref) – buffer to fill with document file name
Returns:Nothing
Return type:None

New in version 5.1.1.

get_file((str)arg1) → None:
Get the document and place in a file.
Parameters:arg1 (str) – file to which to write document
Returns:Nothing
Return type:None

New in version 5.1.1.

get_file_meta((str)arg1) → None:
Get the document and place in a file with metadata.
Parameters:arg1 (str) – file to which to write document
Returns:Nothing
Return type:None

New in version 5.1.8.

Note:

If this document is only a URL link, the URL link will
be resolved and the document downloaded from the appropriate
server using the protocol specified.

The document has metadata, and the native document does not
support metadata, the metadata will be placed in an associated
file "filename.extension.GeosoftMeta"
get_meta((GXMETA)arg1) → None:
Get the document's meta
Parameters:arg1 (geosoft.gx.GXMETA) – META object to fill in with the document’s meta
Returns:Nothing
Return type:None

New in version 5.1.1.

have_meta() → bool:
Do you have meta data?
Returns:bool
Return type:bool

New in version 5.1.1.

is_null() → bool

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

Returns:True if this is a null instance of geosoft.gx.GXDOCU, False otherwise.
Return type:bool`
is_reference() → int:
Is the document only a reference (a URL) ?
Returns:1 - Yes, 0 - No
Return type:int

New in version 5.1.6.

static null() → GXDOCU

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

Returns:A null geosoft.gx.GXDOCU
Return type:geosoft.gx.GXDOCU
open((int)arg1) → None:
Open a document in the document viewer
Parameters:arg1 (int) – DOCU_OPEN constants
Returns:Nothing
Return type:None

New in version 5.1.1.

Note:

On Windows, the default application for the file extension is
used to open the file.
serial((GXBF)arg1) → None:
Serialize DOCU
Parameters:arg1 (geosoft.gx.GXBF) – BF in which to write object
Returns:Nothing
Return type:None

New in version 5.1.1.

set_file((str)arg1, (str)arg2, (str)arg3) → None:
Set the document from a file source.
Parameters:
  • arg1 (str) – document type
  • arg2 (str) – document name, if “” file name will be used
  • arg3 (str) – document file, must exist
Returns:

Nothing

Return type:

None

New in version 5.1.1.

Note:

Document types are normally identified by their extension.  If you
leave the document type blank, the extension of the document file
will be used as the document type.

To resolve conflicting types, you can define your own unique type
by entering your own type "extension" string.

The following types are pre-defined (as are any normal Geosoft
file types):

   "htm"       HTML
   "html"      HTML
   "txt"       ASCII text file
   "doc"       Word for Windows document
   "pdf"       Adobe PDF
   "map"       Geosoft map file
   "mmap"      Mapinfo map file (real extension "map")
   "grd"       Geosoft grid file
   "gdb"       Geosoft database

URL Document Links

The document name can be a URL link to the document using one of
the supported protocols. The following protocols are supported:

   http://www.mywebserver.com/MyFile.doc                 - HTTP
   dap://my.dap.server.com/dcs?DatasetName?MyFile.doc    - DAP (DAP Document Access)
   ftp://my.ftp.server.com/Dir1/MyFile.doc               - FTP protocol

The full file name will be stored but no data will be stored with
the DOCU class and the document can be retrieved using the sGetFile_DOCU
method.
set_file_meta((str)arg1, (str)arg2, (str)arg3) → None:
Set the document from a file source with metadata.
Parameters:
  • arg1 (str) – document type extension
  • arg2 (str) – document name, if NULL use file name
  • arg3 (str) – document file or URL
Returns:

Nothing

Return type:

None

New in version 5.1.8.

Note:

See geosoft.gx.GXDOCU.set_file().
This function is the same as sSetFile_DOCU, plus insures that a
META exists that includes the "Data" class.  If the file has
associated metadata, either supported natively in the file, or
through an associated file "filename.extension.GeosoftMeta",
that metadata will be loaded into the DOCU meta, and a Data
class will be constructed if one does not exist.

Also, the Document type Extension is very important in that it
specifies the document types that natively have metadata. The
ones currently supported are:

   "map"       Geosoft map file
   "gdb"       Geosoft database
   "grd"       Geosoft grid file
set_meta((GXMETA)arg1) → None:
Set the document's meta
Parameters:arg1 (geosoft.gx.GXMETA) – META to add to the document’s meta
Returns:Nothing
Return type:None

New in version 5.1.1.

DOCU_OPEN constants

How to open document
gx.DOCU_OPEN_VIEW = 0
gx.DOCU_OPEN_EDIT = 1