You could also take a look at rectangle packing. It’s an involved topic.
There was another plug-in called Pack Rat, but I remember a user recently reporting that it doesn’t work any more. It hasn’t been updated for years and thus has lost compatibility with newer Rhino versions.
Here’s an interesting attempt by @laurent_delrieu to nest different geometries: