OpenDCL error in AutoCAD Civil 3D 2015 - SP1

Started by hvcrou, August 19, 2014, 04:05:42 AM

Previous topic - Next topic

hvcrou

hello

The program is generating error in autocad 2015 as Civil files for testing and the error message generated.
The problem that occurs is:
1) I run the code and the form submitted
2) When you click on OK the form should be closed but that does not happen he becomes active again
3) Generate the error as attached image
4) When generating the error in the windows task list of a new section of autocad and automatically generated making the machine very slow

The problem occurs with: Windows 8.1 - AutoCAD Civil 3D 2015 SP1 - OpenDCL 8.0.0.7

Thank you

owenwengerd

I suspect that your button event handler is feeding some extra empty strings to the command line, which repeats the previous command.

hvcrou

Hi there

I think the problem is not that. The code you send is just an example to recreate the error generated the empty texts are part of conabdo own.
In the real code if I manually run the function without the form how the process is executed if no error doing the process correctly.
The error is happening is that the form is closed and opened again for no reason causing the problem.

thank you

andrew.nao1

try changing your (vl-cmdf...
to (command-s...

ive had errors like this before and this was the culprit

hvcrou

Hi there

I think using command in place of vl-cmdf is a solution that shows
conflict actually exists.
The reason use is recbir vl-cmdf command response executed
which is not possible using command.

Of any variant manner made ​​the changes and execute again and the problem persists.

Thank you

owenwengerd


hvcrou

Hi there

Switch vl-cmdf for command and run the program again and again the error appears.

Thank you

owenwengerd

I guess you'll need to postpone your calls to (vl-cmdf) until after the dialog is completely closed. See if this works for you:

Code (autolisp) Select
(defun c:TFORM ( )
(defun c:formTest_OnInitialize ( )
(setq LstNamLay (list "ALINHAMENTOPREDIAL" "DIVISAS"))
)
(defun c:btnOK_OnClicked ( )
(dcl_Form_Close formTest 1234)
)
(dcl_project_load "TESTEFORMBUG" T)
(if (not (dcl_form_isactive formTest))
(progn
(if (= 1234 (dcl_Form_Show formTest))
(InitProcess)
)
)
)
)

(defun InitProcess ( )
(vl-cmdf "-layer" "n" (nth 0 LstNamLay) "c" 7 (nth 0 LstNamLay) "lt" "Continuous" (nth 0 LstNamLay) "")
(vl-cmdf "-layer" "n" (nth 1 LstNamLay) "c" 7 (nth 1 LstNamLay) "lt" "Continuous" (nth 1 LstNamLay) "")
(SaveRestoreStatusLayers 0)

;Only test code
(setq i 0)
(while (< i 100)
(princ (strcat "\nCount: " (itoa (+ i 1))))
(setq i (+ i 1))
)
(SaveRestoreStatusLayers 1)
(princ)
)

(defun SaveRestoreStatusLayers ( FlagAcao )
(cond
((= FlagAcao 0)
(if (member "CONFLAYDWG" (layerstate-getnames))
(progn
(layerstate-delete "CONFLAYDWG")
)
)
(layerstate-save "CONFLAYDWG" nil nil)
)
((= FlagAcao 1) (layerstate-restore "CONFLAYDWG" nil nil))
)
(vl-cmdf "regen")
)

hvcrou

Hi there

Your solution did not generate the error but the local function call InitProcess not address me because I have several other instructions on the ok button before going to run the processo. I want to close the form at the time of going to processar and not before.
Strange thing about this is that if I run my original code in AutoCAD Civil 3D 2014 error is not generated and I never use and always worked same technique, so I insist that in 2015's where error is being generated.

Thank you for your dedication in helping me.

Thank you

owenwengerd

Before AutoCAD 2015 you could often get away with this because AutoCAD did not need to synchronize the command throat, so it usually processed the queued window messages before any commands were processed. Note that even in 2014 and earlier your code can fail in cases where AutoCAD is slow to process window messages for some reason. In any case, the removal of fibers in AutoCAD 2015 means that the command throat now must be synchronized, so AutoCAD will block command execution until the Windows messages are processed. You have no choice now but to update your code to delay command processing until after the modal dialog is closed.

andrew.nao1

Quote from: hvcrou on August 19, 2014, 01:37:57 PM
Hi there

Switch vl-cmdf for command and run the program again and again the error appears.

Thank you

not just command, but command-s.

i use acad mech 2015 and any time i use vl-cmdf or command in opendcl code i get that violation error.

the solution for me was to change the command and vl-cmdf to command-s

hvcrou

Hi there

I got the problem solved and thanks to everyone's help.
The solution was to use the parameter to force the closure of the form with the suggestion of the manager.

Thank you

funkitect

I've got the same problem.  I close a form and I still get that same error downstream.  What parameter is used to force closure of a form?

James LeVieux

owenwengerd

I think he was referring to the argument to (dcl-Form-Close) that is used to signal what is to be done after the form is closed.