Automatic Papersize

Automatic Papersize

thomas_schluesselberger
Advocate Advocate
10,836 Views
93 Replies
Message 1 of 94

Automatic Papersize

thomas_schluesselberger
Advocate
Advocate

Hi!

 

I don't think there is a solution for this, but please convince me otherwise:

 

I would like a LISP program that allows me to automatically crop the paper sizes of all layouts. So the paper size should automatically adapt to the objects in the layout. So that there is no white border outside the viewport.

I would then like to create pdfs with "publish" as normal, but I don't want to have to crop the PDF every time.

 

Until now i always have to manually create a new paper size and set each layout individually.

 

0 Likes
Accepted solutions (1)
10,837 Views
93 Replies
Replies (93)
Message 41 of 94

thomas_schluesselberger
Advocate
Advocate

Hi!

 

I did what you said, but there isnt really something that i can translate (its already english).

 

 

0 Likes
Message 42 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 

did more fine tunning, hope this is now final 🤣

 

Moshe

 

 

0 Likes
Message 43 of 94

thomas_schluesselberger
Advocate
Advocate

Sadly still now working for the custom paper sizes. :C 

Maybe some other member could test it. So we see if it only doesnt works for me.

 

0 Likes
Message 44 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 

i have in my pocket one last thing to add (came to me in my sleep 🤣 ) but it will be tonight\tomorow. meanwhile post your dwg that doesn't work + pc3 so i will take a look.

 

Moshe

 

 

 

0 Likes
Message 45 of 94

thomas_schluesselberger
Advocate
Advocate

Hi,

 

attached you my PC3 + PMP-File(that where the custom paper sizes are saved in) and my DWG.

In the DWG i added a layout named "2000x900" where i drew an rectangle with 2000x900mm.

 

If it's not possible by tomorrow, then I can only test it again on Monday, but don't stress, that's okay too.

 

 

0 Likes
Message 46 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger,

 

Finally i have it (i mean i hope 🤣)

and now i know what is your problem:  * M E D I A    S I Z E *

 

this is from message #31

Maybe my paper size settings are wrong? I did the following presets for it:

Widht: 2000

Height: 914

yes this is wrong, the width should be the short edge (e.g 914)

 

for your custom media, the width should be shorter and keep it under 914 (e.g 2000x900 is wrong, it should be 900x2000) from now if you fail to do that, the program will alert and exit. either modify it or delete it.

 

WORK?

 

Moshe

 

0 Likes
Message 47 of 94

thomas_schluesselberger
Advocate
Advocate

OMG i now understand.

 

I knew this: "yes this is wrong, the width should be the short edge (e.g 914)" but i didnt understand 100% so i just had one paper size with 2000x900 and one with 900x2000, and thought the LISP would just take the right one.

But because i had the papersize twice, the wrong 2000x900 papersize got detected and the LISP got confused.

 

EDIT: I found another problem which is the same as the problem i had before (see above). When the rectangle is higher then wide, the LISP gets confused again.

Is there a fix for this, because sometimes we have plans that are like 600mm wide and 900mm high.

(Like a fix where it checks: When the rectangle is higher then long it sets the layout into portrait mode)

 

It works pretty much perfect now, thank you so much for your work and time!

There is only one thing that is not 100% right. At the Plot options area in the plot configuration the following options get reseted after execute MPsetup: Plot in background, Plot stamp on, Save changes to layout. These 3 options are getting deselected every time i execute the LISP. 

 

If I may be cheeky, I would have one more request:

It would be perfect if i would be able to set the plot options via the LISP.

Just like the option to choose the printer. So when execute mpsetup there would be a 5th choice (named "Plotoptions") where i can select which option to be active.

 

(Picture to see which options i mean):

thomas_schlu_0-1674812605927.png

 

 

 

0 Likes
Message 48 of 94

Hi!

 

One more thing:
If the LISP cannot find a suitable paper size for a layout, it would be important that I get a message about it (a window that pops up, not only in the console) and that nothing gets changed in this layout.

 

Currently the white area of paper size in the layout gets really small if in cant find a suitable paper size.

thomas_schlu_0-1674812369735.png

 

0 Likes
Message 49 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 

Hallelujah!  Very glad to hear this is now working, hey Guys we are getting very close (after 7 weeks) to announce this  'accept as solustion' 🤣

 

It works pretty much perfect now, thank you so much for your work and time!

There is only one thing that is not 100% right. At the Plot options area in the plot configuration the following options get reseted after execute MPsetup: Plot in background, Plot stamp on, Save changes to layout. These 3 options are getting deselected every time i execute the LISP. 

