Wednesday, July 23, 2008

Update plotter devices in AutoCAD drawings

Ever wanted to automate updating plotter device settings (printer/plotter name) on existing drawings and make sure that it updates both model space and all layouts. Here is a CAD Manager trick.

I made a modification of the PlotDevicesFunctions.lsp code.

Just change Device old.pc3 and Device.pc3 to match your needs.

Call (updateAllTabs) and it will update any tab that needs to be updated.

(vl-load-com)

(defun ActLay ()
  (vla-get-ActiveLayout
    (vla-get-activedocument
      (vlax-get-acad-object)
    )
  )
)

(defun GetActivePlotDevice ()
  (vla-get-ConfigName
    (ActLay)
  )
)

(defun PutActivePlotDevice (PlotDeviceName)
  (vla-put-ConfigName
    (ActLay)
    PlotDeviceName
  )
)

(defun updatePlotDevice ()
  (if
    (=
      (GetActivePlotDevice)
      "Device old.pc3"
    )
     (PutActivePlotDevice "Device.pc3")
  )
)

(defun updateAllTabs ()
  (setvar "CTAB" "Model")
  (updatePlotDevice)
  (foreach LAYOUT (layoutlist)
    (setvar "CTAB" LAYOUT)
    (updatePlotDevice)
  )
)

This can be added to acaddoc.lsp so it is run on a drawing as soon as it is opened or AutoCAD Automation Tools or SmartPurger can be used to script through a bunch of drawings.

2 comments:

  1. When you use this lisp routine on layouts with different sizes, one of the sizes of the bachground layout is used for each layout. Is there a way to avoid this?

    ReplyDelete
  2. Hi Richard,
    It's probably possible to solve somehow. If interested to pay for the work needed contact me at info@jtbworld.com.

    ReplyDelete

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.