How to check whether a parameter value is an element where in C# we can use "if element is level". For example here parameter Top Constraint is either a Level or Unconnected. Example as attached. If it is a level, return the level name and if it is Unconnected, return empty string.The mission is how to get the same results without warning.
Announcement
Collapse
No announcement yet.
How to check an output is an element
Collapse
X
-
Use a List.FilterByBoolMask
Find something to compare the list with to get a series of True/False (True = Level, False = not Level), and use this as the Mask for the List.FilterGreg McDowell Jr
about.me/GMcDowellJr
-
In Dynamo, I've found things work better if you can organize lists to perform the same operation on the entire list. ex - use the List.FilterByBoolMask and perform separate operations on each of the output lists ("in" and "out"). If you need more control over iteration, you might want to look at Code Blocks (using DesignScript) or the Python Script node.
It also looks like the Top Constraint parameter may not be the most straightforward parameter - if you pass the output from GetParameterValueByName to Object.Type, you can see that you'll either get a System.String or a Revit.Elements.Level object.
If you require the original list in the original index order, it might look something like the image below.
Chris Ellersick
Comment
Related Topics
Collapse
-
The GoogleFu is weak with this one - and though sure this has been asked a million times before, I can't seem to find the solutions to my amateurish issue....
-
Channel: Dynamo BIM
October 22, 2017, 12:41 PM -
-
I want to sort list by Level Name (top nodes), but I want the level to be sorted by Elevation (example as bottom nodes). Can I...-
Channel: Dynamo BIM
April 21, 2017, 03:07 AM -
-
I want to figure out if my specific goal is even possible. (If I can even get it to make sense when asking)
1: Create x amount of levels....December 7, 2012, 12:21 PM -
Hi
I am trying to workout how to create a parameter which fills in itself. I want it to be an instance parameter which looks at objects and...March 1, 2018, 12:31 AM -
Hi,
I do a Filter to get all OST_RasterImages.
I got a list of Raster Elements.
But I can get the Level of each one.
...-
Channel: Third party Add-Ins, API and R&D
October 12, 2011, 03:13 PM -
Comment