Неизвестная ошибка при добавлении документа чертежа - PullRequest
0 голосов
/ 27 мая 2020

Я застрял в проблеме, когда мне нужно открыть новый файл чертежа с указанным файлом шаблона, как показано ниже.

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

Но эта строка дает неуказанная ошибка в журнале рабочего элемента. Думаю, проблема возникает с объектом InventorServer . Поскольку при использовании той же строки на локальном компьютере с обычным объектом Inventor.Application он работает нормально. Пожалуйста, помогите мне с проблемой.

Ответы [ 2 ]

0 голосов
/ 28 мая 2020

Я столкнулся с проблемой только в том случае, если файл чертежа был из более новой версии, чем сервер 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?

0 голосов
/ 27 мая 2020

Необходимо правильно указать templatePath. Это должно быть полное локальное имя файла. Этот файл не открывается. Шаблон должен быть частью ваших входных данных или приложения. Путь выглядит так: T: \ Aces \ Jobs \ 9b8d2f73366f47a0a0b90b8c522bd52b \ CadData \ Templates \ Norma.idw

...