Getting Parameter Data

For “info347074” who asked at AUGI about getting the values of shared parameters that are shown in labels on a sheet, here is a little macro showing how it can be done. Getting the parameter values from the sheets is no different than getting the values from any other Revit element.

CADFile Parameter


public void GetSheetParams()
{
    Document doc = this.ActiveUIDocument.Document;
    string sheetInfo = "";
    foreach (Element e in new FilteredElementCollector(doc).OfClass(typeof(ViewSheet)))
    {
        // get the parameter
        Parameter parameter = e.get_Parameter("CADFile");

        // get the string value of the parameter
        string cadFileData = parameter.AsString();

        sheetInfo += cadFileData + "\n";
    }
    TaskDialog.Show("CADFile", sheetInfo);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s