So I trying to create a little script,BatchProcessFiles(), that allows me to run other scripts on multiple files. This is what I have and it seems to work pretty good from small scripts, like the the BlockNameTest(). It seems to inadvertently just stop though, if I use a larger script, for instance one that makes2D for all the viewports of a file and turns then into blocks. Any help to stream line it would be helpful.
import rhinoscriptsyntax as rs import Rhino def BlockNameTest(): BlockList = rs.BlockNames() for Name in BlockList: if rs.IsBlockEmbedded(Name) is True: Path = rs.BlockPath(Name) Index = Path.rfind("\\") Index2 = Path.find('.') FileName = Path[Index+1:Index2] if Name != FileName: Renamed = rs.RenameBlock(Name,FileName) print (Renamed) def BatchProcessFiles(): fileNames= rs.OpenFileNames("Pick Files To Process","RhinoFile(*.3dm)|*.3dm||") for a in fileNames: Rhino.RhinoDoc.OpenFile(a) #Custom script Here BlockNameTest() rs.Command("-save _enter") BatchProcessFiles()