asos2000 Posted March 26, 2012 Share Posted March 26, 2012 Some times comes a file has all the project drawings. All frames on one layout (as attached) So I wrote this simple lisp (defun c:Mltiplt () (alert "make changes in next window \nthen click on Apply to Layout \nthen click on Canel") [color="red"](command "_plot")[/color] (while t (setq p1 (getpoint)) (setq p2 (getpoint)) (command "-plot" "y" "" "" "" "" "" "" "w" p1 p2 "" "" "" "" "" "" "" "" "") ) (princ) ) I am facing 2 problems - How to open Plotting window This error message comes Command: (command "_plot") nil - Could I change the layout in WHILE Loop? Thanks for help Quote Link to comment Share on other sites More sharing options...
jammie Posted March 26, 2012 Share Posted March 26, 2012 Hi, To open the AutoCAD plot window add (initdia) directly before (command "_plot"). This allows you to override the command line by launching the plot dialog box (initdia) (command "_plot") To control the loop I'd change the (while t to (while (and (setq p1 (getpoint)) (setq p2 (getpoint)) ...) Quote Link to comment Share on other sites More sharing options...
asos2000 Posted March 26, 2012 Author Share Posted March 26, 2012 (initdia) (command "_plot") Working perfect But when Plotting dialog box launched and select a window in plot area the Function cancelled Command: MLTIPLT Invalid window specification. ; error: Function cancelled Specify first corner: *Cancel* *Invalid* (while t ... [/code] Did not solve the problem Thanks for your help Quote Link to comment Share on other sites More sharing options...
pBe Posted March 26, 2012 Share Posted March 26, 2012 i never had to reset my initdia And i use ".-plot", repeat and vla-getboundingbox for loop (setq ss (ssget "x" (list '(0 . "INSERT")(cons 2 [color=blue][b]Blkname[/b][/color])(cons 410 (getvar 'CTAB))))) (repeat (setq i (sslength ss)) (vla-getboundingbox (setq blockobject (vlax-ename->vla-object (ssname ss (setq i (1- i)))) ) 'lowerleft 'upperright ) (command [color=blue][b]".-plot"[/b][/color] "Y" "" "pltDevice" "ANSI B (11.00 x 17.00 Inches)" "Inches" "Landscape" "N" "Window" (trans (vlax-safearray->list lowerleft) 0 1) (trans (vlax-safearray->list upperright) 0 1) "Fit" "Center" "Y" "pltStyles" "Y" "Y" "N" "N" "N" "N" "Y") Hope this helps Quote Link to comment Share on other sites More sharing options...
jammie Posted March 26, 2012 Share Posted March 26, 2012 Okay I see whats happening. At first I thought it could be something to do with the dialogFlag which you can add to the (initdia ) but its not the case. When you launch the plot dialog box, and press the select window button, you actually proceed to the loop instead of picking the points as per the plot window. Adding a double pause as shown seems to work but you might want to test this (defun c:Mltiplt () (alert "make changes in next window \nthen click on Apply to Layout \nthen click on Canel") (INITDIA) (command "_plot" pause pause ) (while (AND (setq p1 (getpoint "\nBottom left")) (setq p2 (getpoint "\nUpper right")) ) (command "-plot" "y" "" "" "" "" "" "" "w" p1 p2 "" "" "" "" "" "" "" "" "") ) (princ) ) Quote Link to comment Share on other sites More sharing options...
pBe Posted March 26, 2012 Share Posted March 26, 2012 Oh.. now I see what the OP is trying to do. fire up the Plot Dialog to set the parameters on the first window selection. and use "-plot" afterwards. My bad. Clever guys. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted March 27, 2012 Share Posted March 27, 2012 I am more like Pbe plot all titleblocks automatically or pick the ones you want or pick smaller title and do all, or just one could be all sorts of combo's ? Maybe pick 1 title then use selection set rather than "X" change plot scale if required. I just say plot all and done I use the title block insertion point and work out the plot "window" co-ords as I know the title block sheet size, I have 4 options A3 A1 tiff PDF. Why not ignore default plot window all together and just ask questions with as default Quote Link to comment Share on other sites More sharing options...
asos2000 Posted March 28, 2012 Author Share Posted March 28, 2012 Thanks for help Quote Link to comment Share on other sites More sharing options...
asos2000 Posted April 18, 2012 Author Share Posted April 18, 2012 Is there a way to keep the lisp working while selecting another layout? Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 19, 2012 Share Posted April 19, 2012 Yes if you make an outside loop that is your layout tabs then it will go to the next one and run again. (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plotabs (cons (vla-get-name lay) plotabs)) ) (setq plottablist (acad_strlsort plotabs)) (setq len (length plottablist)) (setq x 0) (repeat len (setq name (nth x plottablist)) (princ name) (if (/= name "Model") (progn (setvar "ctab" name) your code ) Quote Link to comment Share on other sites More sharing options...
pBe Posted April 19, 2012 Share Posted April 19, 2012 (layoutlist) will give you the layout names excluding "MODEL" and its already sorted Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 20, 2012 Share Posted April 20, 2012 Thanks Bigal, This is what I have but I get ; error: malformed list on input ;Based on PageSetups from Alan J. Thompson (defun c:A1_All () (PlotReactorOFF) (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") (progn (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A1") (while (wcmatch (getvar "cmdnames") "*PSETUPIN*") (command "_yes") ) ;_ while T ) ;_ progn ) ;_ if (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lay (vla-get-Layouts doc) (setq plotabs (cons (vla-get-name lay) plotabs)) ) (setq plottablist (acad_strlsort plotabs)) (setq len (length plottablist)) (setq x 0) (repeat len (setq name (nth x plottablist)) (princ name) (if (/= name "Model") (progn (setvar "ctab" name) ) ) (command "-plot" "n" "" "A1" "" "n" "y" "n") (command "_-purge" "a" "*" "N") (setq CCC_Sheet "A1") (command "updatefield" "all" "") (command "regenall") (command "_zoom" "e") (initdia) (command "._plot") (PlotReactorON) ;(princ) ) Can you help? Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 20, 2012 Share Posted April 20, 2012 Sorry I replied to the wrong thread. 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.