So I am looking a Python help create a script to replace blocks that are nested with-in other blocks, and it looks like the rhinoscriptsyntax doesn’t have functions for inserting or deleting blocks nested in other blocks.
This is what I am looking to do.
I have blocks A, B & C.
They all have a block nested inside them called 1,2,3.
[A,[1,2,3],B,[1,2,3],C,[1,2,3]]
I would like to replace block 1 with block 8.
So that I end up with this.
[A,[8,2,3],B,[8,2,3],C,[8,2,3]]
What I was thinking is that I would need to transform for each block ‘1’, then deleted it and insert block ‘8’ with transform properties, but not sure how to do it and keep the main blocks.
If you just want to use rhinoscryptsyntax, the process of redefining a block goes like this:
1.) Insert an instance of the block whose definition you want to modify.
2.) Explode the block instance using rs.ExplodeBlockInstance.
3.) Delete the exploded pieces you don’t want.
4.) Add whatever new geometry you want.
5.) Rebuild the block definition using rs.AddBlock.