1

我编写了一个应用程序来打开和打印 dwg 文件。绘图过程正常工作;但是,当我查看 Plot and Publish Details 窗口时,我看到 File 属性设置为<UnSaved Drawing>而不是我的 dwg 文件名。

我的意思是这样的:

工作表:UnsavedDwg_2-Model - Plotted

File : <UnSaved Drawing>> 
Category name :> 
Page setup :> 
Device name : \\server\MyPrinterName> 
Plot file path :> 
Paper size : Letter

我的错是什么?!!!

注意:我使用类的Open方法DocumentCollection打开了我的 dwg 文件,并使用此代码将打开的 dwg 文件打印到打印机。

我打开 dwg 文件的代码:

String MyDWGFilePath = @"\\Server\SharedFolder\Projects\File1.dwg";
DocumentCollection dm = Application.DocumentManager;
Document doc = null;

if(File.Exists(MyDWGFilePath))
{
   doc = dm.Open(MyDWGFilePath, false);
   Application.DocumentManager.MdiActiveDocument = doc;
}
4

1 回答 1

0

您的打开代码基本上会打开现有绘图并将其内容加载到新文档实例中。由于新文档实例以前不存在,因此它没有保存名称,因此您的绘图消息会显示意外的文件名。

我不能 100% 确定这是否可行(我面前没有我的 AutoCAD 机器来测试),但您可以尝试将加载代码更改为:

String MyDWGFilePath = @"\\Server\SharedFolder\Projects\File1.dwg";
DocumentCollection dm = Application.DocumentManager;

if(File.Exists(MyDWGFilePath))
{
  dm.Open(MyDWGFilePath, false);
}
于 2012-01-01T05:31:16.337 回答