Block Model Custom Shading
In the Designer tab in Display panel locate Block Model section and press Shading drop-down: 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.
Creating a simple custom shading
-
Select the gear icon next to the Shading drop-down. This opens the configuration dialog.
-
Click theblue plus icon to add a new shading set.
-
Rename the shading to "Materials".
-
Drop down the Shading Field and select “Parcel”.
-
Click theCreate Entries button to populate all parcel names.
-
Assign a colour to each parcel.
-
Click OK to accept.
-
In the Block Model panel on the right, toggle the eye icon to show blocks. From the Shading drop-down 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).
-
Select bench(es) from the tree on the left to display them in 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
-
Select the gear icon next to the Shading drop-down. This opens the configuration dialog.
-
Click theblue plus icon to add a new shading set.
-
Rename the shading to "Ranges".
-
Select the Complex tab to open the code editor.
-
Paste in one of the sample code snippets located below.
-
Click theTest 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.
-
Fix any errors detected, run test again and press OK to accept.
Semicolon sign is missing in Line 19
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 = 60;
double element2_Min = 2;
double element2_Max = 5;
public Color GetColor(BlockContext context)
{
double element1 = context.N("DryTonnes.FE");
double element2 = context.N("DryTonnes.AL");
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)) );
}
}