Assigning a plotter to multiple layouts within a drawing

Assigning a plotter to multiple layouts within a drawing

gak19043
Advocate Advocate
1,165 Views
6 Replies
Message 1 of 7

Assigning a plotter to multiple layouts within a drawing

gak19043
Advocate
Advocate

Hi. I want to simply assign a plotter to multiple layouts in a drawing that has about 14 layouts.

And , yes, I know of the PUBLISH command. However, to use that you need to have all the layouts already assigned to that plotter. Because one of the options in PUBLISH, under "publish to:" is "Plotter named in Page Setup". To use that option you then have to GO BACK, right click on each layout, go to Page Setup, and then assign the plotter there. THEN go back to PUBLISH and then you can use "Plotter named in Page Setup". Sheesh.

 

You'd think that after so many updates and iterations of AutoCAD, that AUTOCAD would've had a way by now to select all layouts, then hit Page setup, then change ALL layouts the plotter you need and away you go.

 

And before you go there, yes,  I've tried using the import page setup option within PUBLISH and that never works. It worked for me several years ago but now it doesn't and believe me I've tried countless times to get that back. FRUSTRATING!!

0 Likes
1,166 Views
6 Replies
Replies (6)
Message 2 of 7

pendean
Community Legend
Community Legend
0 Likes
Message 3 of 7

gak19043
Advocate
Advocate

Thanks. I'm not a LISP guy but will try this. Still flabbergasted that this isn't something that can be achieved with a few right clicks. Would seem like common sense to provide that functionality without programming. Should be put on the annual AutoCAD WISHLIST.

0 Likes
Message 4 of 7

Sea-Haven
Mentor
Mentor

Gave up on publish years ago as we only work with 1 dwg at a time so just made PLOT by lisp, works every single time. 

 

Press the button on the menu and watch the sheets come out.

 

If your using Publish for multiple dwgs ignore me.

 

Happy to provide some plot PDF, A3, A1 printer, lisp, also option based on user name for multi storey building send to correct printer on that floor and so on, yes plot range of layouts. Another have a look at plotting by Maratovich a powerful program.

0 Likes
Message 5 of 7

maratovich
Advisor
Advisor

Maybe this will help you - Revers 

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
0 Likes
Message 6 of 7

Moshe-A
Mentor
Mentor

@gak19043  hi,

 

check this SP2ALL commnad.

 

enjoy

Moshe

 

 

