Remove Specific Family Type from List


I’m writing a script to find detail items in a project and associate shared parameters of those families to global parameters. This is my first script from scratch and I’m having a time of it. I’ve achieved creating a list of Detail Items, a list of all nested components in those detail items, and removing them from the list of detail items. So I’m left now with a list of ‘parent family’ detail items which is great! However, I’m trying to remove certain values from the list, such as “Break Line” and I’m having trouble. Any help with this step, or help with the overall script would be greatly appreciated!

You can more or less build the same method which you used to remove the nested components. Build a List of the types you want to keep (you can use a drop down, or build a list of element IDs and use those to select, or family type names and use those to select), and then take the set difference again.

1 Like

Got that to work, realized I had the lists reversed on the second difference node. Thanks! How would I create a filter for a list to remove say, any element whos name begins with 0, 1, or 2? Also, the parameters I want to associate are all shared parameters. Would it be possible/more efficient and full proof to get a list of all detail items that contain one of those shared parameters?

Get the elements names. StartsWith [“0”,“1”,“2”], set lacing to cross product. This will check each element name against the list of things it might start with. You can then do List.Contains true @L2 to see if any of these sublists check as having a true value. Then put that subsequent list of booleans into your BoolMask.

1 Like

Thankyou, I will give that a shot. Is there a way to get all detail items that contain a certain shared parameter? I feel like that would be more efficient and give me better control.

Get all detail items (or types depending on the parameter), get parameters. Check if those lists of parameters contain the parameter you’re looking for, then filter the original list of elements.

Thankyou for your help. I’ve made it this far. Not sure what I’m missing.

What does ParameterByName report when the element doesn’t have that parameter? Null? Empty List? If so you could use IsNull or IsEmpty to create your booleans to send into the filter node.

It just gives me a list of yes and no responses

You done want Parameter.ParameterByName. The result of that node is the parameter element, not the value.

Use Element.GetParameterValueByName instead, the result of which will be the parameter value (true/false in this case if I am seeing things right).

Do all of those elements have that parameter then?

E.g. only this family has this parameter. Everything else reports null.

If you want items that have a yes value within that parameter rather than all items that have that parameter then you want the node Jacob mentions.

1 Like

Just figured out that those were the values of the parameter for that given item. Sure enough someone had added that parameter as a project parameter, so EVERY item contained that parameter! After removing the parameter in question and adding some adjustments, I was able to filter down to Detail Items that had the parameter AND check if they currently have an association. This works great. Thank you both for your help.

Thankyou for your response, but what I’m trying to do at that point is simply find out if the parameter exists for that element, regardless of what the value is. This way, I can narrow down my list of elements to only those that should be effected (i.e., those that contain the parameter in question)