Sunday, March 13, 2005

Lisp sample on how to change plot devices

I got a request from a user that wanted to change the plot devices on his drawings. They had been changed from lets say OLD01.PC3 to NEW01.PC3. Here is one way. This code could be run manually on a drawing or when drawings are opened by making use of acaddoc.lsp that loads whenever a drawing opens.
; ChangePlotDevices.lsp
; Sample command CPD on how to change
; plot devices on all layouts
; Changes have to be made to match
; your old and new plot devices
; By Jimmy Bergmark
; Copyright (C) 2005 by JTB World
; 2005-01-13

(defun PutPlotDevice (layout PlotDeviceName)

(defun GetPlotDevice (layout)

(defun changePlotDevice (layout)
    ((= (GetPlotDevice layout) "OLD01.pc3")
      (PutPlotDevice layout "NEW01.pc3"))
    ((= (GetPlotDevice layout) "OLD02.pc3")
      (PutPlotDevice layout "NEW01.pc3"))
    ((= (GetPlotDevice layout) "OLD03.pc3")
      (PutPlotDevice layout "NEW02.pc3"))
    (t (PutPlotDevice layout "None"))

(defun c:CPD ()
  (setq layouts
  (vlax-for layout layouts
    (changePlotDevice layout)

No comments:

Post a Comment

Subscribe to the comments feed

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog
JTB World's website | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.