Total Newby

Started by Cornelis, September 25, 2015, 01:29:35 PM

Previous topic - Next topic

Cornelis

Hello OpenDCL Forum.

I am Cornelis and in my 50 Years never joined any forum, so please bear with me Normally I only read a lot of them.

Hope I will not do any stupid things.

I am new to OpenDCL but not new to Autocad, I am here to get some help with the following.

I wrote a little lisp program and wanted a new and good looking Interface witch stays on top and is drag able round the screen to place it out of the way.

If I understood it wright, I need a modeless form, for interaction with AutoCAD while the form stays on top or open

Standard DCL boxes are made to dis a peer and then interact with Autocad

I have a demo project where I can start by a click on a button a lisp like

(command "line" pause)              ;form stays open

But if I push another button on my form while the original command is still waiting for user input. I want the new chosen command to cancel the running command and start the new one like:

(command "circle" pause)

So the user don’t have to enter Escape Escape to cancel
I managed at first by setting 

(dcl-Control-SetEventInvoke AD_Form1 1)
(dcl-Control-SetEventInvoke AD_Form1_TreeC1 1)

And I tried this, both worked
(dcl-Invoke "c:lispCircle")
(dcl-SendString "(c:lispCircle)" )

in the first test it worked superb in a treeview flawlessly, so I started programming the UI but I can’t get it to work with immagebuttons.

And if I change for example a click or any other  event of the treeview and save the project then it doesn’t work that way anymore. The it says “Point or option keyword required.”

And that is the way Autolisp is supposed to work saying cant re-enter autolisp

I do provide 2 exactly the same sample project to clarify.

Sorry for my bad English.

Thanks in advance

Regards

Cornelis









   
Thanks.

roy_043

#1
You have not include the NotOke3.odcl file.

1.
I don't understand the problem you have with image buttons. But you should check if their event invoke property is set to asynchronous.
2.
To cancel running commands you can try this:
Code (autolisp) Select
(progn (dcl-sendstring (strcat (chr 27) (chr 27) "circle ")) (princ))
See discussion here: http://www.opendcl.com/forum/index.php?topic=2280.msg11475#msg11475.
3.
When you update the caption with "Done with circle" etc. The command is actually still running.
4.
In the Lisp files you refer to a problem with event names after saving the .odcl file under a new name. There is a tool to reset event names: Menu > Tools > Reset Event Names.

roy_043

...
5.
The form does not have a title bar and initially I did not know how to move it around on screen. Other users may be confused as well.
6.
In the code to handle the tree you supply image indices. But the tree control does not have an image list.
7.
You are using both the old and the new ODCL naming scheme. In new projects I would use only the new scheme.

Attached are two new files. Note: I have removed the (big) images from the .odcl file.

Cornelis

Hi Roy

Thank you for your reply's and editing my files

1) I dont have the time to test your files right know but will come back to you on Teuasday.

2) I tried every thing, but I will try this also.

3) this is just to check what is happening

4) I am glad you explained

"There is a tool to reset event names: Menu > Tools > Reset Event Names."

Nice such a tool ;-)

5)Sorry This is just a demo to explain my problem no actual users here, but thanks
6)Thanks I copied a piece of code from the examples, didn't know the exact meaning of the numbers
7)Did not know how to change them but with your point 4 i will try

How did you removed the images, i couldnt find them in the RAD (OpenDCL or the program you edit the dialogs with)  anymore?


Have a nice weekend

Cornelis

Thanks.

roy_043

...
Ad. 7.
I have not explained sufficiently. Recently the ODCL naming scheme was revised.
See: http://www.opendcl.com/forum/index.php?topic=2084.0
In your code you are mixing old and new names.

Example 1:
Code (autolisp) Select
(dcl-Control-SetEventInvoke AD_Form1 1)
dcl-Control-SetEventInvoke = NEW
AD_Form1 = OLD

Example 2:
Code (autolisp) Select
(dcl_Tree_AddParent AD/Form1/TreeC1  "Houtafscheider" 10 -1 10))
dcl_Tree_AddParent = OLD
AD/Form1/TreeC1 = NEW

Cornelis

Hi Roy, I looked at your edited file.

I changed it a little to reproduce the problem I have and renamed them to Roy.lsp and Roy.odcl.

What I want: I need to get points distances and user input etc. and then execute my piece of lisp code to insert blocks explode them and do things with them. Other commands lets user select items lets user select points and I move and copy them etc. etc.
This is the problem point: But while still getting this user input I want the user to make a different choice, so cancel what he is doing and execute the other new chosen command not by ESCAPE ESCAPE but thus bij pushing another button or treeview choice on the form.

Why? “Because all Autocad works that way”.

