RU 🇷🇺
Creating a simple custom shading
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).
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
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)) ); } }