I try to save the photo of view by below example. A file is saved by calling SaveFileDialog.
Now, I want to directly set a path to save it.
For example, bitmap.Save(C:/xxxx.bmp).
But it don’t work.
Anyone know how to solve it in PlugIn.
For saving files you would normally make a File Export Plug-In - this can be done in RhinoCommon and you don’t need Rhino_DotNET as in the picture of your problem.
Use the Visual Studio Extension Manager to install the “RhinoCommon Templates for v5” extension. This will install plug-in templates for all plug-in types. Then create a new project and select the file export plug-in to get you started.
If you want to save a file from a “normal” plug-in, you can present the user with a RhinoCommon
SaveFileDialog and use the filename obtained to save a file. You must write the file using, for example, a
Rhino.UI.SaveFileDialog dlg = new Rhino.UI.SaveFileDialog();
dlg.InitialDirectory = @"C:\temp"; // @ in front of a string will take string literally instead of interpreting '\t' as tab
dlg.Filter = "My File Type (*.asdf)|asdf";
dlg.DefaultExt = ".asdf";
dlg.Title = "Save ASDF file";
dlg.FileName = "default.asdf";
DialogResult result = dlg.ShowDialog();
if (result == DialogResult.OK)
using(TextWriter tw = new StreamWriter(dlg.FileName))
tw.WriteLine("Saving my ASDF file");