Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/02/2022 in all areas

  1. 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
    1 point
×
×
  • Create New...