How to get or calculate time of reading a file?

Hi all,

How to get or calculate time of read a file in Rhino7?
The file is not only 3dm but also stl、step or x_t…
I need time information to check something.
How can I do?

Best regards,
Vaker

import time
import Rhino

start_time = time.time()
Rhino.RhinoApp.RunScript("_Open \"Y:\\our\\File\\Path\\Here.stp\"", True)
end_time = time.time()

Rhino.RhinoApp.WriteLine("Time to open file:", end_time - start_time)

Hi Nathan,

Thanks for your reply.
My situation is I need monitor all file’s reading time in my plugins environment.
Is there function for getting reading time?
Or can I rewrite some functions of SDK to get that?

Best regards,
Vaker

You can register event handlers with RhinoDoc.BeginOpenDocument Event and RhinoDoc.EndOpenDocument Event assuming you’re using .NET to create your plug-in. If you’re doing C++ I’m sure you can find related functions (I just don’t know them as I use RhinoCommon only).

You’ll have to do the book keeping on times yourself, though.

Hi Nathan,

I find the functions:
CRhinoEventWatcher::OnBeginOpenDocument()
CRhinoEventWatcher::OnEndOpenDocument()
It works.
Thanks for your help.

Best regards,
Vaker

1 Like