The Autodesk.Revit.DB.Visual.Wave namespace provides classes for working with visual waveform data in Revit.
The following classes are available in the Autodesk.Revit.DB.Visual.Wave namespace:
Represents a color and value for a position on a visual waveform.
Represents a mapping of value ranges to colors for a visual waveform.
Represents the data for a visual waveform, including values, color mapping, and display options.
Represents display options for a visual waveform, including axis labels, tick marks, and legend position.
To work with visual waveforms in Revit, you'll typically create a WaveformData object and set its properties as needed. You can then use the WaveformData object to create a visual display of the waveform, either by displaying it in a tool window or by adding it to a Revit view.
WaveformData waveform = new WaveformData();
WaveformColorMap colormap = new WaveformColorMap();
colormap.AddEntry(new WaveformColorEntry(0, Color.Red));
colormap.AddEntry(new WaveformColorEntry(50, Color.Yellow));
colormap.AddEntry(new WaveformColorEntry(100, Color.Green));
waveform.Values = new double[] { 10, 20, 30, 40, 50, 60, 70, 80, 90 };
waveform.ColorMap = colormap;
WaveformDisplayOptions displayOptions = new WaveformDisplayOptions();
displayOptions.AxisLabelInterval = 10;
displayOptions.AxisLabelPrefix = "$";
displayOptions.AxisLabelSuffix = " USD";
displayOptions.LegendPosition = LegendPosition.TopRight;
waveform.DisplayOptions = displayOptions;
Autodesk.Revit.UI.DashboardPanel panel = Autodesk.Revit.UI.DockablePanelManager
.GetDockablePanel(uiControlledApplication.ActiveUIDocument.Document, Guid.NewGuid())
.CreateUIPanel("Waveform Data", new DockablePanelProperties()
{
Position = Autodesk.Revit.UI.Dock.Top,
Width = 350
});
WaveformControl waveformControl = new WaveformControl();
waveformControl.WaveformData = waveform;
panel.Show(waveformControl);
Autodesk.Revit.DB.View view = uiControlledApplication.ActiveUIDocument.Document.ActiveView;
ElementId waveformId = WaveformUtils.AddWaveformToView(uiControlledApplication, view, waveform);