Jump to content

pagesetup with lisp with several layout A3, A0. A1


CAD

Recommended Posts

Hello looking for a lisp that could autom. make page setup in acad for serveral layouts, also could find right papersize of the printer, and plotter with plotstyle, the lisp had the options to choose what te plot , window, extend or layout.

scale 1:1,drawing orientation:portrait, landscape.plot upside down. With a command :setuplayout

 

 

example

layout1 has a drawing with A1

layout2 has a drawing with A1 oversize 1200

layout3 has a drawing wiht A0

layout4 has a drawing wiht A3 oversize 500

 

 

all drawing need

 

 

1.Cutepdf writer.pc3

2.acad.ctb

3.automatic select paper size from the plotter (Cutepdf writer)

4.window, extend or layout options

5.scale 1:1

6.drawing orientation:landscape.

7.plot upside down:no

Edited by CAD
Link to comment
Share on other sites

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • CAD

    14

  • maratovich

    9

  • BIGAL

    8

  • 34cengiz

    2

Top Posters In This Topic

Posted Images

This is a common theme and the answer has been stated many times. You can use one of the codes posted here that makes a pdf or plot to printer/plotter the only change is that you check the title block or look for a block on that layout that has the desired size as say a name "A1" "A1oversize" "A0" "A3500".

 

If you look at this example its hard coded for a specific size A1 title block making A3 pdf's

(COMMAND "-PLOT"  "Y"  "" "dwg to Pdf"
       "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" "1=2"  "C"
       "y" "Designlasercolour.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
   )

 

Your version would be something like this after checking sheet size it would set the variables papersize and printername and scale

(COMMAND "-PLOT"  "Y"  "" [color="red"]Printername[/color]
      [color="red"] Papersize[/color] "m" "LANDSCAPE"  "N"   "W"  "-6,-6" "807,560" [color="red"]scale[/color]  "C"
       "y" "acad.ctb" "Y"	"n" "n" "n" pdfName "N" "y"
   )

 

Hope this makes some sense, do you have any skills with lisp ? Full code example was posted by me a couple of days ago similar question, there are numerous examples here just search "PLOT".

 

maratovich also has a universal print solution that may help as well, I am sure he will provide the link for further information.

Link to comment
Share on other sites

Hello BIGAL!the script dont work for me, also i have look for plot in the search,notthing seems not to work for me, I know how to use lisp, but don't how to make one :).

I want a lisp that can by command: setupalllayout. So the layout1, Layout2, Layout3 etc. automatic config the pagesetup with standaard Cutepdf Writer.pc3, ctb, find automatic papersize in the menu papersize directory, instead self click on it, because i have something 10 layouts with differents formats A3, A1,A1 oversize in one drawing.

Link to comment
Share on other sites

Hello Maratovich, dont have to create tab, only setup all pagesetup.

but the layouts name is always different like as drawing01,schedule02,roof01, etc

Link to comment
Share on other sites

You do not have a printer.

The size of the format A0 = 1350х841 is not a standard paper size.

This size is in the printer?

If you can add these dimensions to the printer, you can make the setting.

But this is a long time to write in words.

I'll write a private message.

Link to comment
Share on other sites

Your antivirus is free.

It by default accepts all new programs in the black list.

There are no viruses. 2000 users have been verified.

Add to whitelist.

Although you decide ...

Link to comment
Share on other sites

Your antivirus is free.

It by default accepts all new programs in the black list.

There are no viruses. 2000 users have been verified.

Add to whitelist.

Although you decide ...

 

the link dont have virus, but when i download the zipfile it said virus/trojan:).

Link to comment
Share on other sites

Using the example dwg and the fact that the titles are individual should be able to put something together for you will use my current plot pdf range lisp as a base but it can be plotter or printer etc as well. Its Thursday here and its looking like being cold on week end so hang in there for a couple of days.

Link to comment
Share on other sites

This is for testing and seems to be working under testing, it needs user modification as I do not want to get into printer configuration settings. You should have already sheet sizes set up for the big sheets and which plotter you will need to put them into the code at the corresponding sheet title block list at the start of code. I have set the sheets to fit just for testing this should be 1=1 you can check manually by looking at what you have when doing a manual "PLOT", the same with the Ctb to be used I have just used 1 I have. You may also want to change the Lower left ll and Upper right ur window pick points this allows for subtle shifting of the sheet within the plot area. The pdfname and destination is user definable and we can make some changes if required.

 

I have not found a easy way to make 1 combined pdf so I use Ghostscript to re-combine the output into 1 PDF. If you want this option remove the ; from the 3 lines and make sure you have mergepdf in the support path.

 

One last rule for simplicity the code expects the title block to be at 0,0 lower left, it is possible to add a find title block but at this stage I would like to see if the code meets your needs, just adds a level of complexity.

 

