That's simple. In the OpenFlight Script Editor, load the script and do File>Publish to Creator. This will save the file in a special folder (PRESAGIS_CREATOR/config/scripts) that Creator uses to add items to the Script>Run Script menu. Now when you want to run your script simply select the Script>Run Script><your_script.py>. This is all explained in the Help context of the OpenFlight Script Editor (the section titled "Adding scripts to Creator user interface") in much more detail.
Unfortunately you cannot assign a shortcut key but you can run without launching the Script editor.
The code actually works just fine and it does update the database as is.
I guess that depends on what you mean by "update the database". Yes the color palette (in memory) is updated. But as you originally noted, the color palette (in the GUI) is not "redrawn" automatically to reflect the in-memory changes. That is a bug and as I noted, it has been fixed for our upcoming release (thanks to you).
Thank you so much for all the help. Could I accomplish creating this as an actual tool using the C++ api?
Yes, you can do a bit more with plugin tools that are built using the OpenFlight C API. For example, you can put them in a toolbox or a menu and the user can assign keyboard shortcuts. In addition you can build dialogs for them if you need to. Creator, admittedly, more fully supports "plugins" in this way versus OpenFlight Scripts.
Hopefully we can add more support for OpenFlight Scripts on the Creator desktop in future releases (like being able to assign icons, adding to menus or toolboxes and supporting keyboard shortcuts). Some customers have built their own dialogs using 3rd party Python GUI toolkits like wxPython.
Let us know if you have any other questions.
Craig
I am trying to load a color and a light palette with a single script in python. Here is my code:
import sys
from mgapilib import *
COLORPALETTEFILE = "E:\srcdata\models\ICAO-Airport\palettes\RSI.color"
LIGHTPALETTEFILE = "E:\srcdata\models\ICAO-Airport\palettes\flt1.lightpoints"
def main ():
mgInit (None, None)
mgReadColorPalette(mgGetCurrentDb(), COLORPALETTEFILE)
mgReadLightPointFile(mgGetCurrentDb(), LIGHTPALETTEFILE)
mgExit ()
main()
The color palette loads just fine, but the light point palette does not load. When I load the palette manually it works, what am I missing?