; set printer to all layouts
(defun c:sp2all (/ getPlotDevice# setconfigName ; local functions
		   acadObj adoc layouts AcDbLayout devices^)

 (defun getPlotDevice# (def / i)
  (setq AcDbLayout (vla-item layouts (getvar "ctab")))
  (vla-refreshPlotDeviceInfo AcDbLayout)

  (setq i 0) 
  (foreach device (setq devices^ (vlax-safearray->list (vlax-variant-value (vla-getPlotDeviceNames AcDbLayout))))
   (princ (strcat "\n" (itoa (setq i (1+ i))) ") " device))
    
   (if (eq (strcase device) (strcase "DWG to PDF.pc3"))
    (setq def i)
   )
  ); foreach 

  (textscr)
  (initget (+ 2 4))
  (if (not (setq ask (getint (strcat "\nPlot devide number to assign to all Layouts <" (itoa def) ">: "))))
   (setq ask def)
   (setq def ask)
  ); if
 ); getPlotDevice# 

  
 (defun setConfigName (AcDbLayout / err)
  (vla-refreshPlotDeviceInfo AcDbLayout)
   
  (if (not
	 (vl-catch-all-error-p 
      		(setq err (vl-catch-all-apply 'vla-put-configName (list AcDbLayout  (nth (1- (getvar "useri5")) devices^))))
         )
      )
   T
   (prompt (strcat "\n* " (vl-catch-all-error-message err) " *"))
  ); if
 ); setConfigName


 ; here start (c:sp2all) 
 (setq acadObj (vlax-get-acad-object))
 (setq adoc (vla-get-activedocument acadObj))
 (setq layouts (vla-get-layouts adoc))
  
 (vla-startUndoMark adoc) 

 (if (= (getvar "useri5") 0)
  (setvar "useri5" 1)
 )
   

 ; switch to layout
 (vla-put-activeSpace adoc acPaperSpace) ; tilemode=0
 (vla-put-MSpace adoc :vlax-false)	 ; move to pspace
  
  
 (setvar "useri5" (getPlotDevice# (getvar "useri5")))
  
 (vlax-for AcDbLayout layouts
  (if (not (eq (vla-get-name AcDbLayout) "Model"))
   (setConfigName AcDbLayout )
  )
  (vlax-release-object AcDbLayout) 
 )

 (vla-endUndoMark adoc)
  
 (vlax-release-object layouts) 
 (vlax-release-object adoc)

 (princ "Done.")
 (princ)
); c:sp2all

 

0 Likes
Message 7 of 7

ronjonp
Advisor
Advisor

@gak19043  I agree this should be a feature OOTB .. but in the meantime give this a try:

(defun c:pagesetups (/ _pagesetups listbox $value ch doc fno lst sel x)
  ;; RJP » 2022-12-30 <- many moons ago before this date
  (defun _pagesetups (/ doc out)
    (setq doc (vla-get-activedocument (vlax-get-acad-object)))
    ;; Check that we're in paperspace and get the current tab layout
    (if	(= (getvar 'cvport) 1)
      (setq out (cons (cons "**CURRENT TAB**" (vla-item (vla-get-layouts doc) (getvar 'ctab))) out))
    )
    (vlax-for x	(vla-get-plotconfigurations doc)
      (if (zerop (vlax-get x 'modeltype))
	(setq out (cons (cons (vla-get-name x) x) out))
      )
    )
    out
  )
  (defun listbox (name descr lst / $value attlst ch dcl flag fn fno id result x)
    (setq fn  (vl-filename-mktemp nil nil ".dcl")
	  fno (open fn "w")
	  dcl (list (strcat "foo : dialog { label = " (chr 34) name " " (chr 34) "; spacer;")
		    (strcat ": boxed_column { label = " (chr 34) descr "  " (chr 34) ";")
		    ": list_box {"
		    (strcat
		      "key = \"l\"; alignment = centered; allow_accept = true; width = 50; height = 25;"
		    )
		    "}"
		    "}"
		    "spacer;"
		    "ok_cancel;"
		    "}"
	      )
    )
    (mapcar '(lambda (x) (write-line x fno)) dcl)
    (close fno)
    (setq id (load_dialog fn))
    (new_dialog "foo" id)
    (start_list "l")
    (mapcar 'add_list (mapcar 'vl-princ-to-string lst))
    (end_list)
    (action_tile "l" "(setq ch $value)")
    (setq flag (start_dialog))
    (unload_dialog id)
    (vl-file-delete fn)
    (and ch (= 1 flag) (setq result (nth (read ch) lst)))
    result
  )
  (if (and (setq lst (_pagesetups)) (setq doc (vla-get-activedocument (vlax-get-acad-object))))
    (if	(setq sel (assoc (listbox "Pagesetups.lsp"
				  "< Select Pagesetup To Apply To All Layouts >"
				  (vl-sort (mapcar 'car lst) '<)
			 )
			 lst
		  )
	)
      (vlax-for	tab (vla-get-layouts doc)
	(if (> (vlax-get tab 'taborder) 0)
	  ;; Catch all apply is for current tab selection .. an error will occur if trying to copy over oneself :)
	  (progn (vl-catch-all-apply 'vla-copyfrom (list tab (cdr sel)))
		 (vlax-invoke tab 'refreshplotdeviceinfo)
	  )
	)
      )
    )
    (princ "\nNo pagesetups in drawing!")
  )
  (princ)
)
0 Likes