Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

System.ArgumentException: 'An item with the Id [ID_New] already exists in the collection!' in Assembly document

abdechafi.neji
Contributor

System.ArgumentException: 'An item with the Id [ID_New] already exists in the collection!' in Assembly document

abdechafi.neji
Contributor
Contributor

Hello , I'm trying to create an assembly document in inventor , but I'm getting always the same exception . How can I solve this problem?

 

System.ArgumentException: 'An item with the Id [ID_New] already exists in the collection!' in Assembly document

 

abdechafineji_0-1672736012497.png

 

 

 

 

AssemblyDocument ActiveDoc = (AssemblyDocument)oApp.ActiveDocument;
try
{

AssemblyDocument oDoc = (AssemblyDocument)InventorApp.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, oApp.FileManager.GetTemplateFile(DocumentTypeEnum.kAssemblyDocumentObject), true); // exception here

}
catch (Exception e)
{
MessageBox.Show(e.Message);
}

 

 

 

0 Likes
Reply
241 Views
2 Replies
Replies (2)

JelteDeJong
Mentor
Mentor

I tried your code and I didn't get any exceptions. And looking at the exception message, I doubt the problem is on that line. Inventor exceptions never have such a good description message.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Michael.Navara
Advisor
Advisor

I agree with @JelteDeJong and I have one notice. Autodesk.Windows.ToolBars is not a member of Inventor API (see callstack)