Skip to main content

Function meta-data

This page provides guidance on the available meta-data, how to use it, and what the affect will be.

Input Attribute

Input names, are automatically nicely formatted when your Input attributes have the Latex field filled in. Here is a quick cheat sheet. Same goes for units. See the example below:

[Calculation("Input sample", "Example of how to format input variables.", "[email protected]", Arup.Compute.DotNetSdk.Enums.LevelOfReview.Complete)]
public static double InputSample(
[Input("alpha", "First number", "MPa", "\\alpha")]
double a,
[Input("beta", "Second number", "MPa", "\\beta")]
double b)
{
//...
}

You'll need a double backslash \ as the first escapes the latter in C#.

Will display as:

image

Optional inputs

ArupCompute supports the use of optional inputs. These require no ArupCompute-specific setup and it can be setup in the normal C# way:

[Calculation("Input sample", "Example of how to format input variables.", "[email protected]", Arup.Compute.DotNetSdk.Enums.LevelOfReview.Complete)]
public static double InputSample(
[Input("alpha", "First number", "MPa", "\\alpha")]
double a,
[Input("beta", "Second number", "MPa", "\\beta")]
double b = 10.2)
{
//...
}

This will set the input b as an optional input.

tip

ArupCompute also supports nullable inputs. However, ArupCompute does not support inputs that are both nullable and optional. If a nullable, optional, input is supplied then ArupCompute will treat this input as only optional.

Output Attribute

Similarly to inputs, you'll need to describe what the outputs of your calculations are in more detail by using the Output attribute. This needs to be placed on the method itself.

If returning multiple items you will need multiple Output attributes, where the symbol between the attribute and the ResultItem match.

tip

These attributes are needed to advertise what your calculation returns before running it. This enables things like the Grasshopper and Dynamo components to build themselves, as well as allowing the Excel client to advertise to users what options they will have.

Persistent Calc Id endpoint

Persistent calc id's are used to uniquely identify your calculation on ArupCompute.

To give your calculation a Persistent Calc Id, use the PersistentCalcID attribute:

[Calculation("Input sample", "Example of how to format input variables.", "[email protected]", Arup.Compute.DotNetSdk.Enums.LevelOfReview.Complete)]
[PersistentCalcID("68da2c3b-5ebd-4639-991c-c9c30d338d9c")]
public static double InputSample(
double a,
double b = 10.2)
{
//...
}