mpsetup does not set or reset any of the above options. infact Plot in background, Plot stamp & Save changes to layout are part of the plot dialog and mpsetup sets other options in page setup only. i made number of tests and set or reset these options, run mpsetup and they where left intact. Are you sure you do not have other applications (in background) that reset them?

 

made more fine tunings this morning, use the attached.

 

Moshe

 

 

0 Likes
Message 50 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger 

 


@thomas_schluesselberger wrote:

Hi!

 

One more thing:
If the LISP cannot find a suitable paper size for a layout, it would be important that I get a message about it (a window that pops up, not only in the console) and that nothing gets changed in this layout.

 

Currently the white area of paper size in the layout gets really small if in cant find a suitable paper size.

 

 


Attach the version that opens an alert dialog for "Can not find a suitable..."

when mpsetup fails to find a suitable page size, it does not change the white background it's autocad that does that. if you go to pagesetup right after, you will see the previous page size, so i can not tell who is doing this: Autocad or Autolisp, for sure it's not mpsetup 😀

 

Moshe

 

 

0 Likes
Message 51 of 94

thomas_schluesselberger
Advocate
Advocate

i made number of tests and set or reset these options, run mpsetup and they where left intact. Are you sure you do not have other applications (in background) that reset them? You were right it happens also without the execution of mpsetup -> my fault  😂

 

Did you see the other left problems? (i edited my answer). I have listed them here:

(I don't want to be outrageous, but if these functions could also be implemented that would be awesome)

 

1) I found a problem which is the same as the problem i had before.

    When the rectangle is higher then wide, the LISP gets confused again.

    Is there a fix for this, because sometimes we have plans that are like 600mm wide and 900mm high.

    (Like a fix where it checks: When the rectangle is higher then long it sets the layout into portrait mode)

 

2) It would be perfect if i would be able to set the plot options via the LISP.

    Just like the option to choose the printer. So when execute mpsetup there would be a 5th choice (named   

    "Plotoptions") where a window pops up and i can select which options i want to be active.

    (Picture to see which options i mean):

  thomas_schlu_0-1674815699278.png

 

( 3) One more thing:
    If the LISP cannot find a suitable paper size for a layout, it would be important that I get a message about it (a     

    window that pops up, not only in the console) and that nothing gets changed in this layout.

    Currently the paper sizes gets a bit buggy and it gets really small (see in picture below).

    thomas_schlu_1-1674815767515.png

) -> Saw your answer on that and tested it and it worked. Now also the white background doesnt change. Thanks!

 

 

 

 

 

0 Likes
Message 52 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 

1) I found a problem which is the same as the problem i had before.

    When the rectangle is higher then wide, the LISP gets confused again.

    Is there a fix for this, because sometimes we have plans that are like 600mm wide and 900mm high.

    (Like a fix where it checks: When the rectangle is higher then long it sets the layout into portrait mode)

can not see that? i test it, made a new layout 600x900, add 600x900 and 900x600 pages size with margins 0 to pc3. draw a rectangle 600,900 mpsetup works, draw a rectangle 900x600 mpsetup works

 

2) It would be perfect if i would be able to set the plot options via the LISP.

    Just like the option to choose the printer. So when execute mpsetup there would be a 5th choice (named   

    "Plotoptions") where a window pops up and i can select which options i want to be active.

    (Picture to see which options i mean):

 

except for the 3 options that are already enabled by default which are part of page setup and we agreed that mpsetup does not set them (but if you want can enable them), the other options related to plotting dialog box and can be set when you  are at plotting. maybe i do not understand what is wrong here so instruct me what to do so i can recreate the issue.

 

 

  

 

 

 

 

 


 

0 Likes
Message 53 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger  hi,

 

More thoughts brings improvements (you will like this  😀)

 

Until now i was referring page list as one list. in the attached version i split it to two groups. the first group called Landscape and the second Portrait. this means if the length (of effective title box \ rectangle) is longer then width, it checks only the Landscape group. if the width is longer, it checks only the Portrait group. this means that if your title block is 2000x900? you need add a 2000x900 page size and if it is 900x2000 a page size of 900x2000 need to be there otherwise a bigger page size will be set or a fail to find match...message will echo.

 

Another thing to note:

each invocation of mpsetup, it reads page list before the prompt is echoed. as much as the list growth it takes more time to load and process so patient is the name of the game 🤣

 

enjoy

Moshe    

 

0 Likes
Message 54 of 94

thomas_schluesselberger
Advocate
Advocate

