TS. Create Custom Labels
- 1 Adding Custom Label
- 2 Custom Labels Examples
- 2.1 Custom ID
- 2.2 Pit_Bench
- 2.3 GC
- 2.4 Tonnes and %
- 2.5 Grades
Adding Custom Label
In the Reserves tab in the Viewport Display panel locate Labels field and press its dropdown; there is a preloaded list of automatic labels for the level hierarchy and reserves fields. We can add to this list by configuring custom labels.
Press the gear icon to the right of the Label dropdown.
Click the blue plus icon to add a new label.
Rename the label to "Record".
Paste the sample formula into the code editor.
Double click in the Available Formulas for code hints.
Press OK to finish.
Custom Labels Examples
Custom ID
using System;
using Alastri.Patri;
using Alastri.Scheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
public string GetLabel(RecordAndShadingContext rsc)
{
var name = rsc.Record.GetNames();
var mine = name[1];
var pit = name[2];
var stage = name[3];
var bench = name[4];
var blast = name[5];
return "Id: " + mine + "_" + pit + "_" + stage + "_" + bench + "_" + blast;
}
}
Â
Â
Pit_Bench
using System;
using Alastri.Patri;
using Alastri.Scheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
public string GetLabel(RecordAndShadingContext rsc)
{
if(rsc.Record.Table.HoldsDumps)
return "";
var Name = rsc.Record.GetNames();
var pit = Name[1];
var bench = Name[3];
return pit + "_" + bench;
}
}
Â
GC
using System;
using Alastri.Patri;
using Alastri.Scheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
public string GetLabel(RecordAndShadingContext rsc)
{
PatriRecord record = rsc.Record;
if(record.Table.HoldsDumps || !record.IsLeaf)
return "";
PatriRowField dataSourceField = rsc.Record.Database.FindRow<PatriRowField>("misc_dataSource");
string dataSource = record.GetStringValue(dataSourceField.Field);
bool isGradeControl = !dataSource.Equals("BlockModel");
if (isGradeControl)
{
return $"GC_{record.GetFullName()}";
}
return record.GetFullName();
}
}
Â
Tonnes and %
Â
Grades
Â