Hi,
I am looking for fire rating Value for Walls. i.e. 1Hr, 2 Hr etc.
I am able to see these values in "Wall-> Propertices-> Type Propertices" -> Identity data-> Fire Rating
But i want to get that value using .net c# code.
Please tell me the method or any way so i get that value.
Please help!
Regards,
Nitin.
Nitin,
You should install an addin called BipChecker, which can be found here
Use this add-in to determine whether the parameter you are trying to access is a Built In Parameter, or a Shared Parameter. You can also determine whether the parameter is stored as a string, integer, double or ElementId.
You can also use RevitLookup, which is an add-in included with the Revit SDK.
Element wallElement; (I'm assuming you already have the element available in your code) FamilyInstance wallFamilyInstance = wallElement as FamilyInstance; if (wallFamilyInstance != null) { //Note that we are accessing wallFamilyInstance.Symbol to access the parameter - this is because it's a type parameter //If the parameter is a built in parameter, use the following line Parameter fireRatingParam = wallFamilyInstance.Symbol.get_Parameter(BuiltInParameter.OST_YOURPARAM); //If the parameter is a shared parameter, use the following line Parameter fireRatingParam = wallFamilyInstance.Symbol.get_Parameter("Shared Parameter Name"); //Assuming this parameter is an integer. If it's not, use the appropriate type function int value = fireRatingParam.AsInteger(); }
Hi Nitin,
The fire rating parameter of wall type is a built-in parameter.
So you can get the parameter value in the way of getting built-in parameter member.
Here is the code snippet to show the process.
<code>
[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]
public class RevitCommand1 : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string messages, ElementSet elements)
{
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Selection sel = app.ActiveUIDocument.Selection;
Reference ref1 = sel.PickObject(ObjectType.Element, "Please pick a wall to get its fire rating");
Wall wall = doc.GetElement(ref1) as Wall;
if (wall == null)
return Result.Failed;
Parameter param = wall.WallType.get_Parameter(BuiltInParameter.DOOR_FIRE_RATING);
//show the fire rating in task dialog
TaskDialog.Show("Wall type fire rating", param.AsString());
return Result.Succeeded;
}
}
<code>