Create Block with correct orientation (Rotate & Flip)

Hello,

I am trying to create a script that takes duplicate rooms and organizes them all into one block. The idea is to be able to edit any one room and have the changes populate across all 6 buildings. I created a script that does this, however, it breaks with rectangles and acts rather unpredictably. The idea was to take the parent block’s centroid via volume and analyze it against the other rooms geometry.

I also feel like the cluster in my script has many redundancies and is very susceptible to unique conditions.

Lastly, I am baking the block and purging the initial geometry, which may be a poor idea. However, to reduce human error down the line, I feel like it would be good to keep the layer names consistent in the file and reduce the number of variables in the workflow.


6 buildings have the same four unit types.


querying all units by layer.


I am using BlockEditNew plug for it’s AMAZING UI, however, has no impact to script or file. Just nice for workflow.


Demonstration pt 1


Demonstration pt 2


Script does not work with rectangles or square units.


Sometimes deletes units


There are many ways to tackle the orientation issue, but I chose to go with vectors; maybe that’s a bad strategy.

Create MAster Block.gh (25.6 KB)
Create Master Block_Test.3dm (14.0 MB)

I haven’t had a chance to look at in depth yet but you’ll want to use a Plane not Centroid, which doesn’t have rotation information.

note that you have pufferfish (3rd party plugins) in your definition when posting.