Jump to content

Programming DCL and Lisp?


BLOACH85

Recommended Posts

I need to know if anyone has or can point me in the right direction of a pdf file for dialog boxes. Once you have the dialog box done how do you program it into a lisp routine to do exactly what you want. Does it all appear as a condition? Setting variables? I just cant really find enough info on what i need. We have a lisp that will do calculations based on user input but the input will need to be taken either in decimal form or feet and inches and display in feet and inches.

 

Just sittin here fishin.....waitin on a bite.

 

Bloach:unsure:

Link to comment
Share on other sites

:) Hey i appreciate this I should be able to get most of what i need from here but if not i will be back with more questions count on it!:D
Link to comment
Share on other sites

So are you pretty good with dcl? I might need some simpler advice on the easy (thats what i think!) task im working on.
No, I'm not good with DCL, I just know the basics. Anytime I need something, I steal it from existing code.

 

I'm a keyboard-and-command-line user (old skool). But hopefully others here are good at DCL.

Link to comment
Share on other sites

Well there is nothing wrong with that. It would be my philosophy aslo if i wasnt such a dang perfectionist. Its a curse and a blessing:D

Link to comment
Share on other sites

Also, If you need some help with your dialog, I will be glad to assist you.

Displayed is a Cable Tray Fill Calculator I put together. Maybe this is along the same lines of what you want.

 

The DCL

///////////////////////////////////////////////////////////////////////////////////////
ctf : dialog {
     label = "Cable Tray Fill Calculations.";
     : boxed_column {
       label = "Input:";
       : edit_box {
         label = "Cable Diameter:";
         key = "CD1";
         edit_width = 5;
       }
       : edit_box {
         label = "Tray Load Depth:";
         key = "LD1";
         edit_width = 5;
       }
       : edit_box {
         label = "Tray Inside Width:";
         key = "TW1";
         edit_width = 5;
       }
       : edit_box {
         label = "Tray Fill Percentage:";
         key = "FP1";
         edit_width = 5;
       }
       : spacer { height = 1;
       }
     }
     : row {
       : button {
         label = "Calculate";
         key = "calc";
         width = 12;
         fixed_width = true;
       }
       : spacer { width = 45;
       }
       : button {
         label = "Reset";
         key = "default";
         width = 12;
         fixed_width = true;
       }
     }
     : boxed_column {
       label = "Output:";
       : row {
         : text {
           label = "Tray Cross Sectional Area - Sq.In. =";
           width = 40.5;
         }
         : text {
           key = TA1;
           width = 0;
         }
       }
       : row {
         : text {
           label = "Fill Percent Area - Sq.In. =";
           width = 40.5;
         }
         : text {
           key = FA1;
           width = 0;
         }
       }
       : row {
         : text {
           label = "Cable Cross Sectional Area - Sq.In. =";
           width = 40.5;
         }
         : text {
           key = CA1;
           width = 0;
         }
       }
       : row {
         : text {
           label = "Cable Quantity =";
           width = 48;
         }
         : text {
           key = CQ1;
           width = 0;
         }
         : spacer { height = 1;
         }
       }
     }
     : row {
       : spacer { width = 45;
       }
       : button {
         label = "Cancel";
         key = "cancel";
         width = 12;
         fixed_width = true;
         mnemonic = "C";
         is_cancel = true;
       }
     }
   }
///////////////////////////////////////////////////////////////////////////////////////

 

The Program

;;;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;;; Function - Cable Tray Fill Calculations.                               ;Describe function