I simplified the problem by only using (Getpoint "And then the specific question") 

This happens In your files: Roy.lsp and Roy.odcl 
(These are your Edited Oke3 files with I downloaded and modified the commands in to get the problem clear.)
When I Click in the Treeview (Roy.odcl) on DrawCircle and do not pick a point but click on DrawLine in the Treeview, it says:

Can't reenter LISP.
Invalid point.

This is standard AutoCAD behaviour you can’t answer a lisp user input by another piece of lisp.
So  (chr 27) won't work here. (Just type (getpoint) and try to cancel that by lisp)

But somehow in my files: Oke3.lsp and Oke3.dcl
Witch I Modified to execute the exact same commands as I placed in your Roy.lsp and Roy.odcl

1) When I Click in the Treeview  (from Oke3.dcl ) on DrawCircle and do not pick a point but click on DrawLine in the Treeview, it just executes the new chosen command (DrawLine) just fine.

I reached this behaviour(1) by accident, just fooling around a few weeks ago, it even works without the (chr 27) (chr 27).
But this is exact the way I like my dialog to perform but I cannot get other elements to work this way.

So I am aware that my oke3.lisp code is not changed according to your comments. But this lisp file is doing exactly what I want in the treeview but not in the Image buttons. (If I change it to much the behaviour(1) is gone)

So my question is can you tell me how to get this behaviour in the files you edited so nice both in the treeview and Image Buttons.

I really hope you I explained it this time well enough and that the examples are clear.

Note that these Oke3 Files are new versions.

Regards Cornelis







Thanks.

roy_043

If I load your last Oke3 project and click items in the tree view, Lisp code that was previously sent to the CAD program is indeed cancelled. But I don't know why this works. There is something strange going on.

While analysing the project I changed 3 things:
1. Reset the event names in the .odcl file.
2. Removed "(chr 27) (chr 27) " in the .lsp file (4x).
3. Replaced "PicTest" with "Oke3" in the .lsp file (6x).
After this set of changes, which I think should not alter the functionality of the project in any way, the 'automagic' cancel effect is gone!

Maybe Owen can look into this.

Cornelis

1) After this set of changes, which I think should not alter the functionality of the project in any way, the 'automagic' cancel effect is gone!

Thanks Roy, thats why I didn't change all that.

I hope you understand that I am looking for that Automatic Cancel Effect, it is awesom.

Do i have to do something to let Owen Look at this?
Thanks.

roy_043

Cornelis, I don't think you are completely right when you say:
Quote from: Cornelis on September 29, 2015, 03:21:48 AM
This is standard AutoCAD behaviour you can’t answer a lisp user input by another piece of lisp.
I can't be sure because I use BricsCAD instead of AutoCAD.

Two examples that work in BricsCAD:

Example 1:
: (setq pt (getpoint "\nPoint please: "))
Point please: (list 1.1 2.2 3.3)
(1.1 2.2 3.3)
Point please: (1.1 2.2 3.3)
: !pt
(1.1 2.2 3.3)


Example 2:
: (setq i (getint "\nInteger please: "))
Integer please: (* 2 3)
6
Integer please: 66
: !i
6

Cornelis

Might be Roy, but that is from the command line I gues?
Thanks.

Cornelis

Autocad 2014 :

(setq i (getint "\nInteger please: "))

Integer please: !i
Can't reenter LISP.

Requires an integer value.



Command: (setq pt (getpoint "\nPoint please: "))

Point please: !pt

Can't reenter LISP.
Invalid point.

Maybe a setting? But this ia also what I red on the net.
Thanks.

roy_043

Quote from: Cornelis on September 29, 2015, 05:15:35 AM
Autocad 2014 :

(setq i (getint "\nInteger please: "))

Integer please: !i
Can't reenter LISP.

Requires an integer value.



Command: (setq pt (getpoint "\nPoint please: "))

Point please: !pt

Can't reenter LISP.
Invalid point.

Maybe a setting? But this ia also what I red on the net.
You are not following my example.

Cornelis

to be complete

Command: (setq i (getint "\nInteger please: "))
Integer please: 6
6
Command: (setq i (getint "\nInteger please: "))
Integer please: !i
Can't reenter LISP.
Requires an integer value.


and

Command: (setq pt (getpoint "\nPoint please: "))
Point please: (16.7359 7.10615 0.0)
Command: (setq pt (getpoint "\nPoint please: "))
Point please: !pt
Can't reenter LISP.
Thanks.

Cornelis

Sorry reading is difficult, try that.
Thanks.

Cornelis

Command: (setq pt (getpoint "\nPoint please: "))
Point please: (list 1.1 2.2 3.3)
Can't reenter LISP.
Invalid point.
Thanks.