; layoutrename ; OP: ; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/connect-autolisp-file-to-my-dialog-box-file/m-p/13074874#M472693 (defun C:layoutrename (/ dialogname dclfilename layoutname layoutname stid) ; localize variables ; if in Model switch to layout since model tab cannot be renamed (if(not(zerop(getvar"tilemode")))(setvar"tilemode"0)) (setq layoutname "test") (setq dclfilename "layoutrename.dcl") (setq dialogname "layoutrename") (setq dcl_id (load_dialog dclfilename)) (new_dialog dialogname dcl_id) ; (action_tile "tb1" "(setq layoutname (strcat layoutname "Plan"))") ; (action_tile "tb2" "(setq layoutname (strcat layoutname "Elevations"))") ; (action_tile "tb3" "(setq layoutname (strcat layoutname "Sections"))") ; (action_tile "tb4" "(setq layoutname (strcat layoutname "Details"))") ; (action_tile "tb5" "(setq layoutname (strcat layoutname "Isometrics"))") ; (action_tile "tb6" "(setq layoutname (strcat layoutname "Fabrications"))") ; (set_tile "eb1" layoutname) (set_tile "eb1" (setq layoutnamenew (strcat layoutname "Plan"))) ; initial setting (action_tile "tb1" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Plan\")))") (action_tile "tb2" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Elevations\")))") (action_tile "tb3" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Sections\")))") (action_tile "tb4" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Details\")))") (action_tile "tb5" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Isometrics\")))") (action_tile "tb6" "(set_tile \"eb1\" (setq layoutnamenew (strcat layoutname \"Fabrications\")))") (action_tile "cancel" ; "(done_dialog)" "(done_dialog 0)" ) (action_tile "accept" ; "(command "-layout" "r" layoutname "")" ; "(done_dialog)" "(done_dialog 1)" ) ; (start_dialog) (setq stid (start_dialog)) ; save return dialog status per clicked done_dialog value (unload_dialog dcl_id) (if (= stid 1) ; chk if ok clicked (if(not(member layoutnamenew (layoutlist))) ; chk if layoutname exists (command "_.-Layout" "_R" (getvar "ctab") layoutnamenew) ; then rename current layout (alert (strcat "Current Layout Name: \n\t[" (getvar "ctab") "]\nCannot be Renamed to an Existing Layout Name: \n\t[" layoutnamenew "]")) ; else show ) ) (princ) ; clean exit )