(defun C:CTF (/ CD LD TW FP CA TA FA CQ)                                   ;Define function, Declare local variables
 (setq dcl_id (load_dialog "ctf.dcl"))                                    ;Load dialog                                   
 (if (not (new_dialog "ctf" dcl_id))                                      ;Startof if, Start of not, Test for dialog, End of not
     (exit))                                                              ;Dialog not found then exit, End of if
 (set_tile "CD1" "0.25")                                                  ;Set the default cable diameter to 0.25"               INPUT
 (set_tile "LD1" "3.0")                                                   ;Set the default cable tray load depth to 3.0"         INPUT
 (set_tile "TW1" "12.0")                                                  ;Set the default cable tray width to 12.0"             INPUT
 (set_tile "FP1" "50")                                                    ;Set the default cable tray fill percentage 50%        INPUT
 (set_tile "TA1" "0")                                                     ;Set the default cable tray cross sectional area to 0  OUTPUT
 (set_tile "FA1" "0")                                                     ;Set the default cable tray fill area to 0             OUTPUT
 (set_tile "CA1" "0")                                                     ;Set the default cable cross sectional area to 0       OUTPUT
 (set_tile "CQ1" "0")                                                     ;Set the default cable quantity to 0                   OUTPUT

 (action_tile "calc"                                                      ;When Calculate button is pressed
"(CALC)")                                                                 ;GOTO CALC function
 (action_tile "default"                                                   ;When Reset button is pressed
"(RESET)")                                                                ;GOTO RESET function
 (action_tile "cancel"                                                    ;When Cancel button is pressed
"(done_dialog)")                                                          ;Close the dialog
 (start_dialog)                                                           ;Start dialog
)                                                                          ;End of define function
;;;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;;; Reset Function - Resets All Inputs & Outputs                           ;Describe function
(defun RESET ()                                                            ;Define function
 (set_tile "CD1" "0")                                                     ;After RESET button is pressed, Set cable diameter to 0                  INPUT
 (set_tile "LD1" "0")                                                     ;After RESET button is pressed, Set cable tray load depth to 0           INPUT
 (set_tile "TW1" "0")                                                     ;After RESET button is pressed, Set cable tray width to 0                INPUT
 (set_tile "FP1" "50")                                                    ;After RESET button is pressed, Set cable tray fill percentage to 50%    INPUT
 (set_tile "TA1" "0")                                                     ;After RESET button is pressed, Set cable tray cross sectional area to 0 OUTPUT
 (set_tile "FA1" "0")                                                     ;After RESET button is pressed, Set cable tray fill area to 0            OUTPUT
 (set_tile "CA1" "0")                                                     ;After RESET button is pressed, Set cable cross sectional area to 0      OUTPUT
 (set_tile "CQ1" "0")                                                     ;After RESET button is pressed, Set cable quantity to 0                  OUTPUT
)                                                                          ;End of define function
;;;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;;; Calculation Function - Calculate All Inputs & Constants                ;Describe function
(defun CALC ()                                                             ;Define function
 (setq CD (atof (get_tile "CD1")))                                        ;Convert cable diameter string to real
 (setq LD (atof (get_tile "LD1")))                                        ;Convert cable tray load depth string to real
 (setq TW (atof (get_tile "TW1")))                                        ;Convert cable tray width string to real
 (setq FP (atof (get_tile "FP1")))                                        ;Convert cable tray fill percentage string to real
 (setq CA (* (* CD CD) (/ pi 4)))                                         ;Calculate cable area, Cable diameter square mulitplied by pi divided by 4
 (setq TA (* TW LD))                                                      ;Calculate cable tray area, Cable tray width mulitplied by cable tray load depth
 (setq FA (* (/ FP 100) (* TW LD)))                                       ;Calculate cable fill area, Cable tray fill percentage divided by 100 mulitplied by cable tray width multiplied by cable tray load depth
 (setq CQ (/ FA CA))                                                      ;Calculate cable quantity, Cable tray area divided by cable area
 (OUTPUT)                                                                 ;GOTO OUTPUT function
)                                                                          ;End of define function
;;;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;;; Output Function - Take All Calculations & Place In Dialog              ;Describe function
(defun OUTPUT ()                                                           ;Define function
 (set_tile "FA1" (rtos FA 2 2))                                           ;Get cable tray fill area calculation, Place in dialog key FA1
 (set_tile "TA1" (rtos TA 2 2))                                           ;Get cable tray area calculation, Place in dialog key TA1
 (set_tile "CA1" (rtos CA 2 2))                                           ;Get cable area calculation, Place in dialog key CA1
 (set_tile "CQ1" (rtos CQ 2 2))                                           ;Get cable quantity calculation, Place in dialog key CQ1
)                                                                          ;End of define function
;;;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

I hope this will help. I can provide additional assistance.

 

The Buzzard

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...