Link Search Menu Expand Document

image Override Colours

/Buttons Tools/OverrideColors.cs

Override the element colours in a view based on their type Id. Colors are automatically generated by the type name:

var md5 = MD5.Create();
var grouped = allElementsInView.GroupBy(x => x.GetTypeId());

foreach (var element in grouped) {
    var value = element.First() ;
    var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(value.Name));
    
    byte iR, iG, iB;
    iR = Convert.ToByte(pRand.Next(0, 255));
    iG = Convert.ToByte(pRand.Next(0, 255));
    iB = Convert.ToByte(pRand.Next(0, 255));
    
    Autodesk.Revit.DB.Color pcolor = new Autodesk.Revit.DB.Color(hash[0], hash[1], hash[2]);
}

image Override Dimension

Buttons Tools/OverrideDimensions.cs

Override the dimension value with an invisible character:

dimension.ValueOverride = "\u200E";