I have a large rhino file that contains many referenced blocks. I’d like to show feedback on the loading progress, using a script that I add to “File>Properties…>General>Run these commands when rhino starts”
For the script I’d need to know the total number of references in a model before rhino starts loading external references.
Is there a function that returns the count of referenced files to load? I have attached an example file and pseudo code below
import Rhino import scriptcontext as sc def OnBeginOpenDocument(sender, e): count = sc.sticky.get('count') total_count = sc.sticky.get('total_count') if e.Reference: print 'loading (%s/%s): %s' % (count, total_count, e.FileName) sc.sticky['count'] += 1 def main(): # get total count of references to load, before loading starts # line below needs to be replaced with a function that returns the count of (block)references to load total_count = len(sc.doc.Objects) sc.sticky['total_count'] = total_count sc.sticky['count'] = 0 Rhino.RhinoDoc.BeginOpenDocument += OnBeginOpenDocument if __name__ == '__main__': main()
file_and_references.zip (428.8 KB)