我写了一个应用程序来打开和打印一个dwg文件。绘图过程正常工作;但是,当我查看“绘图”和“发布详细信息”窗口时,我看到文件属性设置为<UnSaved Drawing>,而不是我的dwg文件名。
我的意思是这样的:
表格:未保存的_2-模型-绘制 文件:>类别名称:>页面设置:>设备名称:\server\MyPrinterName>绘图文件路径:>纸张大小:字母
我犯了什么错?!
注意:我使用了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;
}发布于 2012-01-01 05:31:16
打开的代码基本上打开现有的绘图,并将其内容加载到一个新的文档实例中。由于以前不存在新文档实例,因此它没有保存名称,因此您的绘图消息显示意外的文件名。
我不能100%确定这是否有效(我面前没有我的autoCAD机器来测试),但是您可以尝试将加载代码更改为:
String MyDWGFilePath = @"\\Server\SharedFolder\Projects\File1.dwg";
DocumentCollection dm = Application.DocumentManager;
if(File.Exists(MyDWGFilePath))
{
dm.Open(MyDWGFilePath, false);
}https://stackoverflow.com/questions/8691875
复制相似问题