DCL-LISP-Condtions-Excel

DCL-LISP-Condtions-Excel

sanju.p
Enthusiast Enthusiast
1,105 Views
3 Replies
Message 1 of 4

DCL-LISP-Condtions-Excel

sanju.p
Enthusiast
Enthusiast


Hi everyone,

I am trying for conditons with relate to DCL.
Please find the attached files for your reference.

When I load the LISP file, the dialog box is just coming and going(just like a flash)

My objective of this work:

First create a rectangle
Define the cutout side
Based on the cutout side condition, it has to execute the cutout in the rectangle.

One more, excel relation
Just I want to get the width and height in excel sheet.

I request dlanorh sir and Moshe A sir to have a look at it.

 

 

Thanks in advance

Sanjeev

0 Likes
1,106 Views
3 Replies
Replies (3)
Message 2 of 4

dlanorh
Advisor
Advisor
;Your Code
(action_tile"cancel""(done_dialog)") ;Whether you press OK or Cancel this will return the same exit value
(action_tile"accept"" (done_dialog)") ;Whether you press OK or Cancel this will return the same exit value


(start_dialog) ;Start dialog Not collecting exit value to check if anything pressed
(unload_dialog dcl_id) ;End dialog Followed by unload
;this code needs to be in a while loop


;My Code
(while (not ex_val)
(if (not (new_dialog d_name dcl_id)) (rh:dcl_error (strcat "Cannot Start DCL dialog : " d_name)))


(action_tile "length" "(setq r_len $value)")
(action_tile "width" "(setq r_wid $value)")
(action_tile "cancel" "(done_dialog 0)")
(action_tile "ok" "(done_dialog 1)")

(setq ex_val (start_dialog))
(if (= ex_val 1)
(progn
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(vla-startundomark c_doc)
(initget (+ 1 8))
(setq i_pt (getpoint "\nSelect Rectangle Insertion Point : "))
(vl-cmdf "rectangle" i_pt (strcat "@ " r_len "," r_wid))
)
)
);end_while
(unload_dialog dcl_id)

Sorry, very busy at the moment

I am not one of the robots you're looking for

0 Likes
Message 3 of 4

roland.r71
Collaborator
Collaborator

It flashes because you put the entire dialog inside a repeat.

 

repeat m times

   create new dialog

   set tiles

   set actions

   unload dialog

 

You should put the actions part inside a while loop, checking for the user to choose OK or Cancel & then close the dialog.

 

Example:

; create dialog
(setq dcl_id (load_dialog dclfile))
(new_dialog "JFIX" dcl_id)

; init dialog
      (set_tile "doZoom" doZoom)
      (set_tile "doSnap" doSnap)
      (set_tile "setSNAP" setSNAP)
      (set_tile "doPurge"  doPurge)
      ; etc, etc.

; wait for user action
(setq dia_action 7 modified nil dia_abort nil)
(while (/= 4 dia_action) ; 4 = done
   (action_tile "doZoom"         "(setq doZoom         $value)")
   (action_tile "doSnap"         "(setq doSnap         $value)")
   (action_tile "setSNAP"        "(setq setSNAP        $value)")
   (action_tile "doPurge"        "(setq doPurge        $value)")
   ; etc, etc.

   (action_tile "accept" "(endcheck)(done_dialog 4)")
   (action_tile "cancel" "(setq dia_abort 1)(done_dialog 4)")
   (setq dia_action (start_dialog))
) ; end while

(unload_dialog dcl_id)

0 Likes
Message 4 of 4

dlanorh
Advisor
Advisor

Attached are commented lisp file and combined dcl file. You can have more than one dialog in a dcl file which allows only one file reference. Otherwise dcl's are OK from my brief perusal.

 

Lisp file: Don't over complicate. There are problems in your init_tiles sub function. See notes at top. I have put your two dcl dialogs into while loops and moved what i assume is to be executed if OK is pressed into a condition statement and an if statement. When using (done dialog) more than once in an individual dialog you must distinguish between them by adding an integer after so you know what was pressed e.g. (done dialog 1)

 

Edit Box action tiles : I have assumed that you want the value for that tile returned so have removed the

(ctrl_editbox_tile $key $value) references.

 

 

I am not one of the robots you're looking for

0 Likes