Glen Smith Posted October 12, 2012 Share Posted October 12, 2012 I'm trying to modify some code I found here: http://www.cadtutor.net/forum/showthread.php?62876-Can-you-change-multiple-sheet-plot-settings-at-the-same-time&highlight=plot+multiple+layouts to my purposes, which is to plot all the layouts in the current drawing to my named printer. Without the setvar line, I get the right number of copies, but they are all of the same layout (whichever one I execute the lisp from). Adding the setvar line errors out the lisp. (The actual plot command was commented out so I don't keep wasting paper while debugging this code.) (defun c:qplotall (); Konica Bsize mostly mono all layouts. (vlax-for x (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-acad-object) ) ) (command "setvar" "ctab" x) ; (command "-plot" "y" "" "KONICA monochrome" "11x17" "Inches" "landscape" "no" "Extents" "Fit" "Center" "y" "MOSTLY MONO LIGHT" "y" "y" "No" "No" "No" "No" "y") ) ) Can anyone shed some light for me? Thanks, Glen Quote Link to comment Share on other sites More sharing options...
Bill Tillman Posted October 12, 2012 Share Posted October 12, 2012 I just started working on a similar task to print to PDF files. Have you setup a watch window to see what value 'x' is actually being set to as it iterates through the loop. Quote Link to comment Share on other sites More sharing options...
MSasu Posted October 12, 2012 Share Posted October 12, 2012 There is the LAYOUTLIST function that return a list with the names of available layouts: (setq layoutOld (getvar "CTAB")) (foreach layoutCrt (layoutlist) (setvar "CTAB" layoutCrt) ;your action here ) (setvar "CTAB" layoutOld) 1 Quote Link to comment Share on other sites More sharing options...
MSasu Posted October 12, 2012 Share Posted October 12, 2012 To fix your original code - you need to retrieve the name of the layout from the VLA object; check the VLA-GET-NAME for this. Don't miss the fact that VLA-GET-LAYOUTS function return a list that contains the Model tab, too; you may want to filter it out . (vlax-for x (vla-get-Layouts (vla-get-ActiveDocument (vlax-get-acad-object) ) ) [b] [color=red](setq x (vla-get-name x))[/color][/b] [color=red](if (/= x "Model") (progn[/color] (command "setvar" "ctab" x) ;(command "-plot" "y" "" "KONICA monochrome" "11x17" "Inches" "landscape" "no" "Extents" "Fit" "Center" "y" "MOSTLY MONO LIGHT" "y" "y" "No" "No" "No" "No" "y") [color=red]) )[/color] ) Quote Link to comment Share on other sites More sharing options...
Glen Smith Posted October 12, 2012 Author Share Posted October 12, 2012 And... that satisfies my needs! Many thanks Mircea. I did have a watch set on x, I could see that it was not a clear text of the layout name, but I had no idea how to get from # So many things to do, actually learning LISP always seems to take a back seat to getting THIS project done. Glen Quote Link to comment Share on other sites More sharing options...
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.