Running commands in CAD2015 with OpenDCL

Started by dioneib, June 14, 2014, 02:01:46 PM

Previous topic - Next topic

dioneib

I have a program running smoothly with AutoCAD 2014.

In AutoCAD 2015 I am not succeeding.

The forms are loaded OpenDCL complete and work perfectly.

But when you click the OK button, which triggers lisp routines, the error occurs when invoking any AutoCAD command.

The EventInvoke proriedade the button is set to the value 1.

Yet the lisp commands are not executed.

Below is the code that put the executed when you click the OK button:

(dcl-Control-SetEventInvoke Proj_Trif / Form_Define_Tanque / TB_Ok 1)
(dcl-Form-Close Proj_Trif / Form_Define_Tanque)
(TD_TANQUE_SUPERIOR PT_SUP)

The defun TD_TANQUE_SUPERIOR must perform a series of CAD commands and works perfectly on anteirores versions to AutoCAD 2015.

I do not want to believe it is necessary modficar overused my LISP code.

I still remember that the program should work in versions 2009 to 2015.

Agredeço advance for any assistance.

hugs
Dionei

owenwengerd

I answered here. In short, executing code after (dcl-Form-Close) is not safe. Nothing has changed in that respect in AutoCAD 2015. What you have may work if Windows processes window messages quickly enough, but it is not safe in any version of AutoCAD.
Owen Wengerd (Outside The Box) / ManuSoft

kenkrupa

I got here because I found a similar problem, running a command at OK with a modal dialog. Worked fine prior to R2015, so something did change. Took me hours stripping down my program to even determine that running a command was the problem. But other stuff of mine (also modal) runs commands no problem, so I wondered what's different. Found the answer:

The stuff that works does not run a command right in the OK_OnClicked function, which closes the form. That's what the problem app was getting away with prior to R2015. I fixed it by using return values of the close, like so:


  (defun c:cmdOK_OnClicked (/)
    (dcl_Form_Close frmMyForm 3) ; anything but 1 or 2
    ; don't do anything else here
  )
  (defun c:cmdCancel_OnClicked ()
    (dcl_Form_Close frmMyForm 2) ; 2 is standard for Cancel
  )

  (setq return (dcl_Form_Show frmMyForm))
  (cond
    ((= return 3) ; OK
      (command "line" "0,0" (getvar "viewctr") "") ; no problem!
    )   
  );cond


Maybe this will help someone else.