COM Exception while closing Drawing Document in Inventor 2018

COM Exception while closing Drawing Document in Inventor 2018

Anonymous
Not applicable
955 Views
5 Replies
Message 1 of 6

COM Exception while closing Drawing Document in Inventor 2018

Anonymous
Not applicable

Hello,

I am software developer working on Design Automation tool that is using Inventor COM library for Auto generation of Model & drawing.I am migrating from Inventor 2016 to Inventor 2018.Now I am referencing Inventor 2018 object library in my project.

 

Now I am getting COM Exception message as "The remote procedure call failed" & Source is 'mscorlib' in my code while trying to close a drawing document which is terminating Inventor Application.This exception occurs only when I manually open Inventor 2018 after that I run my standalone application.The Exception will not occur when Inventor Instance is created by my application.

 

I am getting exception in following block of code

 

GCADSingleton.Instance.ofrmProgress.SetProgressBarValue("Placing Base and Section View.....", False)
'Open the active document and its drawing document
oIptDoc = GCADSingleton.Instance.oIptDoc

'Get drawing documnet using filename from open files
oDrawdoc = GCADSingleton.Instance.oDrawdoc

Dim sDrapath As String
sDrapath = oDrawdoc.FullFileName

oDrawdoc.Close(True) 'Excption at this line

 

Please refer attached screenshots for more details

 

I am stuck at this point so any help will be Highly Appreciable 

 

Thanks in advance

Ajit Nikam

0 Likes
Accepted solutions (1)
956 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

Hi,

 

Seems that the reference to the correct InventorApplication is wrong.

You are trying to close a document, but the standalone application is referencing to the wrong app (the manually started application)

 

Try to declare your Inventor.application as early as possible, so that the manual started application will have no influence on the standalone application.

 

If support is needed, please let me know.

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

Anonymous
Not applicable

Hello Braden,

 

My standalone application check the inventor instance first,if it is already running then it connect to running instance of inventor otherwise it create new inventor instance.I have checked & found that my standalone application is referencing the correct inventor instance.My application successfully generated the Model(which is opened visibly false)  when it  comes for drawing generation it throws mentioned exception.

 

My code for getting Inventor App is as follows

 

Public Sub LaunchInventor()

On Error Resume Next
oApp = Nothing
oApp = DirectCast(Marshal.GetActiveObject("Inventor.Application"), Inventor.Application) 

 

If oApp Is Nothing Then

For Each p As Process In Process.GetProcessesByName("Inventor")
p.Kill()
Next

oApp = DirectCast(CreateObject("Inventor.Application"), Inventor.Application)

End If

oApp.ScreenUpdating = False
oApp.Visible = True
oApp.WindowState = WindowsSizeEnum.kMinimize

' Added by Rohini for inventor content center issue
Dim oCCAddin As ApplicationAddIn
oCCAddin = oApp.ApplicationAddIns.ItemById("{3D88D7B5-6DD8-4205-A2B5-2B51F7BF74A7}")
oCCAddin.Activate()

ActivateVaultAddin()

While Not oApp.Ready
Threading.Thread.Sleep(5)
End While
End Sub

0 Likes
Message 4 of 6

Anonymous
Not applicable
Hello Braden, the mentioned exception never occur after installing Inventor 2018.2 update
0 Likes
Message 5 of 6

bradeneuropeArthur
Mentor
Mentor

I have seen that some unexpected error have been updated in the .2 release too.

Solved then for the moment?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 6

Anonymous
Not applicable
Accepted solution
Yes,the Inventor 2018.2 solved the problem
0 Likes