In a very simple code, how to pass the variable ss for "vla-SendCommand"?
(setq ss (ssget "_X" (list (cons 0 "INSERT") (cons 2 "Meu_Bloco")))
(if ss
(command "_.erase" ss "")
) ;;if ss
This does not work here
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(vla-SendCommand doc (strcat "_.erase ss "))
hugs
Dionei
Solved! Go to Solution.
Solved by Dionei. Go to Solution.
The vla-sendcommand must be entered just as it would on the command line. For starters I would try
(vla-SendCommand doc (strcat "_.erase (ssget \"_X\" (list (cons 0 \"INSERT\") (cons 2 \"Meu_Bloco\")) "))
This would run the ssget from the command line. Note the extra backslashes and spaces to make sure the string stays intact the way it should be.
Thank you very much.
This is a giant application, and change all the syntax for this mode would be extremely laborious.
The unexpected is happening because I use OpenDCL together with AutoCAD 2015.
The program worked perfectly up to version 2014.
However in some implementation OpenDCL precludes the use of command within lisp.
Preliminary study indicate having to use vla-sendCommand but the transfer of variables in the command line seems to be the key point.
Still speaking in OpenDCL there is dcl-SendString function but also I am not getting a more direct syntax.
Direct syntax does not mean it is not necessary to do almost anything. But as presented back to say it would be extremely laborious.
If he can continue to contribute would be immensely grateful.
I am continuing with many tests.
hugs
Dionei
Is there some reason you can't set your OpenDCL control's Event Invoke property to Asynchronous so that you can call (command) in your event handler?
Mr. OpenDCL himself beat me to it. I had the same issue when I started making OpenDCL apps until I found out how to switch the event invoke properties to asynchronous. If you change that you should be able to keep your lisp code the same.
I believe that by problems of language I did not understand your explanation.
The example is very simple.
How should I call the command below in OpenDCL?
(command "_.erase" ss "")
Should I use dcl-SendString and dcl-Invoke?
Excuse my ignorance, I believe that just miss some detail.
As I said, the program is huge and achieve success in calling a command with parêmetros, I think I can go a long way.
Further comment that the application OpenDCL worked perfectly up to version 2014.
Now this new version in 2015 the "command" AutoCAD not funiconam.
The strange thing is that these AutoCAD command is invoked after taking a Close in the Form OpenDCL.
Anyway, I'm looking for your help.
Tickle advance
Dionei
It is something similar to this that I seek.
Leave my lisp code as similar as possible.
Complicating have language problems.
Do not dominate so much English.
Did not understand the dcl-Invoke function.
Lips will post a code which writes to ask OpenDCL:
(command "_.undo" "_group")
(setq sel (ssget "_X" (list (cons -3 (list (list "TANQUE_SUPERIOR"))))))
(if sel
(command "_.erase" sel "")
),; If sel
(command "_.layer" "_s" "Tank" "")
Obviously we do not expect to need to change the entire syntax.
I understand that functions with the dcl-SendString and dcl-Invoke this possible?
Can they help me as if I were an 8 year old?
I appreciate your promptness.
Dionei
The dcl event invoke was referring to the actual property of the button in opendcl. If you open your dcl project in opendcl and select your button, then you will see a screen similar to the one attached. If the circled item is set to 0 then it will not allow the command function. If it is set to 1, it should.
My interpretation is that I should set the property
EventInvoke button in which I give the OK to 1.
In the properties of OpenDCL this property does not appear.
I think the pq is of type Form is modal.
I did the programming in lisp:
(dcl-Control-SetEventInvoke Proj_Trif / Form_Define_Tanque / TB_Ok 1)
(dcl-Form-Close Proj_Trif / Form_Define_Tanque)
This code is the defin c: Proj_Trif / Form_Define_Tanque / TB_Ok # onClicked.
TB_Ok is the button that should close the form and then run the procedure in lisp.
But not funionou.
The form is submitted complete with all the information.
When you click OK, the form closes briefly and then back
to the screen.
A second click on the button causes the error TB_Ok screen as below:
That is, unfortunately without success.
Is there something I can help you to help?
Dionei
The code you are having trouble with cannot be safely executed until after the modal form is closed and (dcl-Form-Show) returns. In a modal form, your OK button handler should close the form and nothing more. The OpenDCL sample EventHandling.lsp demonstrates what I am referring to, except it displays another form instead of calling (command).
With your tip could implement and succeed.
Thank you very much.
The strange thing is that it worked perfectly up to version 2014.
Besides the native AutoCAD DCL boxes need no such dealings. Clicking the OK, the lisp program execta without any problem.
But the important thing is that everything worked out.
Again thank you.
Hugs
Dionei