+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 19 of 19
  1. #11
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    Registered forum members do not see this ad.

    Ok, here is where I am at the moment. I have had to abandon using the "dwg to pdf" and it is for asthetic reasons more than anything. The lisp worked alright but see the image and the poor quality of the pdf using the "dwg to pdf".
    rps20120518_094748_902.jpg
    To be honest it wouldn't cut it around our place. We have been using "Cutepdf" for many years now with very good results. So I am back to this for batch plotting pdf's.


    Code:
    ;Based on PageSetups from Alan J. Thompson
    (defun c:A3_all_pdf ()
    (PlotReactorOFF)
      (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
        (progn
          (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A3")
          (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
            (command "_yes")
    (princ x)(setq x (+ x 1))
          ) ;_ 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" "" "A3-pdf" "" "n" "y" "y")
        (command "_-purge" "a" "*" "N")
        (setq CCC_Sheet "A3")
        (command "updatefield" "all" "")
        (command "regenall")
        (command "_zoom" "e")
        (initdia)
        (command "._plot")
       ) ;<- IF
      )  ;<- PROGN
      ;(princ)
      (setq x (1+ x))
     )
        (PlotReactorON)
    )    ;<- DEFUN
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    (defun PlotReactorON nil
      (vl-load-com)
      ;; © Lee Mac 2010
    
      (  (lambda ( data foo / react )
           (if (setq react
                 (vl-some
                   (function
                     (lambda ( reactor )
                       (if (eq data (vlr-data reactor)) reactor)
                     )
                   )
                   (cdar
                     (vlr-reactors :vlr-command-reactor)
                   )
                 )
               )
             (if (not (vlr-added-p react))
               (vlr-add react)
             )
             (setq react
               (vlr-command-reactor data
                 (list
                   (cons :vlr-commandwillstart foo)
                 )
               )
             )
           )
           (if (vlr-added-p react)
             (princ "\n** Reactor Activated **")
             (princ "\n** Reactor Failed to Activate **")
           )
           react
         )
        "Plot-Reactor"
        'Plot-Callback
      )
    
      (princ)
    )
    
    (defun PlotReactorOFF nil
      (vl-load-com)
      ;; © Lee Mac 2010
    
      (  (lambda ( data foo / react )
           (if (setq react
                 (vl-some
                   (function
                     (lambda ( reactor )
                       (if (eq data (vlr-data reactor)) reactor)
                     )
                   )
                   (cdar
                     (vlr-reactors :vlr-command-reactor)
                   )
                 )
               )
             (if (vlr-added-p react)
               (vlr-remove react)
             )
           )
           (if (or (not react) (not (vlr-added-p react)))
             (princ "\n** Reactor Deactivated **")
             (princ "\n** Reactor Failed to Deactivate **")
           )
           react
         )
        "Plot-Reactor"
        'Plot-Callback
      )
      
      (princ)
    )
    
    (defun Plot-Callback ( reactor arguments )
      (vl-load-com)
    
      (if (eq (strcase (car arguments)) "PLOT")
        (LM:Popup "Warning" 64 "Gotcha!!!   Please use the NNRDO Plot tools when plotting standard layouts!!")
      )
    
      (princ)
    )
    
    (defun LM:Popup ( title flags msg / WSHShell result )
      ;; © Lee Mac 2010
      (setq WSHShell (vlax-create-object "WScript.Shell"))
      (setq result   (vlax-invoke WSHShell 'Popup msg 0 title flags))
      (vlax-release-object WSHShell)
      
      result
    )
    The problem I am having with this is that it runs fine and launches the curepdf file save as window. And the autocad plot window reloads. I click "save" on the cutepdf window, which is not a big issue. Then I click plot on the autocad window but it plots the same layout. It can run like that for 5 or 6 times and eventually change the layout.

    This is the cutepdf save window
    plot pdf.jpg
    I would appreciate it if anyone had any ideas how to get around this. Thanks.

  2. #12
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    I tried to incorporate a pause into the plot command but after the first plot it just stopped.

  3. #13
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,090

    Default

    Use (layoutlist) for layout names
    instead of repeat use foreach
    (foreach name (layoutlist) '<-- this wil eliminate the variables name and x
    .....
    )
    and DO NOT forget to localize plotabs variable.

    This line:
    Code:
     
    (vlax-for lay (vla-get-Layouts doc)
      (setq plotabs (cons (vla-get-name lay) plotabs))
    )
    If you dont localize the variable the list will continue to "grow" the next time you use the command

    Code:
     (defun c:A3_all_pdf ( / PlotReactorOFF doc lay plotabs plottablist ....)
    That is why i suggested on your previous post to use (layoutlist) as this will give you a list without "Model" and its already sorted and no need to assign to a variable.

    HTH

    Cheers

    BTW: whats the use of CCC_Sheet variable?

  4. #14
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    Thanks pBe, I tried to incorporate your comments and this is what I have but what I have doesn't run. I have been looking and can't quite get my head around what I need to remove or keep.

    Code:
    ;Based on PageSetups from Alan J. Thompson
     (defun c:A3_all_pdf ( / PlotReactorOFF doc lay plotabs plottablist name)
    (PlotReactorOFF)
      (if (findfile "T:/Drawing Tools/Templates/CCC2009.dwt")
        (progn
          (command "_.psetupin" (findfile "T:/Drawing Tools/Templates/CCC2009.dwt") "A3")
          (while (wcmatch (getvar "cmdnames") "*PSETUPIN*")
            (command "_yes")
    (princ x)(setq x (+ x 1))
          ) ;_ 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)
     (foreach name (layoutlist))
      ;(setq name (nth x plottablist))
      (princ name)
      (if (/= name "Model")
       (progn
        (setvar "ctab" name)
    (command "-plot" "n" "" "A3-pdf" "" "n" "y" "y")
        (command "_-purge" "a" "*" "N")
        (command "updatefield" "all" "")
        (command "regenall")
        (command "_zoom" "e")
        (initdia)
        (command "._plot")
       ) ;<- IF
      )  ;<- PROGN
      ;(princ)
    ; (setq x (1+ x))
     )
        (PlotReactorON)
    )    ;<- DEFUN
    What have I missed?


    CCC_Sheet was an overhang from an earlier version and can be removed.

  5. #15
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,090

    Default

    Still not sure what your code is all about but the obvious reason is this.....
    Code:
    (foreach name (layoutlist));<----- loose this one
    Still.. not sure

    Code:
    (defun c:A3_all_pdf ( / PlotReactorOFF tmptfile PlotReactorON)
    (PlotReactorOFF)
    (setvar 'Expert 5)       
      (if (setq tmptfile (findfile "T:/Drawing Tools/Templates/CCC2009.dwt"))
    (progn
          (command  "_.psetupin" tmptfile  "A3")
          (foreach  name  (layoutlist)
                (setvar "ctab" name)
                (command "-plot" "n" "" "A3-pdf" "" "n" "y" "y")
                (command "_-purge" "a" "*" "N")
                (command "updatefield" "all" "")
                (command "regenall")
                (command "_zoom" "e")
                (initdia)
                (command "._plot")
                )
           )                          
          )
     (PlotReactorON)
           (princ)
           )

  6. #16
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    I get this error when I run your revised code pBe:
    Code:
    ; error: no function definition: PLOTREACTOROFF
    The code is supposed to plot all layouts to pdf using cutepdf printer. The problem was it was plotting the same layout over and over again.

  7. #17
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,090

    Default

    (PlotReactorOFF) and (PlotReactorON) came from your post Woodman78

  8. #18
    Super Member
    Computer Details
    woodman78's Computer Details
    Operating System:
    Win XP
    Computer:
    Dell GX280
    Discipline
    Transport
    woodman78's Discipline Details
    Occupation
    Road Design Engineer
    Discipline
    Transport
    Details
    I work in a local authority design office with a staff of 13. We carry out road schemes ranging from overlays up to 2 km long new schemes.
    Using
    Civil 3D 2011
    Join Date
    Jul 2009
    Location
    Ireland
    Posts
    675

    Default

    They are LeeMac's subroutines. I just removed them from the variable list and it works fine now. Thanks pBe.

  9. #19
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,090

    Default

    Registered forum members do not see this ad.

    Glad it helps Woodman78. keep on coding

    Cheers

Similar Threads

  1. it's possible in lisp printing lock or watermark
    By sachindkini in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 28th Aug 2009, 07:59 pm
  2. printing a text file using lisp
    By john_ in forum AutoLISP, Visual LISP & DCL
    Replies: 21
    Last Post: 27th May 2009, 01:52 pm
  3. Printing lisp Stopped Working
    By Absntmind in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 29th Aug 2008, 04:09 pm
  4. For printing lisp
    By nagesh in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 3
    Last Post: 27th Jun 2008, 03:46 pm
  5. custom printing lisp (help please)
    By CAVINCA in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 19th Dec 2007, 04:51 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts