Hi all, I did a short script in python in Rhino 5 before. It works in Rhino 5, but for some reason it doesn’t work in Rhino 7. I am not sure what’s wrong… Hope you can help, thanks
The script is as below:
import rhinoscriptsyntax as rs
import scriptcontext
def explodeBlocks():
rs.Command("_SelBlockInstance")
Blocks = rs.GetObjects("Pick Blocks",4096,False,True,False)
if Blocks is None:return
for b in Blocks:
if scriptcontext.escape_test(False): #Break if press 'ESC'
break
rs.SelectObject(b)
rs.Command("_ExplodeBlock")
rs.Command("_SelLast")
item = rs.GetObjects("Pick items",0,False,True,True)
if len(item) == 1:continue #if the block has one item only,then don't group
rs.Command("_Group")
rs.Command("_SelNone")
if scriptcontext.escape_test(False): #Break if user press 'ESC'
break
rs.Command("_SelAll")
rs.ZoomSelected()
explodeBlocks()