RR. Block Model Custom Shading

In the Designer tab in Display panel locate Block Model section and press Shading dropdown: there is a preloaded list of automatic shadings for the level hierarchy and reserves fields. We can add to this list by configuring custom shading sets.

Shading dropdown and configuration button

Creating a simple custom shading

  1. Select the gear icon next to the Shading dropdown. This opens the configuration dialog.

  2. Press the blue plus icon to add a new shading set.

  3. Rename the shading to "Materials".

  4. Drop down the Shading Field and select “Parcel”.

  5. Press the Create Entries button to populate all parcel names.

  6. Assign a colour to each parcel.

  7. Press OK to accept.

Simple shading on material type

8. In the Block Model panel on the right, toggle eye icon to show blocks and from the Shading dropdown select the blocks shading you have created - Materials (Note that custom shadings are shown in bold orange, while standard shadings are shown in normal black).

9. Select bench(es) from the tree on the left to display the viewport and review the result.

Colors assigned for block shading can be seen in the Legend (bottom right, below the viewport).

Creating a complex custom shading

  1. Select the gear icon next to the Shading dropdown. This opens the configuration dialog.

  2. Press the blue plus icon to add a new shading set.

  3. Rename the shading to "Ranges".

  4. Select the Complex tab to open the code editor.

  5. Paste in one of the sample code snippets located below.

  6. Press the Test button to make sure your code is correct. Any errors found will be shown in the Errors panel and won’t let you to proceed.

7. Fix any errors detected, run test again and press OK to accept.

Shadings codes examples

Simple Grade Shading
using System; using System.Collections.Generic; using System.Drawing; using System.Text; using System.Linq; using Alastri.RR.Ui; using Alastri.RR.Service; public class CustomBlockShading : IBlockShading { public Color GetColor(BlockContext context) { double fe = context.N("DryTonnes.FE"); if(fe > 60) return Color.FromArgb(255,0,138); //pink else if(fe > 58) return Color.Red; else if(fe > 56) return Color.Orange; else return Color.WhiteSmoke; } }
Multi-Variable Shading
using System; using System.Collections.Generic; using System.Drawing; using System.Text; using System.Linq; using Alastri; using Alastri.RR.Ui; using Alastri.RR.Service; public class CustomBlockShading : IBlockShading { Color e1_low_e2_low = Color.Magenta; Color e1_high_e2_low = Color.DeepSkyBlue; Color e1_low_e2_high = Color.Yellow; Color e1_high_e2_high = Color.White; double element1_Min = 0; double element1_Max = 12; double element2_Min = 1.5; double element2_Max = 3; public Color GetColor(BlockContext context) { double element1 = context.N("Head_Tonnes.SiO2"); double element2 = context.N("Head_Tonnes.Al2O3"); double x = element2 - element2_Min; x = Math.Max(0, x); x = Math.Min(x, element2_Max - element2_Min); double y = element1 - element1_Min; y = Math.Max(0, y); y = Math.Min(y, element1_Max - element1_Min); Color topLerp = Lerp(e1_low_e2_high, e1_high_e2_high, x / (element2_Max - element2_Min)); Color lowLerp = Lerp(e1_low_e2_low, e1_high_e2_low, x / (element2_Max - element2_Min)); Color lerp = Lerp(lowLerp, topLerp, y / (element1_Max - element1_Min)); return lerp; } public Color Lerp(Color one, Color two, double pct) { return Color.FromArgb( (int)(one.R + pct * (two.R-one.R)) , (int)(one.G + pct * (two.G-one.G)) , (int)(one.B + pct * (two.B-one.B)) ); } }