OpenDCL Forums

OpenDCL => Runtime/AutoLISP => Topic started by: krunch on February 18, 2012, 05:59:28 AM

Title: Error calling a dll from odcl
Post by: krunch on February 18, 2012, 05:59:28 AM
Hi

I use a dll assembly that provides a new Lisp function comparable to this one (http://"http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/How-to-set-layer-properties-per-viewport-solution/td-p/2077834") (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 ?
Title: Re: Error calling a dll from odcl
Post by: Kerry on February 18, 2012, 02:27:56 PM

Should that be:
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/How-to-set-layer-properties-per-viewport-solution/td-p/2077834 (http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/How-to-set-layer-properties-per-viewport-solution/td-p/2077834)
Title: Re: Error calling a dll from odcl
Post by: Kerry on February 18, 2012, 02:41:10 PM

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
Title: Re: Error calling a dll from odcl
Post by: krunch on February 19, 2012, 01:56:13 PM
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/ (http://cadxp.com/index.php?/topic/34232-proprietes-de-remplacement-des-calques/)  (POST#3 - in french)

Thanks a lot