Jump to content

Plot all layouts using custom plot lisp


woodman78

Recommended Posts

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)
)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 by MSasu
extra right paranthesis
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

Thanks Mircea but that doesn't seem to work either. I get an error

 

" ; error: extra right paren on input" 

 

on running appload.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...