Database sourceDb = new Database(false, true);
string fileName = "sss1.dwg";
HostApplicationServices hs = HostApplicationServices.Current;
try
{
String fullPath = System.IO.Path.GetFullPath(hs.FindFile(fileName, sourceDb, FindFileHint.Default));
sourceDb.ReadDwgFile(fullPath, System.IO.FileShare.Read, true, "");
}
catch
{
ed.WriteMessage("\nError!" );
string fileName = "sss1.dwg";
HostApplicationServices hs = HostApplicationServices.Current;
try
{
String fullPath = System.IO.Path.GetFullPath(hs.FindFile(fileName, sourceDb, FindFileHint.Default));
sourceDb.ReadDwgFile(fullPath, System.IO.FileShare.Read, true, "");
}
catch
{
ed.WriteMessage("\nError!" );
}
需要在zwcad的选项中指定搜索路径。