;Plots layouts by range
; By Alan H Feb 2014
; chnaged to recognize title block name
(defun AH:pltlays ( / val1 val2 plotnames dwgname lendwg pdfname lay numlay numend dwgpre lstsheet sc ll ur trgfile)
(SETVAR "PDMODE" 0)
(setvar "plottransparencyoverride" 2)
(setvar "fillmode" 1)
(setvar "textfill" 1)
(setq plotnames '())

; list of parameters for sheet sizes
; hard coded to A3 size for testing change  A3 to correct plot sheet
(setq lstsheet (list 
;(list "A0-HOR1350" "-6,-6" "1356,847" "your sheet size here" "your.ctb here" "1=1")
(list "A0-HOR1350" "-6,-6" "1356,847" "Iso full bleed A3 (420.00 x 297.00 MM)" "DesignlaserCOLOUR_1.ctb" "f") ; change the f to 1=1 for full size
(list "A1-HOR1189" "-6,-6" "1195,600" "Iso full bleed A3 (420.00 x 297.00 MM)" "DesignlaserCOLOUR_1.ctb" "f") 
(list "A2-HOR841" "-6,-6" "847,426" "Iso full bleed A3 (420.00 x 297.00 MM)" "DesignlaserCOLOUR_1.ctb" "f") 
(list "A0-HOR" "-6,-6" "1195,847" "Iso full bleed A3 (420.00 x 297.00 MM)" "DesignlaserCOLOUR_1.ctb" "f")
(list "Da1drsht" "-6,-6" "807,560" "Iso full bleed A3 (420.00 x 297.00 MM)" "DesignlaserCOLOUR_1.ctb" "1=2") ; for additional testing 
))

; all pdf output goes into a subdirectory below dwg location
; check that pdf directory exists
(setq dwgpre (strcat (getvar "dwgprefix") "\pdf"))
(if (= (vl-file-directory-p dwgpre) nil)
(vl-mkdir dwgpre)
)

; get all layouts
(setq lays  (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object))))

; open up the dcl for the sheet range
(if (not AH:getval2) (load "getvals3"))
(ah:getval2 "Enter start tab number" 6 4  "1" "Enter end tab number" 6 4 (rtos (-  (vla-get-count lays) 1) 2 0))
; return the start and end range
(setq numlay (ATOI val1))
(setq numend (ATOI val2))

(setq len (+ (- numend numlay) 1))
; current dwg name
(setq dwgname (GETVAR "dwgname"))
(setq lendwg (strlen dwgname))
(setq dwgname (substr dwgname 1 (- lendwg 4)))

; go through the layout range and open to plot
(repeat len
(vlax-for lay lays 
(if (= numlay (vla-get-taborder lay))
 (setvar "ctab" (vla-get-name lay))
) ; if

; select title block using a small fence line
(setq ss (ssget "f" (list (list -3 -3) (list 3 3))(list (cons 0 "Insert"))))
(if (> 1 (sslength ss))
(progn 
(alert "There appears to be two blocks at 0,0\n\nProgram will exit") 
(exit) 
)
(princ)
)
; title block name
(setq bname  (vla-get-name (vlax-ename->vla-object (ssname ss 0))))

; set all the variables that match the title block
(foreach plotdets lstsheet
(if (= (nth 0 plotdets) bname)
(progn
(setq ll (nth 1 plotdets))
(setq ur (nth 2 plotdets))
(setq  sheetname (nth 3 plotdets))
(setq ctb (nth 4 plotdets))
(setq sc (nth 5 plotdets))
)
)
)
; Pdfname for output
(setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" ))
) ; for


; plot
(setvar "textfill" 1)
(setvar "fillmode" 1)

(COMMAND "-PLOT"  "Y"  "" "DWG To PDF"    sheetname "m" "LANDSCAPE"  "N"   "W"  ll ur sc  "C"   "y" ctb "Y" "n" "n" "n" pdfName "N" "y" )

;    goto next layout
(setq numlay (+ numlay 1))
(setq plotnames (cons pdfname plotnames))
) ; end repeat
(setq plotnames (reverse plotnames))

; the next 3 lines calls Ghostscript to combine the individual pdfs into 1 pdf
; needs Ghostscript to be downloaded seperately www.ghostscript.com
;(setq trgfile (strcat (getvar "dwgprefix") "pdf\\" dwgname "-D" val1 "-D" val2 ".pdf")) 
;(if (not combinepdf)(load "mergepdfs"))
;(combinepdf gsExe plotnames trgFile )

) ; defun

(AH:pltlays)

(setvar "plottransparencyoverride" 1)

(princ)

mergepdfs.lsp

GETVALS3.lsp

Link to comment
Share on other sites

Hello BIGAL,

 

How can run: the script Plots layouts by range

When i use appload and use command pltlays, doesnt work? wat i doing wrong?

Link to comment
Share on other sites

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...