- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a VB.net function which inserts iAssemblies. I pass it several parameters, including one to return any error messages along the way. It works fine with the debugger, but once compiled, it returns an error and poops out. Here is the text of the function:
Friend Function InsertiAssy(ByRef invApp As Inventor.Application, ByVal FilePath As String, ByVal FactoryName As String, ByVal ThisRow As String, ByRef ErrorMsg As String) As ComponentOccurrence
Dim asmDoc As AssemblyDocument = invApp.ActiveDocument
Dim TG As TransientGeometry = invApp.TransientGeometry
Dim myOccur As ComponentOccurrence = Nothing
Try
myOccur = asmDoc.ComponentDefinition.Occurrences.AddiAssemblyMember(FilePath & FactoryName, TG.CreateMatrix, ThisRow)
Catch ex As Exception
asmDoc.Save()
ErrorMsg = "Trouble inserting iAssembly " & FactoryName & ", " & ThisRow & vbCrLf & vbCrLf & ex.ToString
Return Nothing
Exit Function
End Try
Return myOccur
End Function
Here is the returned error message...
Trouble inserting iAssembly C419.007WA-F.iam, C419.007WA.024
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.ComponentOccurrences.AddiAssemblyMember(String FactoryDocumentName, Matrix Position, Object Row, Object Options)
at DD_CAD_NO1.Module1.InsertiAssy(Application& invApp, String FilePath, String FactoryName, String ThisRow, String& ErrorMsg)
Any ideas? Thanks in advance!
Software Programmer
Draper, Inc.
Solved! Go to Solution.