Search code examples
c#autocad-plugin

using Command and form case error just-in-time (JIT)


I'm building a new c# form for AutoCAD so I have code where it build a rectangle by polyline and when i use button form to call the class it give me the Error

Application does not support Windows Forms just-in-time (JIT)

So I solve the problem by using

acDoc.LockDocument

and it worked but now I have to use this command to fillet my rectangle but even LockDocument doesn't help any idea plz :)

acDoc.Database.Filletrad = 5.0;

ed.Command("_.fillet", "Polyline", acPoly.ObjectId);

Note without using form and calling the code even with out to LockDocument the code work but I still need the form

enter image description here


Solution

  • It was the way how to call modeless form I was calling the form like this:

    Form1 f1 = new Form1();
    f1.Show();
    

    But basically it should be like this:

    Form1 f1 = new Form1();
    Application.ShowModalDialog(null, f1, false);