Nested Nested Components for Assembly

2021-06-25T06:00:00Z

Hello All.

I’m writing a script that allows me to select a Generic Model Family that has multiple nested families, each of which may have nested families within them - and turn the parent family into an assembly. It works sort of, except that it is only pulling the “first-level” of nested sub-components within the parent family, not any of the elements that are nested within those sub-components. - How can I dig down deeper into the subcomponents to get ALL of the families/geometry that should be part of the assembly?

I am using Clockwork Nodes “Element.SubComponents” and “Assembly.FromElements”

Looking forward to your insights,

Chuck Ross

I can see two options in here:

  1. If it is only two levels of nesting, you need to plug another Element.SubComponents to the first Element.SubComponents node, which will give you the second level of nesting
  2. If it has more nesting levels, you’re better off creating a loop in python to retrieve these

Thank you for the reply. - I will indeed be dealing with multiple levels of nesting - (an unknown number of levels) - So it seems that some type of recursive loop perhaps in python as you suggest is what I would need.

Does anyone know How I could code something like this?

Thanks for the interest!