Announcement

Collapse
No announcement yet.

How to check an output is an element

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to check an output is an element

    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.
    Attached Files

    #2
    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.Filter
    Greg McDowell Jr
    about.me/GMcDowellJr

    Comment


      #3
      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.

      Attached Files
      Chris Ellersick

      Comment


        #4
        Thanks cellersick and GMcDowellJr, the Object.Type word give me idea how to solve this.
        Attached Files

        Comment

        Related Topics

        Collapse

        Working...
        X