eWasNotOpenForWrite when over attribute

Ok, so this is the bug that was the most mysterious, but the least frustrating. Although it was as stupid as the next...

What I'm trying to do:

Add a BlockReference to the Modelspace with a couple of BlockAttribute's.

Problem: everything works well, until you're in AutoCAD, hovering over an attribute. This causes AutoCAD to shut down with the following message:

scandr.cpp 815 eWasNotOpenForWrite.

This somewhat obscure message got me searching all over my code for stuff I was not closing (DBObject.DowngradeOpen())...

After comparing my code with code I have written previously, I found out that the answer was in fact pretty simple:

When adding the AttributeReference to the BlockReference, I forgot to call Transaction.AddNewlyCreatedDBObject(..).

Posted by Bert Vanpeteghem

0 reacties: