Error calling a dll from odcl

Started by krunch · 2012-02-18 13:59 UTC · 3 replies · SMF topic #1756

Hi

I use a dll assembly that provides a new Lisp function {2} (it allows to write layers overrides)

The problem is that the dll retrieves a "eLockViolation" error if it's triggered by a odcl control, and only in this case.

The error occurence is not systematic, and it seems to depend on the previous user interraction with ACad interface.
For example it doesn't occurs :
- if I place (entsel) just before the function call and if I select an object (my problem is that I don't want to ..)
- if I place (vla-regen doc acActiveViewport) before (same)
(dcl_SetCmdBarFocus) doesn't prevent this error

Any idea ?

Should that be:
{2}

Without seeing your code, I'd guess ;

Your .NET code needs a Documentlock statement
something like

using (DocumentLock m_doclock= Application.DocumentManager.MdiActiveDocument.Lock​Document())
{
  // Do your mojo here to modify drawing
}

I'm imagining that the code is being executed in the application context (which requires document locking) from the control, while it runs in a document context from the commandline.

It may be worth a try anyway.

Regards, Kerry
Hi

You're right twice :
-that was the page that I meant ..
-the dll has been updated with your tip, there's no more error

Dll has been made by (gile) on cadxp : {2}  (POST#3 - in french)

Thanks a lot