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 example of some custom labels.

Adding custom label

  1. Press the gear icon on the right from the Label dropdown.

  2. Click the blue plus icon to add a new label.

  3. Rename the label as desired.

  4. Paste the sample formula into the code editor window.

  5. Double click in the Available Formulas for code hints.

  6. Press OK to finish.

Configure Labels dialog from the Labels button > Label field

Custom Display Label Examples

Example 1. Creating a 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.HoldsDumps) return ""; var Name = rsc.Record.GetNames(); var pit = Name[2]; var bench = Name[4]; var blast = Name[5]; return pit + "_" + bench + "_" + blast; } }

Example 2. ID label for 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; } }

Example 3. 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"; } }

Example 4. When the block was first scheduled

Â