LISP to Batchplot (Publish) Multiple .dwg Models into One PDF

LISP to Batchplot (Publish) Multiple .dwg Models into One PDF

whitt0213
Contributor Contributor
4,832 Views
7 Replies
Message 1 of 8

LISP to Batchplot (Publish) Multiple .dwg Models into One PDF

whitt0213
Contributor
Contributor

I've been tasked with the objective of creating a LISP which will automatically batchplot (publish) all Models in a set of .dwg in a given folder to a single .pdf. The idea is that we will create a routine which will run this LISP once a week to keep the .pdf, which is used by non-CAD users, up to date.

I am new to LISP but as I've tried to plan this out, I've come up with the idea that I would create a temp .dsd file based on the .dwg filename containing a substring of characters (ex. KER) and load that .dsd into PUBLISH command. Each Model would be passed the same page setup.

Does this sound feasible? Does anyone have any experience doing something similar and can provide some examples?

0 Likes
4,833 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor

I got round the single pdf file by using Ghostscript it has the ability to combine multiple pdf into 1 Pdf. We did not use publish rather custom plot lisps. 

 

You could put all the pdf's into a directory then tell Ghostscript to combine, the good news is that there is a VL function for getting files in a directory and secondly you can use lisp to run Ghostscript.

 

If this sounds useful post again.

0 Likes
Message 3 of 8

whitt0213
Contributor
Contributor

I'm not familiar with Ghostscript, but I'm open to learning something new!

0 Likes
Message 4 of 8

scot-65
Advisor
Advisor

@whitt0213 

 

This method might be a little too much to take in as a newbie, but you have to start somewhere, huh?

 

Look into the registry, specifically this area:

HKEY_CURRENT_USER\SOFTWARE\Autodesk\[[AutoCAD Product here]]\Profiles\[[Profile Here]]\Dialogs\AcPublishDlg

 

If there is no AcPublishDlg entry, command PUBLISH was never started (and ended) on that computer.

 

The keys you will be setting are:

IncludeLayout = 0

IncludeModel = 1

MultiSheetFile = 1

 

and the variable

PUBLISHALLSHEETS = 1

 

All drawings in the directory will need to be loaded in the AutoCAD editor for this to work.

 

Otherwise you will have to use an external scripting-type of program to generate, then bind the PDF's (which is not LISP).

 

The dsd file only works with drawings already loaded into the editor (I think). Therefore you do not need to investigate this route.

 

Hope this helps.

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 5 of 8

Sea-Haven
Mentor
Mentor

Have a look at this as example code. You will need to download and install current ghostscript 1st and edit the version in the lisp code.

 

 

0 Likes
Message 6 of 8

maratovich
Advisor
Advisor

Maybe this will help you - Revers 

There is an automatic folder check.
If a file appears in the folder, a PDF is created or printed.
After this, the file is deleted from the folder, but the PDF remains.

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

whitt0213
Contributor
Contributor

Hey Scot,

 

Thanks for the reply. Forgive me for my stupidity, but what do you mean by, "All drawings in the directory will need to be loaded in the AutoCAD editor for this to work." What is the AutoCAD editor? 

0 Likes
Message 8 of 8

whitt0213
Contributor
Contributor

Thanks for the example code! I'll take a look into this. 

0 Likes