Mac Rhino6: ViewCaptureToFile does not work

Hey,

I am writing a script that outputs the current view to file. If I delete the first line of the code at below, the viewcaptureToFile works. Otherwise, the ViewCaptureToFile does not output anything, though the rhino terminal said it successfully output image.

Guid mesh_guid = doc.Objects.AddMesh(mesh); //if I delete this, the program works.
Rhino.RhinoApp.RunScript(String.Format("_-ViewCaptureToFile hello.jpg _Enter"), false);

Do you know how to deal with the problem?

Best
ZIQI WANG

Moved to Scripting category