Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to applicate a Pagestup to a batch of drawings?

29 REPLIES 29
Reply
Message 1 of 30
Viclordbelial
960 Views, 29 Replies

How to applicate a Pagestup to a batch of drawings?

Hi,

 

I have to applicate to 3000 drawings the same pagesetup. How can I do that rapidly?

 

I have one master drawing with the good pagesetup.

 

Thanks!

 

 

29 REPLIES 29
Message 21 of 30
dmfrazier
in reply to: Viclordbelial

"Well, it's not importent because I use it to do PDF at the end? If you think it's importent, tell me why."

 

No problem.Smiley Happy

 

It's important because page setups are "space-specific".  In other words (as I suggested in an earlier post), there are "layout" page setups and "model" page setups.  You can't apply (set current) a model page setup to a layout, and you can't apply a layout page setup to the model tab.

 

In a previous step in this process (using DWGConvert, I presume), you were able to use the "replace page setups" option to "import" a certain page setup from a source file (and remove all others).  If this was a model page setup, we will only be able to apply it to the model tab.  If this was a layout page setup, we can apply it to whatever layout tab you like.  We can automate one or the other (fairly easily), but not both, and not either/or depending on some conditions (without a lot more info and work).

 

Are you convinced that it is important for me to know the answers to the questions?  The automation will be for a very specific purpose, so all the specifics have to be known before we can proceed.

Message 22 of 30
Viclordbelial
in reply to: dmfrazier


@dmfrazier wrote:

Are you convinced that it is important for me to know the answers to the questions?  The automation will be for a very specific purpose, so all the specifics have to be known before we can proceed.


It's still simple. A way or a other, it's the same at the end. I think the real way to print is using layout?

Is that so, I will procead like that:

 

1- Make a model.dwg with the page setup for a layer.

2- Using the DWG convert to apply the page setup (the layer one)

3- Use your scrip to apply the pagestup to currint

 

It's this a plan?


@dmfrazier wrote:

We can automate one or the other (fairly easily), but not both, and not either/or depending on some conditions (without a lot more info and work).


 

Why can't we do both?

Message 23 of 30
dmfrazier
in reply to: Viclordbelial

"Why can't we do both?"

 

The programming would be beyond my current capabilities, including time constraints.

It might be possible to quickly write two programs (one for Layout Page Setup, and one for Model Page Setup), but you would have to segregate the DWGs based on which program to run.

 

"I think the real way to print is using layout?"

 

It can be done either way - I just need to know which way.

Layout it shall be.

 

"3- Use your scrip to apply the pagestup to currint"

"It's this a plan?"

 

You have indicated you simply want to apply the page setup to the "current" Layout, which is not the Model tab.  (I will assume that the available Page Setup is compatible with the current Layout.)

 

What is the name of the page setup you specified as the replacement when you "converted" the DWGs with DWGConvert?  (I will assume each DWG has been saved with this page setup.)

 

If any DWG does not have the specified page setup, or if any DWG was not saved with a Layout tab current, the routine will fail.

 

Message 24 of 30
Viclordbelial
in reply to: dmfrazier

@dmfrazier wrote:

(I will assume that the available Page Setup is compatible with the current Layout.)


 

  I can create it to be compatible.

 


@dmfrazier wrote:

What is the name of the page setup you specified as the replacement when you "converted" the DWGs with DWGConvert?  (I will assume each DWG has been saved with this page setup.)


 

 

The name could be Page_setup. Yes each DWG is saved with this page setup when I use DWG convert.

 

Message 25 of 30
dmfrazier
in reply to: Viclordbelial

"The name could be Page_setup."

 

Okay, I will assume it is.Smiley Happy

 

The attached ZIP file contains two files:

SetPlotConfig.lsp - Place a copy of this file in one of the folders listed in your AutoCAD Support Files Search path.

XXacaddoc.lsp - Place a copy of this file in a folder containing DWGs you want to process.

 

Then,

Launch AutoCAD from your desktop icon, or by opening a file that is not in the same folder as above. (You can close the file, but keep AutoCAD running.)

Rename XXacaddoc.lsp by removing the "XX" at the beginning of the name. The name must be acaddoc.lsp.

 

In Windows Explorer, browse to the folder containing DWGs you want to process, select as many as you feel comfortable selecting, drag them to the AutoCAD icon on your taskbar, wait for AutoCAD to regain focus, and drop the files anywhere on the application window.

 

