LosGirk Posted May 14, 2014 Posted May 14, 2014 Hello, We just installed our first seat of AutoCAD15 and are in the process of testing everything and our plot routine gets this error: "Error: Commands may not be nested more than 4 deep" Has anyone ever heard of this? Thanks Quote
Tharwat Posted May 14, 2014 Posted May 14, 2014 Just shut in the dark : If you have a command call within your routine , try to replace it with vl-cmdf and let me know . Quote
MSasu Posted May 15, 2014 Posted May 15, 2014 I would guess that there are some command calls that occurs not on command prompt, but rather on the prompt of a previous, un-finished command. This may come from a command that had its prompt dialog modificatioed in release 2015 (less queries). May track that down by listing the CMDACTIVE system variable in your code. Quote
Tharwat Posted May 15, 2014 Posted May 15, 2014 I have seen a post sometime a go ( can't remember where that was ) by replacing a command with command-s would work in CAD 2015 , but also still a guess as long as the OP did not post any codes . Quote
LosGirk Posted May 15, 2014 Author Posted May 15, 2014 Sorry for the delay guys, thanks for your input, it worked for the plotroutine, but not the plotfolder subroutine within. Here's the code, it's lengthy so It's a zip. Thank you. PlotRoutine.lsp PlotRoutine.dcl Quote
LosGirk Posted June 2, 2014 Author Posted June 2, 2014 Can someone help me with this please? This problem has arisen with our upgrade to 2015. I've searched many forums and they all say to seek help on defining external commands. This code was inherited from Terry Miller, and I'm not sure how external commands apply to it... Thanks (defun PlotRoutine ( ) ; (fixlayers) (vl-load-com) (if (= (strcase (getvar "CLAYER")) "0-VIEW-1") (LayerOn "0") );if (savevars (list "CTAB" "CLAYER" "OSMODE")) (setvar "OSMODE" 0) (if P-R (UserInfo) (progn (UserInfo) (if (not (or (= (nth 1 *UserInfo@) "All Layouts")(= (nth 1 *UserInfo@) "Model")(= (nth 1 *UserInfo@) "E-Sheets"))) (setq *UserInfo@ (Change_nth 1 "All Layouts" *UserInfo@)) );if );progn );if (setq Layouts$ (nth 1 *UserInfo@) Copies# (atoi (nth 2 *UserInfo@)) P-Size$ (nth 3 *UserInfo@) PlotStyle$ (nth 4 *UserInfo@) );setq (if (and P-R (= Layouts$ "Model")(= P-Size$ "Varies")) (progn (setq Ctab (getvar "CTAB")) (vl-cmdf "LAYOUT" "S" "Model") (setq P-Size$ (GetBorderSize)) );progn );if (if (= (getvar "CTAB") "Model") (vl-cmdf "LAYOUT" "S" (nth 0 (LayoutList))) );if (setq PlotStyle$ (cond ( (= PlotStyle$ "PDF") "Adobe PDF") ( (= PlotStyle$ "Draft") "GEN2000i.ctb") ( (= PlotStyle$ "Final") "FWT2000i.ctb") );cond );setq (setq PaperSize$ (if (= PlotStyle$ "Adobe PDF") (cond ( (= P-Size$ "A-Size") "Letter") ( (= P-Size$ "B-Size") "11 x 17") ( (= P-Size$ "C-Size") "ARCH C") ( (= P-Size$ "D-Size") "ARCH D") ( (= P-Size$ "E-Size") "ARCH E") ( (= P-Size$ "BOM") "11 x 17") );cond (cond ( (= P-Size$ "A-Size") "Letter (8.5\" x 11\")") ( (= P-Size$ "B-Size") "11\" x 17\"") ( (= P-Size$ "C-Size") "18\" x 24\"") ( (= P-Size$ "D-Size") "24\" x 36\"") ( (= P-Size$ "E-Size") "36\" x 48\"") ( (= P-Size$ "BOM") "11\" x 17\"") );cond );if );setq (setq Printer$ "RICOH_Aficio_SP_8200DN_PCL6 - DFTL");default printer (foreach Item *UserNames@ (if (= (getvar "LOGINNAME") (nth 1 Item)) (setq Printer$ (nth 4 Item)) );if );foreach (cond ( (or (= P-Size$ "A-Size")(= P-Size$ "B-Size")(= P-Size$ "BOM")) (setq LayoutOrder@ (LayoutList)) (if (= (getvar "Loginname") "Bmills") (if (= P-Size$ "A-Size") (setq Plotter$ "HP LaserJet 6MP") (setq Plotter$ "\\\\KENPRINT01\\HP_5Si_MX_Engineering") );if (setq Plotter$ Printer$) );if );case ( (or (= P-Size$ "C-Size")(= P-Size$ "D-Size")(= P-Size$ "E-Size")) ;BKW 2010-02-24 New plotter does not need list reversed ;(setq LayoutOrder@ (reverse (LayoutList))) (setq LayoutOrder@ (LayoutList)) (setq Plotter$ "RICOH_Aficio_W5100") );case );cond ;(Test "Plotter$" Plotter$) ;Print to autocad windows for debug (setq Offset$ (cond ( (= P-Size$ "C-Size") "0.09375,0.0625") ( (= P-Size$ "D-Size") "0.1875,-0.03125");was 0.1875,0 ( (= P-Size$ "E-Size") "0,0") (t "0,0") );cond );setq ;----------------------------------------------------------------------------- ; Plot Layouts ;----------------------------------------------------------------------------- (if (not (tblsearch "layer" "Defpoints")) (LayerOn "Defpoints") );if (if (tblsearch "layer" "O-VIEW-1") (LayerOn "O-VIEW-1") );if (cond ( (= P-Size$ "Varies") (PlotVaries) );case ( (= P-Size$ "Up to B") (PlotUptoB) );case ( (and (= P-Size$ "BOM")(= Layouts$ "All Layouts")) (repeat Copies# (foreach Layout$ LayoutOrder@ (if (/= (strcase (substr Layout$ 1 1)) "F") (progn (vl-cmdf "LAYOUT" "S" Layout$) (if (= (GetBorderSize) "C-Size") (setq LL-Pt "12.3583,0.3749" UR-Pt "23.3761,17.6258") (setq LL-Pt "20.241,0.0" UR-Pt "35.25,23.5") );if (if (> (sslength (ssget "x" (list (cons 410 Layout$)))) 1) (progn (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layout$ PlotStyle$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "N" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layout$ Plotter$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "N" "Y") ;(vl-cmdf "-PLOT" "Y" Plotter$ Layout$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "N" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );progn );if );foreach );progn );if );repeat );case ( (and (= P-Size$ "BOM")(= Layouts$ "E-Sheets")) (repeat Copies# (foreach Layout$ LayoutOrder@ (if (= (strcase (substr Layout$ 1 1)) "E") (progn (vl-cmdf "LAYOUT" "S" Layout$) (if (= (GetBorderSize) "C-Size") (setq LL-Pt "12.3583,0.3749" UR-Pt "23.3761,17.6258") (setq LL-Pt "20.241,0.0" UR-Pt "35.25,23.5") );if (if (> (sslength (ssget "x" (list (cons 410 Layout$)))) 1) (progn (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layout$ PlotStyle$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "N" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layout$ Plotter$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "N" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );progn );if );foreach );progn );if );repeat );case ( (= P-Size$ "BOM") (vl-cmdf "LAYOUT" "S" Layouts$) (repeat Copies# (if (= (GetBorderSize) "C-Size") (setq LL-Pt "12.3583,0.3749" UR-Pt "23.3761,17.6258") (setq LL-Pt "20.241,0.0" UR-Pt "35.25,23.5") );if (if (> (sslength (ssget "x" (list (cons 410 Layouts$)))) 1) (progn (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layouts$ PlotStyle$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "N" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layouts$ Plotter$ PaperSize$ "I" "P" "N" "W" LL-Pt UR-Pt "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "N" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );progn );if );repeat );case ( (= Layouts$ "All Layouts") (repeat Copies# (foreach Layout$ LayoutOrder@ (vl-cmdf "LAYOUT" "SET" Layout$) (setq Orientation$ (GetOrientation)) (setq DotList@ (cons 410 Layout$)) (if (> (sslength (ssget "x" (list (cons 410 Layout$)))) 1) (progn (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layout$ PlotStyle$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "Y" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layout$ Plotter$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "Y" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );progn );if );foreach );repeat );case (= Layouts$ "All Layouts") ( (= Layouts$ "E-Sheets") (repeat Copies# (foreach Layout$ LayoutOrder@ (vl-cmdf "LAYOUT" "SET" Layout$) (if (or (= (substr (getvar "CTAB") 1 1) "E") (= (substr (getvar "CTAB") 5 1) "E")) (progn (setq Orientation$ (GetOrientation)) (setq DotList@ (cons 410 Layout$)) (if (> (sslength (ssget "x" (list (cons 410 Layout$)))) 1) (progn (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layout$ PlotStyle$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "Y" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layout$ Plotter$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "Y" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );progn );if );progn );if );foreach );repeat );case (= Layouts$ "E-Sheets") ( (= Layouts$ "Model") (vl-cmdf "LAYOUT" "SET" "Model") (setq Orientation$ (GetOrientation)) (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (repeat Copies# (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layouts$ PlotStyle$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layouts$ Plotter$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "Y") );if );repeat (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );case (t (vl-cmdf "LAYOUT" "SET" Layouts$) (setq Orientation$ (GetOrientation)) (if (> (sslength (ssget "x" (list (cons 410 Layouts$)))) 1) (repeat Copies# (c:UPDTB)(Defpoints) (setq Pt1 (polar (getvar "VIEWCTR") (* pi 0.5)(/ (getvar "VIEWSIZE") 2.0))) (setq Pt2 (polar Pt1 (* pi 1.5) (getvar "VIEWSIZE"))) (if (= PlotStyle$ "Adobe PDF") (progn (vl-cmdf "-PLOT" "Y" Layouts$ PlotStyle$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" "GEN2000i.ctb" "Y" "N" "N" "N" "N" "Y" "Y") (MovePdf) );progn (vl-cmdf "-PLOT" "Y" Layouts$ Plotter$ PaperSize$ "I" Orientation$ Flip$ "E" "F" Offset$ "Y" PlotStyle$ "Y" "N" "N" "N" "N" "Y" "Y") );if (if P-R (vl-cmdf "ZOOM" "W" Pt1 Pt2) );if );repeat );if );case );cond (Defpoints) (ResetVars) (princ); (vl-cmdf "qsave") );defun PlotRoutine Quote
Recommended Posts
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.