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

export multiple layouts to one pdf

16 REPLIES 16
SOLVED
Reply
Message 1 of 17
ruben.vanveerdeghem
2123 Views, 16 Replies

export multiple layouts to one pdf

We have drawings with multiple layouts and we want to export all these layouts to one pdf file with the accoreconsole.

I found this to use:

(setq CurrDwgName (getvar "dwgname"))
(setq Fname (substr CurrDwgName 1 (- (strlen CurrDwgName) 4)))
(setq name (strcat (getvar "DWGPREFIX") Fname ".pdf"))
;Command:
-EXPORT
;type 
PDF
;What to print
A
;Enter file name <D:\FtpRoot\WorkerShared\w11i1j11\acad_test-Model.pdf>:
!name
nil

But this doesn't work. The log file of the accoreconsole is giving this as an error:

Command: -EXPORT
Enter file format [Dwf/dwfX/Pdf] <Pdf>PDF
Enter plot area [Display/Extents/Window] <Display>: A

Invalid option keyword.

 

I don't know how to solve this and de accoreconsole keeps on failing on all my testings.

Can someone help me with this?

16 REPLIES 16
Message 2 of 17


@ruben.vanveerdeghem wrote:
Enter plot area [Display/Extents/Window] <Display>: A
Invalid option keyword.

 


The option for this prompt can only be either of the three available answer

Enter plot area [Display/Extents/Window] <Display>: 

The script shows "A" , you can try changing that to "E" or "D"

 

 

HTH

 

Message 3 of 17

@pbejse
I know that are the only options, but this doesn't make one pdf, it's only asking to export one layout as pdf, all the other layouts are not exported
Message 4 of 17

Any reason why you want this via coreconsole? I would suggest you use "publish" inside AutoCAD, 

 

Separate drawing files / multiple layouts can be merged into one pdf via publish dialog

pbejse_0-1650008651565.png

HTH

 

 

 

 

 

Message 5 of 17

@pbejse 

It should be using a bat file to create the pdf and to import the pdf to windchill. But I think I found the issue.

If you first make the first layout active with:

Layout
Set
Name of the first layout

 

Then the export command is working like it should be.

I'm only having an issue with inquiring the name of the first layout. Is there a command for that?

Message 6 of 17

I was able to save this problem.

If the first layout is set, accoreconsole is able to export all layouts to pdf.

(setq CurrDwgName (getvar "dwgname"))
(setq Fname (substr CurrDwgName 1 (- (strlen CurrDwgName) 4)))
(setq name (strcat (getvar "DWGPREFIX") Fname ".pdf"))
(setq Lname (nth 0 (layoutlist)))
;Command:
LAYOUT
;Set
Set
;Select
!Lname
;Command:
-EXPORT
;type 
PDF
;What to print
A
;Enter file name <D:\FtpRoot\WorkerShared\w11i1j11\acad_test-Model.pdf>:
!name
nil

 

 

Message 7 of 17

@ruben.vanveerdeghem 

My apologies, but this all seems foolish to me.

I suggest that you learn how to use SheetSetManager instead.

John F. Uhden

Message 8 of 17

Ok click a menu button enter the layout plot range required hey pdfs are plotted then Ghostscript joins them back into 1 PDF been doing it for years, yes need ghostscript, no need to learn more than 1 menu button click.

SeaHaven_0-1650187234746.png

 

 

 

 

Message 9 of 17
DC-MWA
in reply to: Sea-Haven

This is awesome. How hard is it to make it open the pdf created as final action?

Message 10 of 17
Sea-Haven
in reply to: DC-MWA

You could add a startapp as last line something like (startapp "explorer" "D:\\acadtemp\\trip-Model.pdf")

 

I have though about do a All or range inside existing code.

Message 11 of 17
DC-MWA
in reply to: Sea-Haven

After using this for the day. It looks like the last thing that happens is the ghostscript processing, so the lisp is already done. So running action on a file that is technically created by ghostscript after the fact is problemmatic. I made it open the folder in explorer at he end, this is super cool!

Message 12 of 17
DC-MWA
in reply to: Sea-Haven

I'm wondering about deleting the separate files used to create the combined file, but this is probably the same issue since ghostscript works after the lisp (I think).

Message 13 of 17

Yeah the ghostscript is ran as a last step as its a seperate program that has the ability to merge pdfs into 1 file. I have just had problems with publish and also with mine select from menu all done with publish have to set up and make sure everything is set correct, yes could make dsd file. So need that for each DWG also.

 

As the lisp has a list of pdfnames could do a VL delete file.

 

Message 14 of 17
DC-MWA
in reply to: Sea-Haven

I have been unable to get vl-copy or vl-delete to work. Also, not sure how that works if I plot just one tab??

Message 15 of 17

Been away a few days, so Vl-file-delete ? If pdf count is greater than 1 then delete files after running ghostscript.

Message 16 of 17
DC-MWA
in reply to: Sea-Haven

Hello,

So I modified the program to meet my needs. It leaves a temp folder behind, but it puts the created pdf in a quickplots folder.

I have a little .bat file that cleans our server of bak files so I added the temp folders to that and it is no big deal.

I have attached the lisp so you can see what I did. And again, thank you so much. 

Message 17 of 17

Glad to see it was usefull.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report