WISH - V5 - "Update Selected Blocks"

Hi Peter- can you please try

_-BlockManager _Update “BlockName” _Enter (dash version of BlockManager)

with the same file and block mentioned above and see how long that takes? The script is super simple, just scripting the dash version of the command.

thanks,
-Pascal

Amazing, that just took a couple of seconds with one of the more complex blocks.

Do you have any idea why this would work so much faster then the script?

Peter, can you please run the attached version in the too-long situation and send me or post the contents of the output window? Thanks - also please Pre-select the block instance to update so that selection does not come into the timing.

Edit: Uploaded a newer one:
UpdateSelectedBlocks_Debug (2).zip (736 Bytes)

-Pascal

The too-long situation only happened in the original script, now it seems to be doing well with this script.

I did update my rhino this morning it was not an update that was presented by rhino itself, but I had to click “check for updates” manually to find that there was an update. I don’t know if this fixed anything but here are the results of the debug script.

37657.01
Stage 1 Time in Seconds = 0.2109375 37657.22
Stage 2 Time in Seconds = 0.2109375 37657.22
Stage 3 Time in Seconds = 0.2109375 37657.22
Stage 4 Time in Seconds = 0.2109375 37657.22
37660.19

Hi Peter- so, just to be sure— the debug script and the previous one that I updated are the same except for a timer in the debug so I could see where the lag was. So - both should be equally quick or slow. If it’s all working better now, just delete the debug version.

-Pascal

Cool thanks @pascal I’m guessing it must have been the manual rhino update! Glad that it works now, this saves me (us) so much time!

Hi Pascal, I’m very interested on the tool too. Is the debug version the final version?

Ciao,
Micha

Hi Micha- the ‘correct’ one is attached way up the thread, I’ll attach it again here- as far as I can tell it does work now- it is a very simple and dumb script…

UpdateSelectedBlocks (2).zip (618 Bytes)

-Pascal

I try to collect my favourite tools to a toolbar so that I can easy back up it and transfer it to a fresh installation. Did I something wrong here? It doesn’t work.

_-RunScript (
Option Explicit
’Script written by Pascal
’ RMA
’Script version Wednesday, March 14, 2012

Rhino.AddStartUpScript Rhino.LastLoadedScriptFile
Rhino.AddAlias “UpdateSelectedBlocks”, “_NoEcho _-Runscript (UpdateSelectedBlocks)”

'Call UpdateSelectedBlocks()
Sub UpdateSelectedBlocks()

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
Next
Dim aFinal: aFinal = Rhino.CullDuplicateStrings(aUpdate)

Dim str
str = ""

Rhino.EnableRedraw False
Dim X
For Each sBlock In aFinal
	X = Rhino.BlockInstanceName(sBlock)
	str = str & " _Update " & chr(34) & sBlock & chr(34)	
Next

str = "_-BlockManager" & str & " _Enter _Enter"

Rhino.Command str, False

Rhino.EnableRedraw True

End Sub
)

1 Like

Hi Micha- just put UpdateSelectedBlocks , as a command, on your toolbar. Does that do it? (You do need to have the script drag and dropped to load at startup for this to work. If you want to put the entire script on the button, then

remove or comment these lines:
Rhino.AddStartUpScript Rhino.LastLoadedScriptFile
Rhino.AddAlias “UpdateSelectedBlocks”, “NoEcho -Runscript (UpdateSelectedBlocks)”

and

un-comment this one
’Call UpdateSelectedBlocks()

(i.e. remove the ')

and then put the entire thing inside parentheses like so, with _-Runscript:

! _-Runscript (Script in here)

-Pascal

1 Like

smile:

Thank you,
Micha