Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PLOTSETUP.lsp

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
2349 Views, 7 Replies

PLOTSETUP.lsp

This routing changes all tabs for printing to a specific printer. But now it does not work on Autocad Electric 2014.

 

Cn anyone help..

7 REPLIES 7
Message 2 of 8
hmsilva
in reply to: Anonymous


@Anonymous wrote:

This routing changes all tabs for printing to a specific printer. But now it does not work on Autocad Electric 2014.

 

Cn anyone help..


 

Without seeing the code, is difficult to help...Post the code...

 

"it does not work"

 

Gives some error msg?

If so, what is the error msg?

 

Henrique

EESignature

Message 3 of 8
Anonymous
in reply to: Anonymous

heres the routing
?
No errors but it does not complete the routing and does not change the printer designation to a different one
?
; Jason Piercey . May 16th, 2003
; assign a pagesetup to a layout
; [layout] - string, layout name
; [setup]? - string, pagesetup to assign
; return: T or nil
(defun putPagesetup (layout setup / layouts plots)
?(defun item-p (collection item)
? (if
?? (not
??? (vl-catch-all-error-p
???? (vl-catch-all-apply
????? '(lambda () (setq item (vla-item collection item))))))
?? item
?? )
? )
?(and
? (or *acad* (setq *acad* (vlax-get-acad-object)))
? (or *doc*? (setq *doc*? (vla-get-activedocument *acad*)))
? (setq layouts (vla-get-layouts *doc*))
? (setq plots?? (vla-get-plotconfigurations *doc*))
? (setq layout (item-p layouts layout))
? (setq setup (item-p plots setup))
? (not (vla-copyfrom layout setup))
? )
?)
(defun massoc (key alist / x nlist)
?(foreach x alist
? (if (eq key (car x))
?? (setq nlist (cons (cdr x) nlist))
?? )
? )
?(reverse nlist)
?)

; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
?(massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings"))
?)
; Jason Piercey . May 19th, 2003
; assign pagesetup to layout(s)
; LIMITED testing
; written for Shawn McDonald
(defun c:psetup (/ lst page res)
?(setq lst (mapcar 'strcase (getPagesetups)))
?(while (not page)
? (setq page (strcase (getstring "\nspecify pagesetup to apply: ")))
? (if (or (= "" page) (not (member page lst)))
?? (progn (princ "\npagesetup not found") (setq page nil))
?? )
? )
?(initget "All Current")
?(if
? (not
?? (setq
??? res
??? (getkword
???? "\n[All/Current]apply pagesestup to which layout(s) : ")))
? (setq res "All")
? )
?(if (= "All" res)
? (foreach x (layoutlist) (putPagesetup x page))
? (putPagesetup (getvar "ctab") page)
? )
?(princ "\nFinished")
?(princ)
?)
Message 4 of 8
Anonymous
in reply to: hmsilva

; Jason Piercey . May 16th, 2003
; assign a pagesetup to a layout
; [layout] - string, layout name
; [setup]  - string, pagesetup to assign
; return: T or nil
(defun putPagesetup (layout setup / layouts plots)
 (defun item-p (collection item)
  (if
   (not
    (vl-catch-all-error-p
     (vl-catch-all-apply
      '(lambda () (setq item (vla-item collection item))))))
   item
   )
  )
 (and
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *doc*  (setq *doc*  (vla-get-activedocument *acad*)))
  (setq layouts (vla-get-layouts *doc*))
  (setq plots   (vla-get-plotconfigurations *doc*))
  (setq layout (item-p layouts layout))
  (setq setup (item-p plots setup))
  (not (vla-copyfrom layout setup))
  )
 )

(defun massoc (key alist / x nlist)
 (foreach x alist
  (if (eq key (car x))
   (setq nlist (cons (cdr x) nlist))
   )
  )
 (reverse nlist)
 )


; Return: list of all pagesetups defined in the current drawing or nil
(defun getPagesetups ()
 (massoc 3 (dictsearch (namedobjdict) "Acad_PlotSettings"))
 )

; Jason Piercey . May 19th, 2003
; assign pagesetup to layout(s)
; LIMITED testing
; written for Shawn McDonald
(defun c:psetup (/ lst page res)
 (setq lst (mapcar 'strcase (getPagesetups)))
 (while (not page)
  (setq page (strcase (getstring "\nspecify pagesetup to apply: ")))
  (if (or (= "" page) (not (member page lst)))
   (progn (princ "\npagesetup not found") (setq page nil))
   )
  )

 (initget "All Current")
 (if
  (not
   (setq
    res
    (getkword
     "\n[All/Current]apply pagesestup to which layout(s) <all>: ")))
  (setq res "All")
  )

 (if (= "All" res)
  (foreach x (layoutlist) (putPagesetup x page))
  (putPagesetup (getvar "ctab") page)
  )
 (princ "\nFinished")
 (princ)
 )

Message 5 of 8
hmsilva
in reply to: Anonymous


@Anonymous wrote:
heres the routing
?
No errors but it does not complete the routing and does not change the printer designation to a different one
?

Tested, and everything as it should...

In the  tests I made, I didn't found errors when applying a page setup, to all layouts, ctb, plotter, paper, everything was correctly applied.

I can't replicate your error, maybe someone else can.

 

Henrique

EESignature

Message 6 of 8
Anonymous
in reply to: hmsilva

Are you in R14 ??

Message 7 of 8
hmsilva
in reply to: Anonymous


@Anonymous wrote:

Are you in R14 ??


My bad! Smiley Embarassed

Only later on I will be able to test in 2014...

 

Henrique

EESignature

Message 8 of 8
hmsilva
in reply to: Anonymous


@Anonymous wrote:

Are you in R14 ??


Tested in 2014, and everything ok!

Note that was not tested in Autocad Electrical, maybe someone with Autocad Electrical 2014, can test the code...

 

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost