As the title says I’m trying to find the Family name of elements using Python.
As an input I have a list of quite a lot of elements, both pipes and pipe fittings. I only really need to know the name of the pipe fittings (for the pipes, I just need to know that they’re pipes).
Currently, when I run them through a simple Name node (or bit in a code block, really) I’m getting the names of the family types, I can find the Type, Family and then the Family name of the pipe fittings, but the problem is that pipes will be going through the same process and that will cause errors.
I have considered splitting them up, giving them their seperate process while keeping track of their indices, and then putting them back together, but I thought there should be a more elegant solution.
I can use Python rather well for the sake of list logic and calculation, but trying to use it to read data straight from Revit is still something I don’t understand (if anyone knows a good guide on information about that interation I’d be very grateful), so I’m asking here. The only thing I really need is getting the name of one element, and I can create the rest of the code myself.
Also, if this really is all you need it is a very simple bit of code as the ‘Name’ of an element is a default property of any element.
Simple unwrap your pipes and call the property as below, ensuring you have the right imports. I’ll let you have a go at working out which you need P.S. you can find an overview of the boilerplate code in that nifty resource I linked above
pipes = UnwrapElement(IN[0])
pipe_name = [p.Name for p in pipe]
OUT = pipe_name