Namespace:
Autodesk.Revit.DB.Analysis
AnalysisDisplayStyle
Class
Description:
Exposes API for manipulation of analysis display style.
Exposes API for manipulation of analysis display style.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Analysis.AnalysisDisplayStyle
System.Object
Autodesk.Revit.DB.Element
Autodesk.Revit.DB.Analysis.AnalysisDisplayStyle
Examples
Document doc = commandData.Application.ActiveUIDocument.Document;
AnalysisDisplayStyle analysisDisplayStyle = null;
// Look for an existing analysis display style with a specific name
FilteredElementCollector collector1 = new FilteredElementCollector(doc);
ICollection<Element> collection = collector1.OfClass(typeof(AnalysisDisplayStyle)).ToElements();
var displayStyle = from element in collection
where element.Name == "Display Style 1"
select element;
// If display style does not already exist in the document, create it
if (displayStyle.Count() == 0)
{
AnalysisDisplayColoredSurfaceSettings coloredSurfaceSettings =
new AnalysisDisplayColoredSurfaceSettings();
coloredSurfaceSettings.ShowGridLines = true;
AnalysisDisplayColorSettings colorSettings = new AnalysisDisplayColorSettings();
Color orange = new Color(255, 205, 0);
Color purple = new Color(200, 0, 200);
colorSettings.MaxColor = orange;
colorSettings.MinColor = purple;
AnalysisDisplayLegendSettings legendSettings = new AnalysisDisplayLegendSettings();
legendSettings.NumberOfSteps = 10;
legendSettings.Rounding = 0.05;
legendSettings.ShowDataDescription = false;
legendSettings.ShowLegend = true;
analysisDisplayStyle = AnalysisDisplayStyle.CreateAnalysisDisplayStyle(doc,
"Display Style 1", coloredSurfaceSettings, colorSettings, legendSettings);
}
else
{
analysisDisplayStyle = displayStyle.Cast<AnalysisDisplayStyle>().ElementAt<AnalysisDisplayStyle>(0);
}
// now assign the display style to the view
doc.ActiveView.AnalysisDisplayStyleId = analysisDisplayStyle.Id;