Hi, hope your weekend was nice! 😁

 

I tested the new version and its really nice.

 

I noticed 2 things:

 

1.) It works very good with the new landscape/portrait format detection. Only if the frame is the same height as it is long (e.g.: 900x900 or 600x600) the error message appears "Can not find a suitable page size for "Layout1" Layout."

 

2.) I added my custom paper sizes to my plotter configuration (sizes 500x900 to 3000x900). I've also added landscape/portrait formats for A3 and A4. Then I have hidden all the standard paper sizes with the filter.
Now the question: Is it possible to add something so that the LISP always looks through the custom paper sizes first and after that then the standard paper sizes? I want that because the filter on the plot configuration doesnt effect the LISP and then I have all paper formats under custom paper sizes (then i have a clean look). Because now when i have a A4 sized layout it sets the paperformat to the hidden ISO A4 paper size and not to my custom made A4 size.

 

 

Would be very nice if you could implement this 2 features.

 

0 Likes
Message 55 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 


@thomas_schluesselberger wrote:

Hi, hope your weekend was nice! 😁

thanks you, how yours?!

 

I tested the new version and its really nice. you can do better 😀

 

I noticed 2 things:

 

1.) It works very good with the new landscape/portrait format detection. Only if the frame is the same height as it is long (e.g.: 900x900 or 600x600) the error message appears "Can not find a suitable page size for "Layout1" Layout."

tonight i will test that

 

2.) I added my custom paper sizes to my plotter configuration (sizes 500x900 to 3000x900). I've also added landscape/portrait formats for A3 and A4. why do you need that? why don't you use standard?

 

Then I have hidden all the standard paper sizes with the filter.
Now the question: Is it possible to add something so that the LISP always looks through the custom paper sizes first and after that then the standard paper sizes? I want that because the filter on the plot configuration doesnt effect the LISP and then I have all paper formats under custom paper sizes (then i have a clean look). Because now when i have a A4 sized layout it sets the paperformat to the hidden ISO A4 paper size and not to my custom made A4 size.

 

 

Would be very nice if you could implement this 2 features.

Yes, tonight i will test that

 


and for the other things you have requested "plot options" i hope you now realise that these switches are part of the plot dialog box and not page setup.

 

Moshe

 

0 Likes
Message 56 of 94

thomas_schluesselberger
Advocate
Advocate

@thomas_schluesselberger wrote:

Hi, hope your weekend was nice! 😁

thanks you, how yours?! Pretty nice, we got even more snow in Austria.

 

2.) I added my custom paper sizes to my plotter configuration (sizes 500x900 to 3000x900). I've also added landscape/portrait formats for A3 and A4. why do you need that? why don't you use standard?

I dont necessary need it, but in the drop down menu it is just better looking when i have all my custom paper sizes named properly.

 


and for the other things you have requested "plot options" i hope you now realise that these switches are part of the plot dialog box and not page setup. Yes, i understood it now.

 

0 Likes
Message 57 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger ,

 

All of your requests are complied  😀

 

a new option called Sps (Suppress none MM Page Size) is added to prompt. if it is set to Yes (this is the default) all the none MM pages are suppressed (spares you to filter them out) if it is set to No, all the page size are taken.

 

Moshe

0 Likes
Message 58 of 94

thomas_schluesselberger
Advocate
Advocate

Perfect!

 

It works very nice.

Thank you so much for your work and time, you really helped me out and i bet you helped many other people.

 

0 Likes
Message 59 of 94

Moshe-A
Mentor
Mentor

@thomas_schluesselberger  Good Mornning,

 


@Moshe-A wrote:

@thomas_schluesselberger ,

 

All of your requests are complied  😀

 

a new option called Sps (Suppress none MM Page Size) is added to prompt. if it is set to Yes (this is the default) all the none MM pages are suppressed (spares you to filter them out) if it is set to No, all the page size are taken.

 

Moshe

 


this was not well worded  🤣 it should be Suppress ISO/ANSI Page Size

 

the attched is a fix

 

Moshe

 

0 Likes
Message 60 of 94

thomas_schluesselberger
Advocate
Advocate

Hello

 

I found something that shouldn't be.


If there are hidden objects in the layout, the paper size is adjusted to these invisible objects.

I noticed the problem with my dynamic block where I have several visibility statuses. In the attachment I have attached my dwg with my dynamic block. When I select the "ohne" visibility, the paper format is still adjusted to the objects that are visible in the "2 extra" visibility status.


It would be great if you could adjust the LISP, so that it doesnt use objects that are not seen in the layout.

 

0 Likes