Error calling a dll from odcl

Started by krunch, February 18, 2012, 05:59:28 AM

Previous topic - Next topic

krunch

Hi

I use a dll assembly that provides a new Lisp function comparable to this one (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 ?

Kerry

Perfection is not optional.
My other home is TheSwamp

Kerry

#2

Without seeing your code, I'd guess ;

Your .NET code needs a Documentlock statement
something like
Code (C#) Select

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
Perfection is not optional.
My other home is TheSwamp

krunch

#3
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 : http://cadxp.com/index.php?/topic/34232-proprietes-de-remplacement-des-calques/  (POST#3 - in french)

Thanks a lot