Visual Studio.net Code Causing Inventor Crash

Visual Studio.net Code Causing Inventor Crash

Anonymous
Not applicable
617 Views
3 Replies
Message 1 of 4

Visual Studio.net Code Causing Inventor Crash

Anonymous
Not applicable

Hello,

 

I have written a standalone application that uses the API to replace the title block in an open Inventor drawing with one defined in one of our standard drawing templates. I am having an issue with Inventor crashing during a certain block of code, which I've pinpointed below:

 

oSourceTitleBlockDef = oTemplate.ActiveSheet.TitleBlock.Definition
oNewTitleBlockDef = oSourceTitleBlockDef.CopyTo(odrawdoc, True)
oNewTitleBlockDef.Name = "Name"

oSheet.TitleBlock.Delete()
Call oSheet.AddTitleBlock(oNewTitleBlockDef)

 

Where oTemplate is the template drawing which I've called to open previously in the code:

 

oTemplate = ThisApplication.Documents.Open(FilePath, False)

 

The sheets in which this has occurred have all had existing title blocks. It is a very infrequent error, which has made troubleshooting it very difficult. I can run this code hundreds of times without any issues, and if I do have a drawing which causes the crash, the next time I try this code on the same drawing there will be no issues.

 

The dump file for the crash shows the following:

 

Dump File.png

 

Thanks in advance for any suggestions!

 

0 Likes
618 Views
3 Replies
Replies (3)
Message 2 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @Anonymous,

 

Try to open the template and make it visible by the following code. Activate the current drawing to copy titleblockdefintion from template.

 

oTemplate = ThisApplication.Documents.Open(FilePath, True)

Thanks and regards,

 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

Anonymous
Not applicable

Chandra,

 

Are you thinking it is the visibility state of the template drawing that is causing issues? I can try this as a workaround but would rather not force the user to see a drawing open and close if possible.

 

Thanks,

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

Hi @Anonymous,

 

Can you please source code to investigate further? please make sure that source code is non confidential.

 

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes