Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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.

  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 to "Record".

  4. Paste the sample formula into the code editor.

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

  6. Press OK to finish.

Custom Display Label Examples

Example 1. Create a customised ID label

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

    public class Label : ILabelTextProvider
    {
        public string GetLabel(RecordAndShadingContext rsc)
        {
			//If dump record or a blast solid, return nothing. 
			if(!rsc.Record.GetNames()[0].Eq("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.Eq("BlockModel");

            var blast = string.Empty;
            var flitch = 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 & Tonnes for a Block

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

public class Label : ILabelTextProvider
{
	public string GetLabel(RecordAndShadingContext rsc)
	{
		var date = rsc.FirstScheduledTime.ToString();
		var ignoreDate = "31/12/9999 11:59:59 PM";
		
	//Skip Conditions
		if(date == ignoreDate) 		return "" ;
		else 						return date;
	}
}
  • No labels