Each dropped file will have the named Page Setup applied to the current Layout, and then will be saved and closed.

 

If any files in the group do not have a Layout tab current, or do not have a Page Setup of the name specified, the "script" will be interrupted and that DWG will remain open in the editor.

 

I don't recommend trying to do all 3000 files at once, but you should be able to do fairly large chunks so that the job is done much more quickly than otherwise.

 

You can move the acaddoc.lsp file to another folder (if necessary) to process another group.  Be sure to delete (or rename) the LSP file after the DWGs are processed.  (You will probably have to shut down AutoCAD in order to delete it.) 

 

If you run into any problems, I'll be back on Monday Smiley Wink

 

Message 26 of 30
Viclordbelial
in reply to: dmfrazier


@dmfrazier wrote:

"The name could be Page_setup."

 

Okay, I will assume it is.Smiley Happy

 

The attached ZIP file contains two files:

SetPlotConfig.lsp - Place a copy of this file in one of the folders listed in your AutoCAD Support Files Search path.

XXacaddoc.lsp - Place a copy of this file in a folder containing DWGs you want to process.

 


Hi,

 

Can you describe what your files do? Im interester to know.

 

I have a question to.

 

In the SetPlotConfig.lsp:

 

(princ (load "SetPlotConfig" "\n**Unable to load SetPlotConfig.lsp"))
(if SetPlotConfig
  (SetPlotConfig "Page_Set");Replace inside quotes with your Page Setup Name
  (princ "\n**SetPlotConfig.lsp is not loaded")
)
(command "qsave")
(command "close" "y")

 

And in the XXacaddoc.lsp:

 

(princ (load "SetPlotConfig" "\n**Unable to load SetPlotConfig.lsp"))
(if SetPlotConfig
  (SetPlotConfig "PageSetupName");Replace inside quotes with your Page Setup Name
  (princ "\n**SetPlotConfig.lsp is not loaded")
)
(command "qsave")
(command "close" "y")

 

The question is: The only differance is the SetPlotConfig name. And the Name is not the one I told you. It is normal? Do I have to change it?

Message 27 of 30
dmfrazier
in reply to: Viclordbelial

"The only differance is the SetPlotConfig name. And the Name is not the one I told you. It is normal? Do I have to change it?"

 

In my rush to get this sent to you before the holiday break, apparently one of the files I placed in the ZIP file was not the right file.  Please disregard the previous ZIP file and use the files in the new ZIP attached here.  I apologize for the confusion.

 

Also, in the acaddoc.lsp file, I changed the name of the page setup to match what you had indicated in an earlier message.

 

"Can you describe what your files do? Im interester to know."

 

Acaddoc.lsp automatically runs as each DWG file ("document") is opened.  It loads the SetPlotConfig.lsp function (or issues an alert message if it's not found).  If it loaded successfully, it runs the function, passing it your page setup name as an argument (otherwise it issues an alert message).  Then it QSaves the file and Closes the file.

 

SetPlotConfig.lsp takes the page setup name argument and sets that page setup current in (applies it to) the current layout (assuming the page setup exists and is of the correct type for the current layout).

 

Message 28 of 30
Anonymous
in reply to: Viclordbelial

Oh ! I can use a Macro to active each pagesetup to the model and layouts?

Message 29 of 30
Viclordbelial
in reply to: dmfrazier

Good! It works. But..

 

I have some drawing with this probleme: The Layout is rename to a other thing. Exemple: 8000. So it do not apply the Page_setup to the layout...

 

I think I gona ask you 2 thing:

 

Did the "Object" (Model) can be rename? (I try and it can't be rename but if it can, I gona have difficulty to apply the Page_setup to the Model if it change name)

 

If Model can't be rename, I gona use the script to apply the Page_setup to the model instead. Sorry to ask you to do the script for the layout.

 

Thanks a lot!

 

Message 30 of 30
dmfrazier
in reply to: Viclordbelial

It should not matter what the layout is named, as long as it is a paperspace layout and it is current, the page setup will be "applied" to it.  There is nothing in the code that checks or specifies a layout name.

 

I would not recommend switching gears and trying to automate applying a page setup to the Model tab.  It may work out if the page setup plots extents and is scaled to fit, but I think you're still better off staying with layout, especially if all the DWGs are already set up.

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

Post to forums  

Autodesk Design & Make Report

”Boost