Revit API gets the instance code for the internal reference name of the variable

  • 2020-05-24 06:01:49
  • OfStack

There is an BuiltInParameter with getting the internal reference name category of the element variable


// Gets the name of the internal reference 
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public class cmdGetBuiltInParam : IExternalCommand
{
    public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
    {
        UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
        Document doc = uiDoc.Document;
        Selection sel = uiDoc.Selection;
        Duct duct = doc.GetElement(sel.PickObject(ObjectType.Element, " choose ")) as Duct;
        foreach (Parameter p in duct.Parameters)
        {
            if (p.Definition.Name == " highly ")
            {
                BuiltInParameter biParam = (BuiltInParameter)p.Id.IntegerValue;
                TaskDialog.Show("builtIn", biParam.ToString());
            }
        }
        return Result.Succeeded;
    }
}


Related articles: