Error when creating drawing file fromout assembly

Error when creating drawing file fromout assembly

Daan_M
Collaborator Collaborator
205 Views
1 Reply
Message 1 of 2

Error when creating drawing file fromout assembly

Daan_M
Collaborator
Collaborator

Hi,

 

When i try to create a drawing with iLogic, Inventor keeps throwing errors.

I'm kinda tired so might be missing something obvious, but i don't understand what's wrong with the code

Sub Main()
	
Dim oInvApp As Inventor.Application = ThisApplication
Dim oDoc As Inventor.Document = ThisDoc.Document
Dim oDocDir As String = ThisDoc.Path & "\"
Dim oDocName As String = ThisDoc.FileName

Dim oTemplate As String = "X:\CAD 3D\Testmap\Template\Template sales tekening.idw"
Dim oDrawingDoc As DrawingDocument = oInvApp.Documents.Add(kDrawingDocumentObject, oTemplate, True)

oDrawingDoc.SaveAs(oDocDir & oDocName & ".idw" ,True)
oDrawingDoc.Close

End Sub 
0 Likes
Accepted solutions (1)
206 Views
1 Reply
Reply (1)
Message 2 of 2

Daan_M
Collaborator
Collaborator
Accepted solution

Managed to find the problem:

 

I had my template file open in the same instance of the Inventor application, this caused an Error without further explanation: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

Kinda annoying tbh, but still my fault.

Funnily enough opening the file works;

 

oInvApp.Documents.Open(oTemplate)

 

But adding it as new drawing DOESNT

 

oInvApp.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, oTemplate, True)

 

0 Likes