The script:
import geosoft.gxapi as gxapi import geosoft.gxpy as gxpy # a python script must have a rungx(), which is executed by OM when the script is run def rungx(): # get the current gx context gxp = gxpy.gx.GXpy() # say hello to the user identified by gxp.gid. gxapi.GXSYS.display_message("GX Python", "Hello {}".format(gxp.gid)) |
Place this in ../user/python folder:
Create a menu file (with extension .omn) in your C:\Program Files\Geosoft\Desktop Applications 9\user\omn folder. For example, the following menu file named MyPython.omn will present Hello as an option to the user:
/ My Python extensions /------------------------------------------------------------------------------ MENU "MyPython" ITEM "Hello" ,hello_world_extension.py |
Place this in the ../user/omn folder:
Your user will load the menu into an open project by selecting the Manage Menus... button which will open the menu manager. Your custom menu will appear under User Menus:
For the Python script to run your user must have installed and configured Python to run Geosoft modules. See Python Installation and Configuration. |
Once the menu is loaded, MyPython will appear among the Geosoft menus. Select the Hello option: