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

Batch Plot to pdf in model space

76 REPLIES 76
SOLVED
Reply
Message 1 of 77
Anonymous
16936 Views, 76 Replies

Batch Plot to pdf in model space

Please help me, 

I want to know is there any lisp for printing multiple blocks to pdf at once?
I have hundreds of drawing and each drawing have many title blocks in model/Layout in different size (all title blocks are in blocks named A1). So if i use publish command, i have to open all 100 drawings and make page setup for all title blocks. It is waste of time. So i am looking for a program which print a specific  blocks one by one (instead of selecting a window/layout/extends) in model or layout converting to pdf at once. Hope you understand the matter. Help would be appreciated (I am really sorry for my poor English).
76 REPLIES 76
Message 21 of 77
Anonymous
in reply to: maratovich

Hi,

I want to print the DWG files from AUTOCAD without having to convert it to PDF. Can anyone help me with a script for running this

Message 22 of 77
maratovich
in reply to: Anonymous

If you make an attempt to read what is being offered to you, then you will understand that the program was created for printing on paper.
This is in the picture, this is in the video - just indicate the desired printer.
We must first try, and then clarify.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 23 of 77
Anonymous
in reply to: maratovich

I understand the software is able to print. I was just asking for LISP script for it without converting to PDF as it will save time if lots of drawings are there.

Thanks and regards

Message 24 of 77
Anonymous
in reply to: Anonymous

Hi all of you I am looking for the same lisp do you have it 

Thanks 

Jean-luc

 

Message 25 of 77
Ar.Semikin
in reply to: Anonymous

Looking for the same lisp too.

Thanks!

 

Message 26 of 77
maratovich
in reply to: Ar.Semikin

Lisp is made for a specific case.
You need to use a universal solution for all cases. This is not a problem, it is already there.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 27 of 77
Anonymous
in reply to: maratovich

Thank you for this lisp. But it is plotting in random order. How to make it in order? or perhaps by sheet number?

Message 28 of 77
maratovich
in reply to: Anonymous


@Anonymous wrote:

Thank you for this lisp. But it is plotting in random order. How to make it in order? or perhaps by sheet number?


Give an example of your .dwg file.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 29 of 77
Anonymous
in reply to: maratovich

Here is the sample drawing

Message 30 of 77
maratovich
in reply to: Anonymous


@janaudiecarino12 wrote:

Here is the sample drawing


Watch this:

 

 

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 31 of 77
maratovich
in reply to: Anonymous

 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 32 of 77
maratovich
in reply to: Anonymous

.

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 33 of 77
Anonymous
in reply to: maratovich

Thank you for your response maratovich. I am glad that you made an effort on making a step by step video. After watching the video, I think the lisp coded by Henrique here in this topic was more time saving cause you will just enter only one command. If you could just modify it to plot in order by sheet number, I would be really thankful. 

Message 34 of 77
reegancath
in reply to: Anonymous

Hi All

I have attached an example .dwg file which I am working on.

I usually work on model space instead of separate layouts hence all our drawings are on Model space .

The example drwgs (attached) are only of 5 pages , but there are other dwgs where there are 50 pages.

Can someone teach me how to convert all these into dwg to pdf.pc3 easily.

Is there a lisp file , if so please share .

 

Note : each blocks are of different sizes.

Message 35 of 77
reegancath
in reply to: Anonymous

Can someone help me how to run this script ?

Should I copy the script and paste in NOTEPAD and save it as .lsp format for creating a LISP ?

Message 36 of 77
maratovich
in reply to: reegancath

Watch the video in the previous post.
No printing issues.

rev.PNG

---------------------------------------------------------------------
Software development
Automatic creation layouts and viewport. Batch printing drawings from model.
www.kdmsoft.net
Message 37 of 77
reegancath
in reply to: maratovich

Thanks @maratovich , I have seen the video but looks like I have to pay for the software . 

I am looking for LISP 

Message 38 of 77
Sea-Haven
in reply to: reegancath

Not everything thing in life is free, do you get paid for your Cad dwg's ? So how much does a time saving mean to you, go home early, look at internet dont tell boss, start another project to mention a few.

Message 39 of 77
reegancath
in reply to: Sea-Haven

I have just started to use CAD , complete Noob . Also in my workplace they donot allow us to install new software's , Admins here are very strict 😶 . Moreover they are not going to pay for new software .

My colleagues here have been plotting CAD dwgs in model space and they use Ctrl+P to convert each drawings into dwg to pdf (A4) format one by one which is very time consuming.

I happened to stumble upon this site and read about Lisp which makes it much easier to plot .

 

 I looked up and found scripts / code like the one below , the problem is I donot know how to use these .

Should I copy this on to a notepad and save it with file extension .lsp ? and then use Autocad to load the Lisp ?

 

(vl-load-com)
(defun c:demo (/ dwg file hnd i len llpt lst mn mx ss tab urpt)
    (if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "A1-"))))
        (progn
            (repeat (setq i (sslength ss))
                (setq hnd (ssname ss (setq i (1- i)))
                      tab (cdr (assoc 410 (entget hnd)))
                      lst (cons (cons tab hnd) lst)
                )
            )
            (setq lst (vl-sort lst '(lambda (x y) (> (car x) (car y)))))
            (setq i 0)
            (foreach x lst
                (setq file (strcat (getvar 'DWGPREFIX)
                                   (substr (setq dwg (getvar 'DWGNAME)) 1 (- (strlen dwg) 4))
                                   "-"
                                   (itoa (setq i (1+ i)))
                                   ".pdf"
                           )
                )
                (if (findfile file)
                    (vl-file-delete file)
                )
                (vla-getboundingbox (vlax-ename->vla-object (cdr x)) 'mn 'mx)
                (setq llpt (vlax-safearray->list mn)
                      urpt (vlax-safearray->list mx)
                      len  (distance llpt (list (car urpt) (cadr llpt)))
                )
                (command "-plot"
                         "yes"
                         (car x)
                         "DWG TO PDF.PC3"
                         "ISO A3 (420.00 x 297.00 MM)"
                         "Millimeters"
                         "Landscape"
                         "No"
                         "Window"
                         llpt
                         urpt
                         "Fit"
                         "Center"
                         "yes"
                         "grayscale.ctb"
                         "yes"
                         ""
                )
                (if (/= (car x) "Model")
                    (command "No" "No" file "no" "Yes")
                    (command
                        file
                        "no"
                        "Yes"
                    )
                )
            )
        )
    )
    (princ)
)

 

Message 40 of 77
paullimapa
in reply to: reegancath

just do a simple google search for how to save and load Lisp and you’ll get plenty of sites online that can answer your question and this is one good one: 

https://www.cad-notes.com/saving-using-and-managing-your-autolisp-program/ 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos

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

Post to forums  

Forma Design Contest


AutoCAD Beta