我在编写一个应用程序以使用AutoCAD批量加载和导出文件时遇到了问题。每当我指向一个装满.dxf文件的文件夹时,我就会收到下面列出的许多错误。我已经把这个问题缩小到了我知道它只是在负荷下断裂的程度。有时它加载得很好,另一些则只加载3-4个文件,其余的时间只会抛出一个错误。我看到的错误包括但不限于FaultExecutionEngineError、NullExceptionError、IndexOutOfRange错误,以及奇妙的致命异常错误,这也会导致Autocad崩溃。
这是我的代码:
public class MyCommands
{
string folderPath = @"C:\Users\kdhyne\Desktop\New folder\";
// Modal Command with localized name
[CommandMethod("FileCycle", CommandFlags.Session)]
public void MyCommand() // This method can have any name
{
var acDocManager = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
string[] filesInDirectory;
Document acDoc = null;
filesInDirectory = Directory.GetFiles(folderPath, "*.dxf", SearchOption.TopDirectoryOnly);
foreach (string someFile in filesInDirectory)
{
acDoc = acDocManager.Open(someFile);
}
}
}据我所知,我已经把这件事删掉了。希望有人能帮忙。感谢您的阅读。
发布于 2014-06-09 20:29:03
在AutoCAD中打开它之前做一个发行版构建,它看起来很好!显然,它并没有将所有库编译到调试构建中。
https://stackoverflow.com/questions/24128486
复制相似问题