Skip to main content
Windward

Running the .NET Custom Function Example

Overview

These files can be used to create a WindwardCustomFunctions.dll file containing your own custom functions, to be used with the Windward .NET engine and AutoTag, version 10.0.0.0 or newer.

 

Important notes:

  1. Do not change the version of the DLL created using this code.
  2. To use, replace the assembly of the same name where you installed the .NET engine or AutoTag.

Requirements:

 

Please note - we are currently in the process of updating all video content.

Video

Instructions

Creating Custom Functions

1. Open Catapult. (Found under Start -> All Programs -> Windward Studios -> Windward .NET Engine -> .Catapult - Windward .NET Engine demos)

2. In the Catapult menu, select C# from the list of programming languages.
Catapult .NET Start Page.PNG

 

Under C# demos, select Specialized.

Catapult .NET C# Specialized.PNG

 

 

Scroll to the right and click Custom Functions. (This will open the Project file in Visual Studio.)

Catapult Custom Functions Sample.PNG

 

 

3. In the file WindwardCustomFunctions.cs, you can write your own custom functions to be used with the .NET Engine or AutoTag. To view the functions in AutoTag, continue at step 4. Otherwise skip to step 8.

 

 

4.Open Microsoft Word.

In the AutoTag tab, open the tag builder.

 

Under the select tab, click equation.

 

In the drop-down menu click Custom to view the available custom functions.
Insert Custom Function.PNG

 

Return to the Visual Studio Project File.

 

In the following steps, we will add a function LOG() that returns the log of the inputted parameter.

 

  1. Paste the following code at the end of the class:
           [FunctionDescription("Returns the log of the inputted parameter")]
            public static double LOG([ParameterDescription("Take the log (base 10) of this inputted number")] double num) 
                //Note the use of [ParameterDescription(string)] which allows for custom tip information in AutoTag.
            {
                return System.Math.Log10(num); //Returns the logarithm of the parameter.
            }​
  2. Verify that the indentation is correct; the resulting code should look like this:
  3. Click Build, Rebuild Solution. (The build will output a file called WindwardCustomFunctions.dll)
  4. Right click the project and click Open Folder in File Explorer. 
  5. In the source folder, open to bin, Debug. If your configuration was set to Release, open the Release folder. Your new .dll file is in this folder.

Installing WindwardCustomFunctions.dll for use with the .NET Engine and AutoTag

Installing these functions depends on your .NET Engine installation options. If you chose to install your .dll files in the Global Assembly Cache (GAC) – an option in the installer – you must register the new file in the Global Assembly Cache. If you did not chose this option, you must copy the files over to the .NET Engine and AutoTag install directories. Choose the option that applies to you below, and follow those instructions.

 

In the .NET Engine Installation, .dll files were copied to the GAC.

  • Open a Visual Studio Command Prompt. (Found under Start -> All Programs -> Visual Studio  -> Visual Studio Tools -> Visual Studio Command Prompt)
  • Type “cd\” to navigate to the C: Directory.
  • To navigate to the folder where your WindwardCustomFunctions.dll file is located type:
  • “cd C:\Users\%USERNAME%\Documents\Windward DotNet Engine Samples\CS\Specialized\CustomFunctions\WindwardCustomFunctions\bin\Debug\”
  • To add your new WindwardCustomFunctions.dll file to the GAC type :
  • “gacutil /i WindwardCustomFunctions.dll” 

In the .NET Engine Installation, .dll files were NOT copied to the GAC.

  • Navigate to the folder containing your new WindwardCustomFunctions.dll file. 
  • Copy the file WindwardCustomFunctions.dll.
  • Navigate to the install directory of the .NET Engine.
  • Open the folder dll.
  • Delete the current WindwardCustomFunctions.dll file.
  • Paste your new file in its place.
  • If you also have AutoTag installed, navigate to the AutoTag Directory, delete the WindwardCustomFunctions.dll file, and paste your new file in its place.

Testing the Installation in AutoTag

  1. Close all open windows of Microsoft Office.
  2. Open Microsoft Word.
  3. Click the AutoTag tab.
  4. Open the Tag Builder.
  5. Under the select tab click Equation.
  6. Choose Custom from the drop-down menu. You should see the new function LOG() in place.
  • Was this article helpful?