How to Add Custom Function to GPdotNET
Several people have asked me how to quick add custom function in Function Set of GPdotNET. From the User perspective it is impossible, but if you open GPdotNET with Visual Studio 2010 and make some very few changes you can achieve this.
Suppose you need to add Function with the name: Substract5, which substract 5 numbers. Write short details about our function:
Description: Substract 5 numbers.
So here is step by step instruction how to add new function in GPdotNET.
1.Open GPdotNET source code project with Visual Studio 2010. You can download the latest source from www.gpdotnet.codplex.com
2. Open FunctionSet.XML from GPdotNET project, like picture below:
3. Now that we finish definition in XML file, we need implement function in sourcecode.
4. Open GPFUnctionSte.cs from gpLib project. Add case statement in Evaluate Method. Case statement must contains the number the same as we defined in XML ID tag. So here is implementation.
5. That’s all. Compile and run application. In function set tab our new method will appear.