Maybe the recommended way of making a file name will help?
using System.IO; // now you don't have to write the full namespace
string tempfile = Path.Combine(Path.GetTempPath(), "temp.3dm");
Then, it may be that there is already a temp.3dm in the temporary directory and the doc.WriteFile does not want to override it in fear of losing valuable data.
@menno Thank you for the suggestion.
But still returns false. I have ensured that there are no temp files and even tried writing to a different location.
The WriteFile method is a virtual function available on plug-ins that inherit from Rhino.PlugIns.FileExportPlugIn
During saving or exporting, if the user picks your file type, Rhino will call your FileExportPlugIn.WriteFile override, along with the appropriate parameters.
Why are you trying to write a 3dm file from within your file export plug-in?
The actual translator is an external program with many other dependencies and hence did not want to create a monolithic plugin program.
BTW the external program depends on OpenNurbs … still waiting for a v6. This plugin would simply write the contents of the current document into a temporary 3DM archive file, call the external program which would then do the translation and handle back the exit codes to the plugin.
If Rhino is in the middle of a file write operation, which it is when it calls a FileExportPlugIn.WriteFile override, then calling RhinoDoc.WriteFile will fail.
Thank you … I understand, Is there any other method to write the contents of the current RhinoDoc to a temporary file.
I can always figure out the current file path and use that instead… but the problem is what happens if the user wants to “export selected” instead of SaveAs…