Export and redraw?

I have this sample for export multiple .3dm files, and take a preview image from single
obj, this code is a example for explain is not correct :

doc.Views.RedrawEnabled = false;
objs = AllObjects()
foreach (var i in objs)
    CreatePreviewImage( pathname , "TOP", size, 4, false);
    string cmd =  "_Export path " + i.ToStrig() + " _Enter";
    RhinoApp.RunScript( cmd, true);


doc.Views.RedrawEnabled = true;

This basically creates an image of each object and exports it in separate files

The problem is on “RedrawEnabled”, on frist time that execute the “Export command” the “RedrawEnabled”
go to true.

The problem is only on export command, if the export command is exclude from code, this work perfect.

Any clue?

Thank you

perhaps wrap your last line inside the foreach loop?

Thank you,

If the last line go inside a forloop the redraw go true every file that export, so, I want redraw only on the end of all export.