Message 1 of 4
Element.LookupParameter Issue
Not applicable
10-08-2020
07:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having difficulties getting the Family Element of a FamilyInstance using the "Lookup" method.
TRY 1 - The "AsValueString methods returns the Family Name and not the family
string getFamily(FamilyInstance FI)
{
return FI.LookupParameter("Family").AsValueString()
}
TRY 2 - The "AsElementId" method of the "Family" Parameter returns the FamilySymbol Id and not the Family Id
string getFamily(FamilyInstance FI)
{
ElementId EI = FI.LookupParameter("Family").AsElementId()
return FI.Document.GetElement(EI).Name
}
TRY 3 - The "AsElementId" method of the "Family and Type" Parameter returns again the FamilySymbol Id and not the Family Id
string getFamily(FamilyInstance FI)
{
ElementId EI = FI.LookupParameter("Family and Type").AsElementId()
return FI.Document.GetElement(EI).Name
}
TRY 4 - The "AsValueString" method of the "Family Name" Parameter returns null. That is very confusing.
string getFamily(FamilyInstance FI)
{
ElementId EI = FI.LookupParameter("Family Name").AsElementId()
return FI.Document.GetElement(EI).Name
}
Does the above mean that parameters may store string but not elements correctly?