Scripting select same block for Rhino for Mac

Any help in writing a quick python command to select all the same block(s)? The block manager on Mac is cumbersome, as is using -selblockinstancenamed.

Blocktools for Mac would be the ideal solution of course :smiley:

Hello - not sure if this is what you need?

import rhinoscriptsyntax as rs

def SelSameBlocks():
    
    id = rs.GetObject('Select a block', 4096, preselect=True)
    if not id:return
    
    ids = rs.BlockInstances(rs.BlockInstanceName(id))
    if ids: rs.SelectObjects(ids)


SelSameBlocks()

-Pascal

1 Like

Perfect, thank you!

As I have you here - any news on make unique/SplitToNewBlock functionality?

Cheers

Ben

Any way of adapting the script so if you select multiple different blocks it selects all instances of them?

Thanks!

Hi - sorry if silly question - how do I load this “select same block” script into Rhino 8? Not familiar with macros, scripting, etc. but this seems to be exactly what I need. Thanks

No script needed in Rhino 8. Simply select a block and run the command: SelBlockInstanceNamed - all instances of this block will get selected.

Hi - thanks - this question was not in regard to SelBlockInstanceNamed for which you need to know the block name and often have to scroll through possibly hundreds of named blocks in the block manager to find that name. There was a tool/script that I used previously and have now somehow misplaced which would select all instances of a block with the same name as a block you manually selected by clicking on it in the viewport. No need to find the written name and scroll through lists. If anyone knows what became of that, it’s super valuable as a quick way to group select all instances of a block.

Thanks!

Hi @mwinkelstein,

In Rhino 8, just use the Block Manager.

– Dale

Hi Dale -
Thanks for you note. Unfortunately I find block manager almost unusable when I have hundreds of blocks. On a large architectural project, each time I just activate block manager, even with a fast machine, it takes minutes just to load (due to the huge number of blocks that are often the bi-product of importing a Revit or CAD model into Rhino). Then I have to scroll through all th0se blocks to find the name I’m looking for (painful and time-consuming). I used to have a script or tool that let me simply manually click-select a block in the viewport and then activate “select same block” and it selected all similar instances instantly. I lost the tool/script however. If this no longer exists, I would recommend it as something highly useful for architects with large complex models containing many many blocks.
Thanks,
Matthew

@mwinkelstein - make a button with this macro:

_-SelBlockInstanceNamed _SelectBlockToMatch

– dale

Cool! Will give it a try. Thanks so much!

Matthew

Hi Matthew -

I’ve just tested this on a somewhat involved scene…

… and this is pretty much instantly here.
Could you upload your model so that we can take a look at what’s going on? Make sure to add a link to this topic in the comments field on that page.
-wim