calling InvokeLisp from palette is crashing

calling InvokeLisp from palette is crashing

JamesMaeding
Advisor Advisor
566 Views
3 Replies
Message 1 of 4

calling InvokeLisp from palette is crashing

JamesMaeding
Advisor
Advisor

I have a palette with a button to run a lisp that draws a bunch of circles.

The lisp is run with T Tanzillos InvokeLisp, and runs fine from other situations.

 

I am wondering, normally I lock the document when running stuff (synchronously) from a modelss dialog.

When I use a lisp though, there is no document locking mechanism.

 

I am doing this in my button callback:

Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();
                    ResultBuffer ret = HALispVars.InvokeLisp(args, ref stat);
                    Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();

What happens is the first run always works.

The second time I pick the button from the palette, I get an internal error.

 

Is this something obvious I am missing? (Assume the lisp is not erroring, I checked that).

It seems like it has to be related to focus issues or db access as its only with the palette that I get the issue.

thanks


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Accepted solutions (1)
567 Views
3 Replies
Replies (3)
Message 2 of 4

JamesMaeding
Advisor
Advisor

I have been testing to see if there is a pattern to the crashing, and there is.

My lisp function draws circles, using entmake.

If I do an "erase" "all" by hand on command line to clear the circles, the next call to draw the circles fails, right at the first (entmake ...) function.

 

Note that the postcommand I had seems to make no difference, those are irrelevent I think.

 

So somehow the database is not liking the entmake call, even though it worked seconds earlier.

There must be some issue with the database not being ready for write.

 

The error is an elock violation. I'll simplify the entmake and see if any dxf codes are making it angry.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 3 of 4

augusto.goncalves
Alumni
Alumni
Accepted solution
the eLockViolation means that you need to lock the database. Or maybe you left it lock from previous call.

when calling from a modeless dialog you'll need to lock or send command to AutoCAD (which will be async)
Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
0 Likes
Message 4 of 4

JamesMaeding
Advisor
Advisor

hmm, this was resolved a while back. Locking was indeed the issue and solved it.

I wonder where the posts went I thought were in this thread.

Thx for finishing it out.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes