possible? (without going into block manager which is slow because of a lot of blocks)
Hi Ryan - if you are willing to refresh all blocks, use
! _-BlockManager _Update _All _Enter
No way. I guess we need a _Selected option
Try this Python:
import rhinoscriptsyntax as rs def UpdateSelected(): insts = rs.GetObjects("Select block instnces to refresh.", 4096, preselect=True) if insts: names = [rs.BlockInstanceName(inst)for inst in insts] pass for name in list(set(names)): if not rs.IsBlockEmbedded(name): rs.Command("-BlockManager Update " + chr(34) +name+ chr(34) + " Enter") UpdateSelected()
It’s complaining about indentation. I messed with them a bit to try and make it look like yours but no joy.
I obviously have no idea what I am doing here
UpdateSelected.py (471 Bytes)
Try the attached - it looks like the formatting got hosed.
Winner. Thanks Pascal.
Thanks so much for this script, Pascal. I just managed to alter it to change the linked file for a block - saves me 5 clicks and going an extra 2 dialogs deep into the BlockManager and back out. I update linked blocks (to another file in same folder) many times a day - really wish I knew this was something scriptable a long time ago!
I guess with this script I personally don’t need it nearly as much, but how is V6 progress looking on a new and improved non-modal BlockManager?
Thank you again, Pascal, and to @wynott for bringing this up!
you non-python version was great too, I used it the last years.
’Script written by Pascal
’Script version Wednesday, March 14, 2012
Dim aObj: aObj = Rhino.GetObjects(“Select blocks to update.”, 4096, True)
If Not isArray(aObj) Then Exit Sub
Dim sBlock, aUpdate(), n
n = 0
For Each sBlock In aObj
ReDim Preserve aUpdate(n)
aUpdate(n) = Rhino.BlockInstanceName(sBlock)
n = n + 1
Dim aFinal: aFinal = Rhino.CullDuplicateStrings(aUpdate)
str = “”
For Each sBlock In aFinal
X = Rhino.BlockInstanceName(sBlock)
str = str & " _Update " & chr(34) & sBlock & chr(34)
str = “_-BlockManager” & str & " _Enter _Enter"
Rhino.Command str, False