Sometimes you need to map a Block Model field that isn't coded in the original Block Model. For example, Ore and Waste definitions can be more complex and multiple grades and types inputs are required. In this case, to define different properties use Custom Variable functionality implemented through the Script Editor.
...
Go to Setup > Block Model > Edit > Reservable Model Generator.
Click Custom Variables to open the Script Editor.
Clear all text from the Script Editor.
Replace it with one of the sample codes listed below.
In the list of available variables on the right you will see a new variable CustomT("Parcel") in bold, map it to the Parcel field.
...
Code Block | ||
---|---|---|
| ||
using System; using System.Collections.Generic; using System.Text; using System.Linq; using Alastri.Scripting; using Alastri.BlockModel.Engine.CustomVariables; public class Parcel : ITextCustomVariable { public string GetText(CustomVariablesContext context) { double fe = context.N("fe"); double al = context.N("al"); string geology = context.T("geology"); string fe_bin; if(fe > 60) { fe_bin = "60"; } else if(fe > 55) { fe = Math.Floor(fe); fe_bin = fe.ToString("#,##0"); } else { fe_bin = "50"; } string al_bin; if(al < 3) { al_bin = "3"; } else if(al < 6) { al = Math.CeilCeiling(al); al_bin = al.ToString("#,##0"); } else { al_bin = "9"; } string geoClass = "1"; if(geology.Equals("detrital", StringComparison.OrdinalIgnoreCase)) { geoClass = "2"; } return fe_bin + "_" + al_bin + "_" + geoClass; } } |
...