LISP - Print multiple plots in a row

LISP - Print multiple plots in a row

Anonymous
Not applicable
5,815 Views
11 Replies
Message 1 of 12

LISP - Print multiple plots in a row

Anonymous
Not applicable

Hello,

 

New to lisp and not particularly good at it. 

I have looked around and experimented a little but haven't found what i need.

What I would really love is to have a way to print multiple pages automatically.

 

Currently i'm doing it manually by plotting each page and setting the orientation.

Printer is regular printer and paper size A4. 

 

Pages are separated by a rectangle on separate layer. Rectangle sizes vary. Printing from model space.

 

Thanks in advance!

0 Likes
5,816 Views
11 Replies
Replies (11)
Message 2 of 12

maratovich
Advisor
Advisor

No problems.
Use this:
Revers 

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

Anonymous
Not applicable

I see it working if the print boxes are the same size, measured and added to templates, but is there a way to select a layer box/polyline which it fits to a4 and prints? That it would auto-scale? There's no stamp either.

0 Likes
Message 4 of 12

maratovich
Advisor
Advisor

All this is available.
Attach an example of your .dwg file.

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

Anonymous
Not applicable

Here's a small example file

0 Likes
Message 6 of 12

maratovich
Advisor
Advisor

There is no logic in your drawing.
There are no identical rectangles.
Nobody does that. This is wrong anyway.
Create several identical rectangles.

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

Scottu2
Advocate
Advocate

Hello edvinparts,


The example is similar to drawings I encounter over the years.

It is possible to make a routine to use the rectangles or title blocks to plot to a any paper size.


Here is a possible concept of code:

Use SSGET and pick the rectangles (see lee-mac.com program examples)
Use a while loop to step through each object in the selection set
On the current object (rectangle) use the vla-getboundingbox function to get the LL (lower left) and UR (upper right) points of the rectangle.
Determine if the plot is Landscape or Portrait by comparing the slope of the line (or ratio) between LL and UR.
Construct a string that emulates your keystrokes when you issue a -PLOT command.
issue a command line operation, like (command "-PLOT" "Y" "" "Landscape" "" ... and so on)

 

Note:
Carefully step through all of the -PLOT advanced options.
Different computers may have a different or updated printer driver for the same printer,

and can have a different printer name or paper names.

 

Also, Save the printer driver setting into a PC3 file, one for color and one for black & white (monochrome).

Then the routine can use that pre-defined PC3 setting when you ask "Print in color?" instead of

the original printer driver name.

 

I hope this helps you getting started.

0 Likes
Message 8 of 12

hak_vz
Advisor
Advisor

What I would really like to see on this forum is people reusing previously posted code and to learn autolisp,just enough to be able to change one or two lines of code to solve their own particular problem. There are to many inquiries to reshape blocks and so on. I'm really not in a mood to waste my Sunday on some coding, since this subject has been resolved more then once on this forum.

With @maratovich  we have been finding solution to relatively similar problems, and code is written here:

 

Dwg to pdf only A4 sheet automatic lisp 

 

Batch Plot to pdf in model space 

 

You should look at both previous posts.

Try to figure out how this code works, and eventually apply solution that @Scottu2 proposed, but I think that it should work as it is.  Maybe you'll have to rotate your portrait printouts to landscape. Instead printing with print definition for pdf, you should change it to work with your particular printer. As a bonus you have a script for batch printing to pdf.

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 9 of 12

Sea-Haven
Mentor
Mentor

Like previous poster here is a plot all in model it expects a title block for the pick window but the two corners could be the pline. This will get the co-ords of a pline the 1st and 3rd are the corners you can use. 

 

(setq ss (ssget your plines.....
(repeat (setq x (sslength ss))
(setq co-ord '())
(setq plent (ssname ss (setq x (- x 1))))
(setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))))
(setq ll (nth 0 co-ord))
(setq ur (nth 2 co-ord))
;do plot stuff now
)

 

0 Likes
Message 10 of 12

Sea-Haven
Mentor
Mentor

This may be useful. Just appload box.lsp draws and dims rectangs. 

 

 

 

0 Likes
Message 11 of 12

Anonymous
Not applicable

Thank you all for replying!

 

Yes, unfortunately the print rectangle sizes are mostly different and random sizes. but that's the nature of my print requirement 😞

I will try to comprehend the suggestions and start to learn and experiment with those.

 

Thanks again!

 

0 Likes
Message 12 of 12

Sea-Haven
Mentor
Mentor

look at

(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"
    )
In particular
"W"  "-6,-6" "807,560" "1=2"
now
"W"  LL UR "F" the values of lower left upper right are from the pline routine I posted 
0 Likes