; ---- (defun c:nextsheet ( / ix sheet_lst x sheet) ; Return the WD_M block's SHEET attribute value ; of "next" dwg in project. This embedded in a ; global called GBL_wd_prj_ixlst. If global ; doesn't exist, make call to refresh it. (if (not GBL_wd_prj_ixlst) (setq GBL_wd_prj_ixlst (c:ace_proj_data nil))) ; GBL_wd_cip holds index of current drawing in ; the overall project drawing list. (setq ix GBL_wd_cip) ; index ; If index not defined for current drawing, then ; trigger a refresh of the global. (if (OR (not ix)(= ix 0)) (setq ix (c:wd_is_cur_dwg_in_proj)) ) (setq sheet "") (if (> ix 0) (progn ; current drawing is in the project, ; increment to next dwg in list (setq ix (1+ ix)) ; increment index ; Get list of SHEET numbers assigned to ; all dwgs in the project dwg set. (setq sheet_lst (nth 3 GBL_wd_prj_ixlst)) ; Use index number to pull out the ; target drawing's SHEET value. This is ; done by first finding the index ; number is a list of index numbers ; (nth 1 GBL_wd_prj_ixlst), and then ; using the position in this list to ; pull SHEET number from a parallel list ; of sheet numbers in (nth 3 GBL_wd_prj_ixlst) (if (setq x (member ix (nth 1 GBL_wd_prj_ixlst))) ; found relative position of next ; dwg's data in parallel lists (setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x)) (nth 3 GBL_wd_prj_ixlst))) ) ) ) sheet ; return "" or next SHEET value ) ; ---- (defun c:prevsheet ( / ix sheet_lst x sheet) ; Return the WD_M block's SHEET attribute value ; of "next" dwg in project. This embedded in a ; global called GBL_wd_prj_ixlst. If global ; doesn't exist, make call to refresh it. (if (not GBL_wd_prj_ixlst) (setq GBL_wd_prj_ixlst (c:ace_proj_data nil))) ; GBL_wd_cip holds index of current drawing in ; the overall project drawing list. (setq ix GBL_wd_cip) ; index ; If index not defined for current drawing, then ; trigger a refresh of the global. (if (OR (not ix)(= ix 0)) (setq ix (c:wd_is_cur_dwg_in_proj)) ) (setq sheet "") (if (> ix 1) (progn ; current drawing is in the project, ; increment to next dwg in list (setq ix (1- ix)) ; decrement index ; Get list of SHEET numbers assigned to ; all dwgs in the project dwg set. (setq sheet_lst (nth 3 GBL_wd_prj_ixlst)) ; Use index number to pull out the ; target drawing's SHEET value. This is ; done by first finding the index ; number is a list of index numbers ; (nth 1 GBL_wd_prj_ixlst), and then ; using the position in this list to ; pull SHEET number from a parallel list ; of sheet numbers in (nth 3 GBL_wd_prj_ixlst) (if (setq x (member ix (nth 1 GBL_wd_prj_ixlst))) ; found relative position of next ; dwg's data in parallel lists (setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x)) (nth 3 GBL_wd_prj_ixlst))) ) ) ) sheet ; return "" or previous SHEET value ) (princ)