I have several walls (5) in Revit which have a ‘room no’ (R01.05) and a ‘wall no’ (N1) parameter which I’ve joined with a ‘-’ separator into a ‘wall name’ (R01.05-N1) parameter.
I have then created a generic model penetration family which I’m hosting in walls and looking to take the ‘wall name’ (R01.05-N1) and push this into the penetration family under the parameter ‘penetration name’. In this parameter I will append a ‘penetration no’ (P001) to the end of the ‘wall name’ (R01.05-N1-P001).
I had the script working until the number of penetrations exceeded the number of walls. Does anyone know how to resolve this issue?
Yasemin’s solution will work for you if you can clean through the noise(empty strings, nulls, empty lists).
While computationally inefficient(Maybe don’t do this if this critical for production) the fastest solution is to put a GetHost node after the element is collected in the GetHostedElements Node and feed that into the GetParameterValueByName Node instead of All Elements of Category.
I should also add that, as this is currently wired, this has the potential to bring in every hosted element(ie. Windows) which does not seem desirable. Perhaps try FamilyType.ByName → All Elements of Family Type to collect the penetrations.
This will be much faster and make your list management much simpler. If you get the penetration instances then you can get their host walls. That will be all the info you need to get the wall’s “room no” and “wall no” per penetration. All you have to do for the penetration number is then GroupByKey and sequence.