Jump to content

Recommended Posts

Posted

Is there a way to set the plotter and paper size to the current Layout?

 

For example I would like to set it to 

Plotter => Name:
"DWG To PDF.pc3"

 

Paper Size:
"W7H2"  

 

which is 7 A4 width, 2 A4 height, with the margins that we want ... I have a bunch of those sizes saved in "DWG To PDF.pc3".

 

On this web page I found a way to list the paper size names, 

https://jtbworld.com/autocad-getplotdevices-lsp

But I can't find any function that Set the paper size.  (Well, I found some, but they don't seem to work).

Posted (edited)

Create a pagesetup in a template and use psetupin.

 

I use this to import my page setups.

(defun c:page (/ f)
  (vlax-for x (vla-get-plotconfigurations (vla-get-activedocument (vlax-get-acad-object)))
    (vla-delete x)
  )
  (setvar 'filedia 0)
  (cond	((setq f (findfile "X:/Path/pagesetups.dwt"))
	 (vl-cmdf ".-psetupin" f "*")
	 (princ "\n <<<Pagesetups Imported>>>")
	)
	((princ "\n <<<Pagesetups NOT FOUND!>>>"))
  )
  (setvar 'filedia 1)
  (princ)
)

 

Edited by ronjonp
  • Like 3
Posted

To find the paper size that the page setup is at I use:

 

  (setq acadObj (vlax-get-acad-object))
  (setq doc (vla-get-ActiveDocument acadObj))
  (vla-GetPaperSize (vla-get-ActiveLayout doc) 'PaperWidth 'PaperHeight)

;;PaperWidth and PaperHeight are then used as variables

 

From that I look up the paperwidth and paperheight from a predefined list of dimensions - which correspond to another list with the papersize name to plot with (so if paperwidth is 1189 and height is 841, the lookups return 'ISO A0 (841x.....' ), you can customise this to return whatever name you want.

 

(as a point to note, copying this snippet and noticed my plotPdf Lisp file is littered with a 'RJP' suffix for various parts!)

 

 

  • Like 1
Posted (edited)

Did a plot pdf's recently looks at title blocks so works out correct plot setting for that layout, plots a layout range selected. Handled A1- A4, landscape & Portrait. Just click on menu watch it come out. Check out Maratovich Plotting has a good plot routine.

Edited by BIGAL
Posted

Okay, thanks guys.

 

What works quite fine for me:

;;Command: -PAGESETUP
;;Enter an output device name or [?] <DWG To PDF.pc3>:
;;Enter paper size or [?] <W4H2>: w4h2
;;Enter paper units [Inches/Millimeters] <Millimeters>:
;;Enter drawing orientation [Portrait/Landscape] <Landscape>:
;;Plot upside down? [Yes/No] <No>:
;;Enter plot area [Display/Extents/Layout/View/Window] <Window>:
;;Enter lower left corner of window <-840.000000,0.000000>:
;;Enter upper right corner of window <0.000000,594.000000>:
;;Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Fit>: 1:1
;;Enter plot offset (x,y) or [Center] <Center>: 0,0
;;Plot with plot styles? [Yes/No] <No>: y
;;Enter plot style table name or [?] (enter . for none) <Stations_Mono.ctb>:
;;Plot with lineweights? [Yes/No] <No>: y
;;Scale lineweights with plot scale? [Yes/No] <No>:
;;Plot paper space first? [Yes/No] <No>:
;;Hide paperspace objects? [Yes/No] <No>:


;; landscape
(defun c:psu ( / size ori bl tr)

    (command "-PAGESETUP" 
	  "DWG To PDF.pc3" 
	  (setq size (getstring "\nPage Size: ")) 
	  "Millimeters" 
	  "Landscape" 
	  "" 
	  "Window" 
	  (setq bl (getpoint "\nBottom-Left point: "))
	  (setq tr (getpoint "\nTop-Right point: "))
	  "1:1"
	  (list 0.0 0.0)
	  "Yes"
	  "Stations_Mono.ctb"
	  "Yes"
	  "No"
	  "No"
	  "No"
	)
  
)

 

I'll just add a little error correction (like to see if the page size exists, calculate when the page is Portrait/Landscape...)

Posted

"calculate when the page is Portrait/Landscape" In what I commented about above, the title block has "POR" in its name and use wcmatch or vl-findstr, the size is again derived from the title block A1, A2, A3, A4.

Posted
On 4/28/2022 at 9:42 AM, Emmanuel Delay said:

I'll just add a little error correction (like to see if the page size exists, calculate when the page is Portrait/Landscape...)

 

If you look at my example, if Paperwidth is greater than Paperheight it is landscape.

 

If page size exists, I have a list of allowed page sizes and use that as a look up 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...