;Program to help come up with preliminary bridge framing plans.
;All angles, radii, offsets, etc. should be manually checked by the user in model space.
(defun C:FRAMING (/ alignment left_offset left_overhang right_offset right_overhang num_gird)
(FramingInput)
;(setq alignment (entsel "\nSelect Alignment:"))
;(command "._offset" left_offset alignment)
(alert (strcat "You have input " left_offset "ft \nfor the left offset and"
right_overhang "ft for the right overhang."))
(princ)
);end function
;-------------------------Run the dialog box---------------------------
(defun FramingInput (/ dcl_id NumGirdList num_gird)
(setq dcl_id (load_dialog "D:\\FramingInput.dcl"));load dialog box and set a reference to it
(if (not (new_dialog "FramingInput" dcl_id));if the dialog definition is not found, exit the program.
(progn
(alert "The DCL file for user input could not be found.")
(exit)
);end progn
);end if
;Define the list that the user can choose from for Number of Girders
;(setq num_gird 2)
(setq NumGirdList '("2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14"))
(start_list "gird_list")
(mapcar 'add_list NumGirdList)
(end_list)
;Define variables used in the above main code from the user inputs from the dialog box
(action_tile "left_offset" "(setq left_offset $value)")
(action_tile "left_overhang" "(setq left_overhang $value)")
(action_tile "right_offset" "(setq right_offset $value)")
(action_tile "right_overhang" "(setq right_overhang $value)")
;note to self: need to add a line for checking if girder spacing is set to variable or constant
;If the user presses cancel, close the dialog box.
(action_tile "cancel" "(done_dialog) (setq userclick nil)") ;close dialog, set flag
;When the user clicks "OK", check all the values of their inputs
(action_tile "accept" ;when the user clicks OK, do the following
"(progn
(checkval)
)"
);end action tile
(start_dialog)
(unload_dialog dcl_id)
(princ)
);end function
;------------------Check Dialog Box Inputs-------------------------
(defun checkval ()
(if
(not
(or
(distof (get_tile "left_offset"))
(distof (get_tile "left_overhang"))
(distof (get_tile "right_offset"))
(distof (get_tile "right_overhang"))
) ;end and
) ; end not
(set_tile "error" "Offset and overhang inputs must be numbers!")
;Else Ifs:
(cond
((= (get_tile "left_offset") "")
(set_tile "error" "You must enter a value for the Left Edge of Deck Offset.")
(mode_tile "left_offset" 3)
)
((= (get_tile "left_overhang") "")
(set_tile "error" "You must enter a value for the Left Edge of Deck Overhang.")
(mode_tile "left_overhang" 3)
)
((= (get_tile "right_offset") "")
(set_tile "error" "You must enter a value for the Right Edge of Deck Offset.")
(mode_tile "right_offset" 3)
)
((= (get_tile "right_overhang") "")
(set_tile "error" "You must enter a value for the Right Edge of Deck Overhang.")
(mode_tile "right_overhang" 3)
)
(T(done_dialog)) ;if none of those things happen, close the dialog box.
)
)
);end function
To many IF statements wrongly written, and error in actiontile ACCEPT.
Autolisp doesn't have IF THEN ELSE ELSEIF form as other programming languages.
It's only (IF (true block)(false block)). Better use COND instead.
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.