Message 1 of 4
Get Parameter Values from Room
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm moving from Python to C# and am trying to convert my plugin which obtains data from Room objects.
In Python I can obtain a rooms Number with the following method:
Create a FilteredElementCollector of all rooms and then convert to Eleemnts, then loop through the elements list with the variable f:
paramsnum = f.GetParameters('Number')
This returns the Number parameter value in the variable paramsnum.
This works fine, but I'm struggling to do this in c#:
//Get all rooms FilteredElementCollector allrooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms); //Convert room list to elements ICollection<Element> allroomelements = allrooms.ToElements(); // Create list of room numbers (from Number parameter) List<string> numslist = new List<string>(); foreach (Element f in allroomelements) { Debug.Print(f.Name); IList<Parameter> paramsnum = f.GetParameters("Number"); }
This executes, but paramsnum is not a string I can use, I cannot obtain the value from an IList.
Where am I going wrong?
Thanks.