I have a RhinoCommon plugin which I have developed for Rhino 5, using WPF for UI inside a Rhino panel.
One of the functionalities of the plugin is to import geometry from an external CAD file (.3dm or .igs normally). This is triggered by a button-click in my UI.
During development, I have only been testing using Debug32 and had no issues with this feature. However now I’ve come to deploy the plugin, and I am finding that when run in 64-bit Rhino versions, the method RhinoDoc.ReadFile
which I use to import the file will sporadically return false, and no data will be imported. Additionally, the behavior seems to be different on different PCs. Here are some examples of how it fails (or doesn’t):
PC 1 (Win 10 64 bit - Debug64 Build - Rhino 5 64-bit)
- First call fails
- All subsequent calls succeed
PC 2 (Win 10 64 bit - Release Build - Rhino 5 64-bit)
- Works as advertised
PC 3 (Win 7 64 bit - Release Build - Rhino 5 64-bit)
- First call fails
- Second call succeeds
- All subsequent calls fail
All PCs Rhino 5 32-bit
- Works as advertised
Here’s my helper method I use for the import
public static (string filePath, List<Guid> objectIds) GetImportFromFile(string title = "Import File")
{
var filePath = RhinoGet.GetFileName(
GetFileNameMode.Import,
"",
title,
RhinoApp.MainApplicationWindow
);
if (filePath.Length == 0 || !File.Exists(filePath))
return (null, new List<Guid>());
Logger.Debug($"Importing file {filePath}");
var mostRecentObject = Doc.Active.Objects.MostRecentObject();
if (!RhinoDoc.ReadFile(filePath, new FileReadOptions { ImportMode = true }))
{
Logger.Debug("Import Failed");
return (null, new List<Guid>());
}
var importedObjects = Doc.Active.Objects.AllObjectsSince(mostRecentObject?.RuntimeSerialNumber ?? 0);
var importedObjectIds = importedObjects.Select(rhinoObject => rhinoObject.Id).ToList();
return (filePath, importedObjectIds);
}
Is there any way I can get more info on what is causing ReadFile
to fail?