Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been struggling with this weird problem for a few hours now 😞
I have some elements that has a parameter called PANEL ID. sometimes this parameter is in readonly mode.
When I'm accessing the element directly, like in this example, I can get the parameter value perfectly fine:
Element element = doc.GetElement(new ElementId(3697816));
Definition parameterDefinition = element1.LookupParameter("PANEL ID")?.Definition;
Parameter par = element1.get_Parameter(parameterDefinition);
string parValue = par.AsString();
Here above, the ID number is the number of such element that has a Panel ID value which is readonly. This code works fine.
Here, when accessing the same kinds of elements as part of any collection, parValue is empty (""):
foreach (Element element1 in elementsList)
{
Definition parameterDefinition = element1.LookupParameter("PANEL ID")?.Definition;
if(parameterDefinition == null)
continue;
Parameter par = element1.get_Parameter(parameterDefinition);
string parValue = par.AsString();
}
In here above, parValue is empty for elements that their PANEL ID parameter is readonly. It works fine when the PANEL ID parameter is not readonly.
Thanks in advance!!
Solved! Go to Solution.