Aha. Well, as said, the API does not provide any functionality beyond the UI, and all UI best practices still apply, maybe even more so than when driven manually. So, you need to find out how to achieve what you want manually first, then look at the resulting database elements, properties and relationships, and then explore how to create tham automatically.
Here is a video explaining one way to create a wall of any shape with arbitrarily shaped openings:
Note that this is just the first one that I happened to find, so no guarantee for quality, and also that it will be more efficient for you to search for yourself rather than wait for me to do it for you.