Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Creating a custom variable

  1. Go to Setup > Block Model > Edit > Reservable Model Generator.

  2. Click Custom Variables to open the script editor.

  3. Clear all text from the code editor.

  4. Replace it with the sample code below.

...

Dry Tonnes

Code Block
languagec#
using System; 
using System.Collections.Generic; 
using System.Text; 
using System.Linq; 
using Alastri.Scripting; 
using Alastri.BlockModel.Engine.CustomVariables;

public class DryTonnes : IDoubleCustomVariable
{
    public double GetNumber(CustomVariablesContext context)
    {
        double density = context.N("DENSITY");

        double volume = context.N("XINC")*context.N("YINC")*context.N("ZINC");
        
        return (density > 0 ? density * volume : 0);
        
    }
}

...