Tool Palette Buttons for Layouts - Paper Size and Scale in Title Block

Tool Palette Buttons for Layouts - Paper Size and Scale in Title Block

checkcheck_master
Advocate Advocate
721 Views
8 Replies
Message 1 of 9

Tool Palette Buttons for Layouts - Paper Size and Scale in Title Block

checkcheck_master
Advocate
Advocate

Hello,

We work with a DWG with Paper Size Layouts that we transfer to our drawing with a Tool Palette Button.
Seems to me that this is a widely used technique within AutoCAD?
I'm trying to get Paper Size and Scale into the Title Block automatically.
That works except for a few small things.
Paper Size looks at 'ctab' which works well when e.g. the Layout is called 'A3'.
A second A3 is then called 'Layout1-A3', which then appears in the Title Block, which is not the intention.
Can I get the Paper Size in another way?
After a Layout is created, the ViewPort is activated and it scales to 0.9xp so that the user can set a scale, close ViewPort etc.
This works fine for the first Layout created, but not for those that follow, I can not get the focus on the next Layout.

See video.
I use this code under the button:

 

 

^C^C-layout;template;"HML_Bibliotheek.dwg";"A3";-layout;d;Empty;tilemode;0;zoom e;zoom s .9xp;_.mspace;zoom e;zoom s .9xp;regenall;layout set "A3";^C

 

 

In short, how can I make this run more smoothly, does AutoCAD meanwhile have standard options for this that I don't know about?
Thanks in advance.

0 Likes
722 Views
8 Replies
Replies (8)
Message 2 of 9

paullimapa
Mentor
Mentor

In order to set focus to next layout your button code (or macro) will need to know the name of the layout

If next name of layout is "Layout1-A3" then your code where currently shows "A3" will have to change to match:

 

 

 

^C^C-layout;template;"HML_Bibliotheek.dwg";"A3";-layout;d;Empty;-Layout;set;"Layout1-A3";tilemode;0;zoom e;zoom s .9xp;_.mspace;zoom e;zoom s .9xp;regenall;_.pspace;^C

 

 

 

Since you already have a layout named A3, on the 2nd time you click on the button, it'll create a layout named "Layout1-A3".  Likewise a 3rd click on the button will create "Layout2-A3" and so on.

 

 


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

checkcheck_master
Advocate
Advocate

Thank you for your response and explanation.

 

Does anyone have a good suggestion on how to use this successfully?

0 Likes
Message 4 of 9

paullimapa
Mentor
Mentor

Since I don't have your Title Block drawing, I'm assuming that the paper size Field is using either LISP (for ACAD) or DieselExpression (for ACAD LT). Assuming worse case, I would change the DieselExpression for the paper size to this expression which then will always enter the last 2 digits of the current tab name. This will solve at least your paper size issue:

$(substr,$(getvar, ctab),$(-, $(strlen,$(getvar,ctab)),1)])

  


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

pendean
Community Legend
Community Legend
@checkcheck_master Is there a reason you only want to do this in a macro only, not LISP?
Does your template file that you grab these layouts from also set up with named pagesetups by chance? Or not?
0 Likes
Message 6 of 9

checkcheck_master
Advocate
Advocate

@pendean 

Thank you for your response.

 

The source DWG has no underlying code if that's what you mean.
It has a Layout for every paper size we use, A4P, A3L, A3P, A2L, A2P, A1L and A1P.
The layouts 'Page Setup' is set according to 'DWG To PDF.pc3' regarding their paper size with a Window Plot area which is defined.
I am satisfied with this in terms of being able to export to PDF, as well as to be able to export on our printers.

 

I don't really have a reason to do it with a macro or without LISP.
I just thought it would be a relatively small step to modify the macro rule we already have.
If LISP is the tool for this, then that should be it.
However, I am not experienced with LISP so help is very welcome.
Btw I do things in iLogic/VBA so I'm not completely unworldly when it comes to code.

Besides that, I pretend I like it and call it a hobby.
How stupid can you be 🙂

0 Likes
Message 7 of 9

Sea-Haven
Mentor
Mentor

You can do pick pt in model and Layout copy and set the model view to that point and set a scale. In model view you can use zoom C pt scale then use say zoom 10Xp to set scale. ie 1:100

 

I am doing something at moment you can read a layout from  another dwg so it contains your title block setup for the different size sheets. 

0 Likes
Message 8 of 9

checkcheck_master
Advocate
Advocate

Thank @Sea-Haven for your reaction.

 

I just don't quite understand what you mean by:

'You can do pick pt in model and Layout copy and set the model view to that point and set a scale. In model view you can use zoom C pt scale then use say zoom 10Xp to set scale. ie 1:100'

Can you explain that to me more specifically?

 

And regarding:

'I am doing something at moment you can read a layout from  another dwg so it contains your title block setup for the different size sheets. '

Is that's similar to the method I'm describing, is that what you mean or do you mean/do something else?

0 Likes
Message 9 of 9

Sea-Haven
Mentor
Mentor

You can pick a point in model space as the point of interest, then go to a layout go into model view and say zoom Extents, if you then use Zoom C point scale, the mview will do just that zoom at a scale based around that point, you can then reset the scale to a more true scale 1:100 etc. Just try Zoom C point scale.

 

2nd method is to draw rectangles that are the size of your mview in your layout title block, these are scaled to suit the plot scale. They can be rotated. You then select these rectangs and make new layouts matching, you can do like 30 in one go.

 

When using the Layout command 1 option is to read a layout from another dwg, so in my case rather than have in one situation like 20 different layouts in a dwg had only layout1 and brought in only the relevant layout as required by a government authority. (command "layout" "T" "Master layouts-2022.dwg" "title2" )

0 Likes