FileWriteOptions Suppress Dialog

Hi all,

I have the following code:

                    new FileWriteOptions()
                        WriteSelectedObjectsOnly = true,
                        SuppressAllInput = true,
                        SuppressDialogBoxes = true

until recently this worked well and suppressed all dialogs, also those in the command bar.
However, after upgrading to the latest version of Rhino and RhinoCommon I get prompted in the command bar when exporting a file using this code. Is this expected or a bug? And how can I avoid being having to provide input in the command bar.

kind regards,


Hi @MichaelJoseph,

How are you running this code? From a plug-in command?

Can you provide me a code sample, that I can run here, that reproduces the behavior you describe?


– Dale

Hi Dale,

Sorry for getting back to you so late.
Im running this from within a Grasshopper component.
ill try and get a runnable example together.

Kind regards,



I am having the same problem witht the following code:

    protected override Result RunCommand(RhinoDoc doc, RunMode mode)
        var myObject = doc.Objects.First(obj => obj.Name.Contains("MyObjectName"));
        var path = @"E:\test\";
            path + "test.stl",
            new FileWriteOptions
                WriteSelectedObjectsOnly = true,
                SuppressDialogBoxes = true,
                SuppressAllInput = true

The WriteFile call causes the Rhino to ask for export options in the command line - which considering the SuppressAllInput option I think it should not do.

What is the correct way to save to a file completetely without user interaction? I am trying to batch-export a bunch of files (potentailly hundreds), and it is just not feasible to have the user interact with every one of them.

Hi @Alexander_Meyer,

For .stl files, you best bet is to script the Export command. I’ve attached a command sample for you to review.

TestAlexander.cs (1.8 KB)

Rhino 8 contains a new FileStl class that will save meshes to .stl files without having to script the Export command. The class is similar to the FileObj, FilePly, etc., classes found in Rhino 7.

RhinoDoc.WriteFile is a general purpose function. And since some file formats have special options, it doesn’t always work (without human intervention).

– Dale

Thank you @dale, works great!

For anyone else stumbling on this and wanting to add options for the STL export:
With help of this post I added this to Dale’s example:

            var sb = new StringBuilder();
            sb.Append("_ExportFileAs=_Binary ");
            sb.Append("_ExportUnfinishedObjects=_Yes ");
            sb.Append("_UseSimpleDialog=_No "); 
            sb.Append("_UseSimpleParameters=_No ");
            sb.Append("_Enter _DetailedOptions ");
            sb.Append("_JaggedSeams=_No ");
            sb.Append("_PackTextures=_No ");
            sb.Append("_Refine=_Yes ");
            sb.Append("_SimplePlane=_No ");
            sb.Append("_Weld=_No ");
            sb.Append("_AdvancedOptions ");
            sb.Append("_Angle=15 ");
            sb.Append("_AspectRatio=0 ");
            sb.Append("_Distance=0.01 ");
            sb.Append("_Grid=16 ");
            sb.Append("_MaxEdgeLength=0 ");
            sb.Append("_MinEdgeLength=0.0001 ");

            var script = $"_-Export \"{fileName}\" {sb} _Enter _Enter";
            RhinoApp.RunScript(doc.RuntimeSerialNumber, script, false);

Works like a charm (at least for me)!