PS. Create Custom Labels
In the Database tab in the Viewport Display panel locate Labels button and press its dropdown: in the Labels field 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. Find below examples of some custom labels.
Adding custom label
Press the gear icon on the right from the Label dropdown.
Click the blue plus icon to add a new label.
Rename the label as desired.
Paste the sample formula into the code editor window.
Double-click in the Available Formulas for code hints.
Press OK to finish.
Â
Â
Display Label Examples
Customised ID label
using System;
using System.Linq;
using Alastri.Patri.V2;
using Alastri.TotalScheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
public string GetLabel(RecordAndShadingContext rsc)
{
if(rsc.Record.Table.IsDump)
return "";
var Name = rsc.Record.GetNames();
var pit = Name[2];
var bench = Name[4];
var blast = Name[5];
return pit + "_" + bench + "_" + blast;
}
}
GC Dig block only
using System;
using System.Linq;
using Alastri.Patri.V2;
using Alastri.TotalScheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
public string GetLabel(RecordAndShadingContext rsc)
{
//If dump record or a blast solid, return nothing.
if(!rsc.Record.GetNames()[0].Equals("Reserves") || !rsc.Record.IsDigLeaf)
return "";
var agent = rsc.CurrentAgent;
var database = rsc.Record.Database;
var digBlock = rsc.Record.GetStringValue(database.FindField("DigSolid", "reservesDataSource"), (IParcelSubset)null);
var isGradeControl = digBlock.Equals("BlockModel");
var blast = string.Empty;
var flitch = string.Empty;
var parcel = string.Empty;
var block = string.Empty;
if (isGradeControl)
{
var Name = rsc.Record.GetNames();
var pit = Name[2];
var bench = Name[4];
var shot = Name[5];
return agent + " " + flitch + "RL" + Environment.NewLine + shot ;
}
var names = rsc.Record.GetNames();
flitch = names[6];
blast = names[5];
return agent + " " + flitch + "RL" + Environment.NewLine + blast + "_" + parcel + "_" + block;
}
}
Â
Â
Volume and Tonnes for a Dig Block
using System;
using System.Linq;
using Alastri.Patri.V2;
using Alastri.TotalScheduler.ScriptExtensions;
using System.Collections.Generic;
using Alastri.Scripting;
using Alastri.SchedulingCore;
public class Label : ILabelTextProvider
{
PatriField miningVol;
PatriField miningDt;
public string GetLabel(RecordAndShadingContext rsc)
{
miningDt ??= rsc.ShadingContext.Database.FindField("mining_drytonnes");
miningVol ??= rsc.ShadingContext.Database.FindField ("mining_volume");
return "dig: " + rsc.Record.GetDoubleValue(miningVol, ParcelAll.Default).ToString("#,##0") + " bcm"
+ Environment.NewLine + rsc.Record.GetDoubleValue(miningDt, ParcelAll.Default).ToString("#,##0") + " t";
}
}
Â