Copy Sketched Symbol from template IDW to IDW using visual studio

Copy Sketched Symbol from template IDW to IDW using visual studio

Anonymous
Not applicable
350 Views
1 Reply
Message 1 of 2

Copy Sketched Symbol from template IDW to IDW using visual studio

Anonymous
Not applicable

Hello,

This is my first time posting here.

I am attempting to copy sketched symbols from a template .idw to the active .idw. The code snippet (modified to add to the post) I am using is below. I get an error on line "CopySymbol = oSymbol.CopyTo(oDoc)".

Error:

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

I am using inventor 2015. This has just happened and I cannot think of anything that has changed. It runs fine on Inventor 2017 on another machine

 

Public Shared Function CopySymbol() As Inventor.SketchedSymbolDefinition

 

Dim inventorApp As Inventor.Application = GetObject(, "Inventor.Application")

Dim oDoc As Inventor.Document = inventorApp.ActiveDocument

Dim oNewDocument As Inventor.DrawingDocument = inventorapp.ActiveDocument

Dim oSourceDocument As Inventor.DrawingDocument = inventorapp.Documents.Open("O:\Drawing 2015.idw")

 

CopySymbol = Nothing

Dim oSymbol As Inventor.SketchedSymbolDefinition

For Each oSymbol In oSourceDocument.SketchedSymbolDefinitions

CopySymbol = oSymbol.CopyTo(oDoc)

Next

 

End Function

 

Thanks in advance

James

0 Likes
351 Views
1 Reply
Reply (1)
Message 2 of 2

HermJan.Otterman
Advisor
Advisor

should oDoc be a DrawingDocument? instead of a document?

 

or use the oNewDocument...   CopySymbol = oSymbol.CopyTo(oNewDocument)

If this answers your question then please select "Accept as Solution"
Kudo's are also appreciated Smiley Wink

Succes on your project, and have a nice day

Herm Jan