LISP to Automate DWG to PDF

LISP to Automate DWG to PDF

Anonymous
Not applicable
6,399 Views
10 Replies
Message 1 of 11

LISP to Automate DWG to PDF

Anonymous
Not applicable

Hello All,

 

I'm new to AutoCAD, LISP, and in this forum. I'm hoping someone out there can help me out. 

 

I'm trying to write multiple DWG's to PDF using DWG to PDF.  I need to make more than 100 PDF's.

 

I have done a lot of searching on this forum and others but didint find anything that can help, I'm familiar for a few lisp to make other task, I want to know if theres somebody that know about a lisp that can help me with this.

 

Any help would be much appreciated.

0 Likes
6,400 Views
10 Replies
Replies (10)
Message 2 of 11

maratovich
Advisor
Advisor

Much depends on what you have in the file. What is your title block?
Can you attach a sample file?

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

Anonymous
Not applicable

I found this lisp but can make it run Im not sure if this will work for what Im looking for, Im attaching the Lisp I found.

 

And in the tittle block do you refer to the DWG name or for what?

 

 

0 Likes
Message 4 of 11

paullimapa
Mentor
Mentor

Assuming your drawings are setup with the correct settings you could use the PUBLISH command.

But if not and you want to specify the parameters using lisp, then just taking the portion of the code you provided for the plot command would look like the folloiwng:

(defun c:plotpdf (/ file)
(setvar "cmdecho" 1)
(setq file (strcat (getvar 'DWGPREFIX) (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4)) ".pdf"))
(if (findfile file)(vl-file-delete file))
(command "-plot" "yes" "" "DWG TO PDF.PC3" "ARCH D (36.00 x 24.00 Inches)" "Inches" "Landscape" "yes" "Extents" "1:1" ".113427,.113168" "yes" "OMS.ctb" "yes" "A" file "no" "yes")
)

 

This also assumes you are using color table OMS.ctb.  If not, then I would replace this with your own.

You can save the attached file into a location where ACAD can find and then load command using (load"PlotPDF") and then type PLOTPDF

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 11

Anonymous
Not applicable

hi sir i am new here and i want to learn autolisp how to make autolisp program please help me sir

0 Likes
Message 6 of 11

paullimapa
Mentor
Mentor
0 Likes
Message 7 of 11

Anonymous
Not applicable

Sorry Im not familiar with the lisp laguange try to run what you share but didn't work, I dont know if i explain clearly.

 

I want to know if there is somebody that can help creating a lisp o sharing an existing one, that print various PDF.

 

I have a folder with 500 diferente Autocad Drawings I want to create one PDF for each drawing or something similar, It doesn't matters if I need to do it 50 in 50 or 200 in 200, if I can do it for all at once will be great.

 

Also if I need to do it opening 10 by 10 also will work, I know Autocad have the Publish option, but it doesn't work exactly for what  I need, because also I need to add an specific name for each PDF file name, and the publish option doesn't give that option for what I know.

 

Do you know I way that can help me with this or is this anybody else that can help with this.

 

I hope I get much clear my point, and anything that can help, I will appreciate it.

0 Likes
Message 8 of 11

maratovich
Advisor
Advisor

May be...
See message #2

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

paullimapa
Mentor
Mentor

If you want to rename the PDF files produced from the Publish command, you can always use the free Bulk File Rename utility:

http://www.bulkrenameutility.co.uk/Download.php

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 10 of 11

Anonymous
Not applicable

Here is an Autocad drawing example in what Im trying to work with that specific file name, they are stores buyldings with fixtures placement, I have 500 drawings and need to save 3 diferent PDF files for each drawing with diferent prefix for each pdf drawing, example:

 

For the drawing fpln7082 I need 3 pdfs with this prefix, each pdf with diferent layers combinations.

7082 fpmdse

7082 fdpl01

7082 fdloc02

 

Doest this works for you?

0 Likes
Message 11 of 11

maratovich
Advisor
Advisor

Automatic search for the title block, printing in PDF, if many files = no problems.
Save the file with a new name "fpln7082" (file name) or any other = no problem.
Questions:
1. Your example has the name part of the filename "7082" <> "fpln7082" - so will everyone have or have others?
You can get a name to save from the title block - from the attribute, but the example does not.
2. You want to disable the layer, and save the file with the name of the layer, but the example does not. Specify an example.
Will these layer names always be?
You can enable and disable one layer at a time.

For example:
Specify 100 files, specify the name of the layer, press the button, the program automatically finds the title block, disables the layer, saves the files with the name of the layer. 100 PDF files with a new name.
Then we specify another layer name, press the button, we get 100 PDF another name.
And so on...

If it suits you, then we can discuss the details. We need to check and test, it's not fast. Contact me via private message.

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