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.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner