【问题标题】:Unspecified error on adding the Drawing Document添加绘图文档时出现未指定的错误
【发布时间】:2020-05-29 00:52:52
【问题描述】:

我遇到了一个问题,我需要用指定的模板文件打开一个新的绘图文件,如下所示。

objInventorServer.Documents.Add(Inventor.DocumentTypeEnum.kDrawingDocumentObject, templatePath)

但是这一行在工作项日志中给出了一个未指定的错误。我猜 InventorServer 对象正在发生问题。 因为在具有普通 Inventor.Application 对象的本地计算机中使用同一行时,它工作正常。请帮我解决问题。

【问题讨论】:

    标签: autodesk-forge autodesk-designautomation


    【解决方案1】:

    如果绘图文件来自比我正在运行的 Inventor 服务器更新的版本,我只会遇到问题,但随后我收到了更多消息:

    [05/28/2020 16:23:54]     InventorCoreConsole.exe Information: 0 : 
    RunWithArguments called
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Information: 0 : Creating 
    drawing based on template T:\Aces\Applications\317779a582552210117f0484dd24ec3e.rGm0mO9jVSsD2yBEDk9MRtXQTwsa61y0.SampleBundle[9].package\SampleBundlePlugin.bundle\Contents\Templates\ANSI (in).idw
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Information: 0 : FileExists = True
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Error: 0 : Inventor message: This file was saved in a newer version of the product. Inventor can't open newer versions of drawing (.idw, .dwg) and presentation (.ipn) files.
    [05/28/2020 16:23:54] To open a part (.ipt) or an assembly (.iam) file one year newer than your current version, install the latest updates.
    [05/28/2020 16:23:54] T:\Aces\Applications\317779a582552210117f0484dd24ec3e.rGm0mO9jVSsD2yBEDk9MRtXQTwsa61y0.SampleBundle[9].package\SampleBundlePlugin.bundle\Contents\Templates\ANSI (in).idw (Inventor Server x64 SDK 2020 (Build 240168000, 168))
    [05/28/2020 16:23:54] Search in the Inventor help for 'Troubleshooting Opening Newer Files' for information on how to open a newer file.
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Error: 0 : Inventor inner xml:
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Information: 0 : Deactivating plug-in: SampleBundlePlugin
    [05/28/2020 16:23:54]     InventorCoreConsole.exe Information: 0 : : SampleBundlePlugin: deactivating...
    [05/28/2020 16:23:54] T h e   p a r a m e t e r   i s   i n c o r r e c t .   ( E x c e p t i o n   f r o m   H R E S U L T :   0 x 8 0 0 7 0 0 5 7   ( E _ I N V A L I D A R G ) )
    [05/28/2020 16:23:54]
    

    但在这种情况下,Open 也会失败 ?

    如果我对文件和 Inventor Server 使用相同的版本,则此代码成功:

    public void RunWithArguments(Document doc, NameValueMap map)
    {
    LogTrace("RunWithArguments called");
    
    string idwPath = map.Item["_1"];
    LogTrace("Creating drawing based on template " + idwPath);
    LogTrace("FileExists = " + System.IO.File.Exists(idwPath).ToString());
    Document idwDoc = inventorApplication.Documents.Add(Inventor.DocumentTypeEnum.kDrawingDocumentObject, idwPath); 
    LogTrace("Created drawing based on template " + idwPath);
    }
    

    这是报告:

    [05/28/2020 16:33:33]     InventorCoreConsole.exe Information: 0 : RunWithArguments called
    [05/28/2020 16:33:33]     InventorCoreConsole.exe Information: 0 : Creating drawing based on template T:\Aces\Applications\eb17e332f09e0e2951aafbe13df81d70.rGm0mO9jVSsD2yBEDk9MRtXQTwsa61y0.SampleBundle[10].package\SampleBundlePlugin.bundle\Contents\Templates\ANSI (in).idw
    [05/28/2020 16:33:33]     InventorCoreConsole.exe Information: 0 : FileExists = True
    [05/28/2020 16:33:34]     InventorCoreConsole.exe Information: 0 : Created drawing based on template T:\Aces\Applications\eb17e332f09e0e2951aafbe13df81d70.rGm0mO9jVSsD2yBEDk9MRtXQTwsa61y0.SampleBundle[10].package\SampleBundlePlugin.bundle\Contents\Templates\ANSI (in).idw 
    

    您的所有 Inventor 工程图模板是否都遇到过这个问题?

    【讨论】:

    • 是的,我使用的是 Inventor 2017 中的模板文件。使用 Inventor 2018 模板(与 Forge 中使用的版本相同)后,它起作用了!没有尝试过这个东西,因为它通过 Open 方法工作。谢谢 ;)
    【解决方案2】:

    您需要正确指定templatePath。这必须是本地完整文件名。无法打开此文件。模板必须是您的输入数据或应用程序包的一部分。路径如下所示:T:\Aces\Jobs\9b8d2f73366f47a0a0b90b8c522bd52b\CadData\Templates\Norma.idw

    【讨论】:

    • 我使用了与您建议的相同的模板路径(来自作业目录),但仍然出现错误。使用 Open 函数而不是 Add 作为解决方法。
    猜你喜欢
    • 1970-01-01
    • 2018-01-14
    • 1970-01-01
    • 2020-10-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-02
    相关资源
    最近更新 更多