Thursday, January 27, 2011

AutoCAD API error when adding text to a drawing

I have been working on a C# program that will ask the user for an insertion point and an angle before adding a simple DTEXT object to the drawing. I have encountered a problem that I have never seen before.

After the text was added to the drawing, in ModelSpace or PaperSpace, I could no longer change the active layout. The workaround was to do a REGEN and all returned to normal. I have spoken to Autodesk about this and it might be an issue with French versions of AutoCAD (I tested with 2008, 2009 and 2010 French).

To avoid the problem, the way I called my dialog box had to be changed. A command-line version of my program does not have the problem at all so it was probably related to the dialog box anyway. Here are the 3 different ways I can call my form:

Can you guess which one does work properly? I will post the answer tomorrow and will try it out on my English versions of AutoCAD for good measure as well.

No comments: