Modify Geosoft.GX.Database.InterpolateChannel

Hi All,

I would like to modify Geosoft.GX.Database.InterpolateChannel, to pop up a window on completion that displays the number of dummies that have been interpolated. I could get this information from comparing the statistics of the old and new channels, but that's not very elegant.

Is there a way to modify this GX? In the past, Geosoft supplied source code for individual GXs. But I'm not sure if they still do that for GXs that are encapsulated in geogxnet.dll.

Cheers
Tim

Best Answer

Answers

  • Hi @TimArcher I've moved your question into the GXDeveloper forum. I think you are more likely to get an answer here.
    Community Manager

  • Hi @TimArcher ,

    All GX's based on GXC code can be found here on Github: https://github.com/GeosoftInc/gxc/tree/master/examples

    The InterpolateChannel method you reference is an internal command, but it can be called from a GX. Have a look at the refiddb gx which does something similar:

    https://github.com/GeosoftInc/gxc/tree/master/examples/refiddb


  • Thanks, @IanMacLeod.

    I can't spot where the refiddb GX calls the InterpolateChannel method.
  • Thank you.
  • I've thought about this a bit more.

    Could I meet my original objective by creating a Geosoft script that does the following?

    + calls the InterpolateChannel method after setting appropriate parameters
    + generates a text report for the original and interpolated channels using xyzstat.gx

    That way, I wouldn't have to get my head around GXC syntax, which I'm not currently familiar with. As you can probably tell, I'm just starting out on my GX Developer adventure!

    The problem is that I don't know:

    + what parameters to specify for the InterpolateChannel method
    + how to call the InterpolateChannel method from within my Geosoft script.

    Is there somewhere that I can find out those missing pieces of information?
  • JacquesBeaurain
    edited April 2018
    Hi Tim,

    Most GXs document theirs scripting parameters in their help but an easy way to find out the exact parameters they use is to record a script (from Project Explorer toolbar button or Settings->Scripting menu) and running the GX with some specific dialog choices you are interested in automating. You can edit the recorded GS script in any text editor after hitting Stop Recording.

    To run a GX with its scripting parameters it is then a matter of setting these parameters setting the interactive flag to 0 and using the SYS iRunGX API to execute the GX. Here is an example of this in some pseudo C# code (disclaimer I did not compile it to make sure there are no typos):

    CSYS.SetString("INTERP.GAP", ""); CSYS.SetInt("INTERP.EXTEND", 1); CSYS.SetString("INTERP.IN", "X"); CSYS.SetString("INTERP.OUT", "InterpX"); CSYS.SetString("INTERP.METHOD", "Linear"); CSYS.SetInt("INTERP.EDGE", 0); CSYS.SetInteractive(0); try { if (0 == CSYS.iRunGX(geogxnet.dll(Geosoft.GX.Database.InterpolateChannel;Run)) { CSYS.SetInteractive(1); // code to display stats etc. } } finally { CSYS.SetInteractive(1); }

    Hope this helps.

    Cheers,
    Jacques
  • Thanks, @JacquesBeaurain.

    Actually, I was hoping to somehow call the InterpolateChannel method from the GS script (after setting its parameters in the way that you've helpfully described). Perhaps in a similar fashion to the following example:

    SETINI MATHEXPRESSIONBUILDER.CHANNELINPUTBOX="C0 = C1 - C2;"
    SETINI MATHEXPRESSIONBUILDER.CHANNELEXPRESSIONFILE=""
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDID0="C2"
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDVALUE0="Drape"
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDID1="C0"
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDVALUE1="dDRAPE"
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDID2="C1"
    SETINI MATHEXPRESSIONBUILDER.CHANNELSTOREDVALUE2="altitude"
    SETINI MATHEXPRESSIONBUILDER.CHANNELNUMSTORED="3"
    SETINI MATHEXPRESSIONBUILDER.CHANNELTRIGUNITS="Radians"
    GX geogxnet.dll(Geosoft.GX.MathExpressionBuilder.MathExpressionBuilder;RunChannel)

    SETINI XYZSTAT.CHAN="dDRAPE"
    SETINI XYZSTAT.FILE=".\\dDRAPE.txt"
    SETINI XYZSTAT.SHOWLOG="1"
    SETINI EDIT.FILE=".\\dDRAPE.txt"
    SETINI EDIT.CHILD="Yes"
    SETINI EDIT.CHILD=""
    SETINI EDIT.WAIT=""
    GX xyzstat.gx

    Or would you recommend that I use C# instead?
  • Hey Tim,

    Reasons you might want/need to use a C# GX instead of a GS script are to implement decision based logic, loops or launch custom UIs etc.

    If what you want to do can be done via a GS script then that is of course the simplest. You can also put the logic for turning interactive mode on (by default it would be off) at the appropriate point in your script to show UI again via:

    INTERACTIVE ON

    The scripting menu can also help you record some other interesting things. See http://blogs.geosoft.com/exploringwithdata/2009/11/scripting-in-oasis-montaj.html and the scripting technical note PDF that's available for download for more.

    Cheers,
    Jacques

  • Hi Jacques,

    Thanks again. I'll experiment when time permits.

    Cheers,
    Tim
This discussion has been closed.