Filtering Elements by Phase

Question is best asked in video. https://youtu.be/sHUTGRsyCxQ

Sorry can’t upload attachments (whomp) #newuserprobs

Welcome to the community!

The first thing is for your string input of “Phase Created”, it has a return at the end. Drop that to get the phase value. Parameters are case-sensitive and the name needs to be the same.

Once you do that, you can get the phase name from the GetParameterValueByName Output and from your select phase node. Then you can compare the names.

I kind of mocked it up here, if it is still unclear you should be able to upload files now.

2 Likes

Hi, here is a simple solution for your task


Just insert this code:

import clr
clr.AddReference('ProtoGeometry')
 from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
 from Autodesk.Revit.DB import BuiltInParameter
 elements = [  ]
 for i in IN[0]:
 	phase = UnwrapElement(i).get_Parameter(BuiltInParameter.PHASE_CREATED).AsValueString()
 	if phase == IN[1].Name:
 		elements.append(i)
OUT = elements
1 Like

The first string was wrong so good call.

However still getting results [false, false] where it should be [true, false]; as you can see in the photo the highlighted wall for Phase Created is 01 - Existing which is the parameter in the “select phase” node.

Still need to add the element.name to the graph like I indicated in my screenshot. That way you are comparing 2 string (text) values.

got it because I wasn’t not comparing two of the same data types.

Hi All, there is a video about filtering elements by phase.

Dynamo - Filter Elements by Phase

Hope this is helpful!