woodman78 Posted April 19, 2012 Share Posted April 19, 2012 hi all, I have a plot routine that I use because it updates all fields and purges the drawing before plotting. Can I modify this so that it updates fields throughout the drawing ( as in all layouts) and then plots all layouts. ;Based on PageSetups from Alan J. Thompson (defun c:A1 () (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 (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) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 20, 2012 Share Posted April 20, 2012 At the point in your code of "updatefieldall" why not put it in a loop that changes to all layout tabs before running pretty sure posted example code yesterday Yep http://www.cadtutor.net/forum/showthread.php?67943-Need-help-with-this-lisp see last comment by Remark also Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 20, 2012 Author 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...
MSasu Posted April 20, 2012 Share Posted April 20, 2012 (edited) At first glance, seems that you need a closing paranthesis for DEFUN; also you will need an indexer for page counter. If you are looking to prevent the Model tab from beeing printed, then should place the printing actions inside the IF test. [color=magenta]...[/color] (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) [color=red] ) ;<- IF[/color] [color=red] ) ;<- PROGN[/color] ;(princ) [color=red] (setq x (1+ x)) [/color] ) [color=red]) ;<- DEFUN[/color] Edited April 23, 2012 by MSasu extra right paranthesis Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 20, 2012 Share Posted April 20, 2012 If you don't mind, I will make another two comments: (1) try to indent the code while you write it, this way will be easier for you to match the parenthesis and statements enclosing; (2) in VL editor, when place the cursor outside a parenthesis and press + "[" or + "]" the cursor will move to the pair one, if don't move, then that parenthesis don't have a pair. Quote Link to comment Share on other sites More sharing options...
pBe Posted April 20, 2012 Share Posted April 20, 2012 Déjà vu .... -->> layoutlist Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 23, 2012 Share Posted April 23, 2012 Freebie for any one interested a bracket checker (defun c:chkbrk (/ opf bkt chekdfile rdctl wkfile currentln wln ltr ncln) (setvar "cmdecho" 0) (prompt "\nlook at end of line") ;(setq chekdfile (getstring "enter name of file :")) (SETQ chekdfile (getfiled "Enter file name:" " " "LSP" 4)) (setq opf (open chekdfile "r")) (setq bkt 0) (setq blkl 0) (setq rdctl 1) (setq wkfile (open "c:\\acadtemp\\wow.lsp" "w")) (setq currentln "a") (while (/= blkl 6) (setq currentln (read-line opf)) (if (= currentln nil)(setq currentln "")) (if (= currentln "")(setq blkl (+ 1 blkl))(setq blkl 1)) (setq wln currentln) (while (/= wln "") (setq ltr (substr wln 1 1)) (setq wln (substr wln 2)) (cond ((= (ascii ltr) 34) (if (= rdctl 0)(setq rdctl 1)(setq rdctl 0))) ((and (= ltr "(")(= rdctl 1))(setq bkt (+ bkt 1))) ((and (= ltr ")")(= rdctl 1))(setq bkt (- bkt 1))) ((and (= ltr ";")(= rdctl 1))(setq wln "")) ;(t (prompt ltr)) ) ) (setq ncln (strcat currentln ";" (itoa bkt) (princ (itoa bkt)) (if (= rdctl 0) "string open" ""))) (if (/= currentln "")(write-line ncln wkfile)) ) (close wkfile) (close opf) (prompt (strcat "open brakets= " (itoa bkt) ".")) ) (setq ang1 nil pt1 nil pt2 nil pt3 nil pt4 nil pt5 nil) (princ) Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 23, 2012 Author Share Posted April 23, 2012 Thanks Mircea but that doesn't seem to work either. I get an error " ; error: extra right paren on input" on running appload. Quote Link to comment Share on other sites More sharing options...
MSasu Posted April 23, 2012 Share Posted April 23, 2012 Did you notticed that is only an excerpt from your code? But there was an extra right paranthesis, I have fixed that now. Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 24, 2012 Author Share Posted April 24, 2012 Mircea, I am still getting this error. Am i missing something? I copied the last lines of your updated code and replaced my code with them but when i go appload I get this. ; error: bad argument type: numberp: nil Quote Link to comment Share on other sites More sharing options...
woodman78 Posted April 24, 2012 Author Share Posted April 24, 2012 Oh yeah, I got it now. Thanks. 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.