Recursive, "component-based" modelling in Houdini

I’m working on a system in Houdini that I call “component” modelling, but I am unsure how best to structure it in terms of HDAs, hip files, etc.

The concept is best explained by example - a generator for printed circuit boards. An artist supplies some simple polygon geo representing the shape of the board, and the generator takes over. Random rectangular “footprints” are scattered or placed across the surface.

Components, in this case little resistors, microprocessors, capacitors, are built from the footprints, each component being a small procedural model, with its own parametres for variation. Crucially, each component is built from the same area input, and each may define a common set of information in its output model. In software terms, these should inherit from the same base component class. Here, consider that each defines a point group “contacts”, denoting the points where each electrical contact touches the board.

These should be scattered at random or by a distribution method, but each time the individual components’ parametres should be random as well - different sizes of microchips, different heights of capacitors etc. From here, the main board generator again takes over, tracing paths between the contact points. This is a simple, single layer of generation above the components, but I am interested in the recursive case.

Suppose that some microchips should have heatsinks attached - for this, each chip may also define its “top surface” as a further interface. This may then pass into a further heatsink component, working from a footprint, which may itself have a stencil component applied to the side of it, and so on.

I have most parts of this system already working together, but everything right now is manual. While realistically this is probably how I will use it, placing and defining the components by hand, I have no idea how I would go about the recursive generation, generating extra parts of the Houdini scene itself. Python? TOPs? Which is the most useful method to make a library of these common components?

Thank you for any perspective you may have on this.