/
Create a Menu to Run Python Extensions
Create a Menu to Run Python Extensions
Place Python Script in the Python folder
The script:
hello_world_extension.py
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
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:
MyPython.omn
/ My Python extensions /------------------------------------------------------------------------------ MENU "MyPython" ITEM "Hello" ,hello_world_extension.py
Place this in the ../user/omn folder:
Load the Menu
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:Run the Script
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:
, multiple selections available,
Related content
Python Installation and Configuration
Python Installation and Configuration
Read with this
Python Extensions
Python Extensions
More like this
Geosoft Packages - geosoft.gxapi and geosoft.gxpy
Geosoft Packages - geosoft.gxapi and geosoft.gxpy
Read with this
Python Extensions
Python Extensions
More like this
Hello World
Hello World
Read with this
Python Extensions
Python Extensions
More like this