Hi,
In Revit MEP
We are trying to update Duct Element paramater, "System Type" from "Undefined" to "Supply Air" programatically.
The code is written as below
;;Duct Selection
UIApplication app = commandData.Application;
Document doc = app.ActiveUIDocument.Document;
Selection sel = app.ActiveUIDocument.Selection;
Reference ref1 = sel.PickObject(ObjectType.Element, "please pick a duct");
Duct objDuct = doc.GetElement(ref1) as Duct;
;; Filter
List<ElementId> DuctSystemTypelst = new FilteredElementCollector(doc).OfCategory
(BuiltInCategory.OST_DuctSystem).ToElementIds().ToList();
;;Getting the parameter value of System Type
Parameter systy = objDuct.get_Parameter(BuiltInParameter.RBS_DUCT_SYSTEM_TYPE_PARAM);
;;Setting the Parameter value of "System type" to "Supply Air", as "Supply Air" is at second position of DuctSystemTypelst
systy.Set(DuctSystemTypelst[1]); (RETURNING TRUE)
Afterwards when we check value of "System type" parameter of selected duct using
systy.asElementid();
Returning {-1} means Undefined
Please help to solve the issue
Thanks in advance for your kind support in this regards