Hi, I'm trying to provide my user a list of WallTypes they can choose from. I'm getting a list of the valid ElementIds (TypeId) by using the GetValidTypes() method on the Wall object, but I haven't been able to figure out how to get back to the Name property of the Walltype from the TypeId. Can anyone provide some guidance as to how that might be done?
Thanks!
Scott S
Research Programmer
Center for Research Computing
University of Notre Dame.
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
Dear Scott,
I would suggest a different approach:
Use a filtered element collector to retrieve all wall type elements from the database.
You can cast them to WallType and read their names from the Name property.
Here is the untested code for that:
FilteredElementCollector a = new FilteredElementCollector( doc ) .OfClass( typeof( WallType ) ); foreach( WallType wallType in a ) { Debug.Print( wallType.Name ); }
Actually, this does not even require an explicit cast.
This also has the advantage that it does not require some arbitrary wall element as a starting point for calling GetValidTypes on.
I am not sure whether it is better than what you are trying right now, though.
There is no reason why you could not do it that way as well.
Best regards,
Jeremy
Jeremy,
Not only is that code more elegant, it's much faster than the way I had attempted to do it. Thank you so much for your suggestion.
Best regards,
Scott
Can't find what you're looking for? Ask the community or share your knowledge.