Export multiple layouts to dwg (model space) from multiple sheet files (dwg)

Export multiple layouts to dwg (model space) from multiple sheet files (dwg)

neil96VHF
Participant Participant
10,419 Views
41 Replies
Message 1 of 42

Export multiple layouts to dwg (model space) from multiple sheet files (dwg)

neil96VHF
Participant
Participant

Hi All,

 

Does anyone know of a workflow to export Autocad (paper space) layouts to dwg (model space) from multiple separate sheet dwg files?

 

The project is composed of multiple folders containing separate sheet files. The layouts show xref'd drawings from model space files contained in separate model folders. I can see how to export the layout from inside an individual sheet file but have been asked for model space versions of all of the layouts from all of the sheet files.

 

Im assuming this is only possible through a third party addon, any suggestions would be much appreciated 🙂

0 Likes
Accepted solutions (2)
10,420 Views
41 Replies
Replies (41)
Message 2 of 42

pendean
Community Legend
Community Legend

@neil96VHF wrote:

Hi All,

 

Does anyone know of a workflow to export Autocad (paper space) layouts to dwg (model space) from multiple separate sheet dwg files?


Does the built-in EXPORTLAYOUT command not work for you by chance https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-8A07D165-559E-4DF2-B2A9-42BD6AE2DB70 

0 Likes
Message 3 of 42

neil96VHF
Participant
Participant

Yes it works for a single sheet file, Im looking for a way to automate the process across multiple sheet files? Ref: screen grabs from original message.

We submit entire drawing packages to clients with the potential for a package to be in excess of 30 layouts to export layouts one at a time is extremely time intensive.

0 Likes
Message 4 of 42

pendean
Community Legend
Community Legend

@neil96VHF wrote:

Yes it works for a single sheet file, Im looking for a way to automate the process across multiple sheet files? Ref: screen grabs from original message.

We submit entire drawing packages to clients with the potential for a package to be in excess of 30 layouts to export layouts one at a time is extremely time intensive.


So you know about it? or just tested it to find out about it?

 

Autodesk has covered the topic in HELP, it leads to this page for me when I just explored it

https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/Automatically-expo...

which leads to this 3rd party resource https://apps.autodesk.com/ACD/en/Detail/Index?id=8797014408094829177&appLang=en&os=Win32_64&autostar...

aka what you seek. It also explains you need to pick up a multi-DWG processor, either theirs on find something free on the web if Autodesk's Scriptpro  tool is not what you want either 

 

HTH

 

0 Likes
Message 5 of 42

neil96VHF
Participant
Participant

Thanks @pendean, I did discover the same article but assumed the addon it only works with a single Feb containing multiple layouts. 

 

I'll test it tomorrow with the batch function and hopefully reach the solution. 

 

The last two links in your message point to the same add-on, is the scriptPro link meant to go somewhere else?

 

Thanks so much for all of your help!

0 Likes
Message 6 of 42

pendean
Community Legend
Community Legend

Thanks @neil96VHF for the heads up, I fixed the link to ScriptPro.

 


@neil96VHF wrote:

...but assumed the addon it only works with a single Feb containing multiple layouts. ...


 

Indeed, that's what the product page says

pendean_1-1704922948064.png

 

 

 

0 Likes
Message 7 of 42

neil96VHF
Participant
Participant

Thanks again Pendean,

 

Ive downloaded and had a quick look but cant see a function in the smartBatch addon, did you include a link to the scriptPro because I need a script to run on the batch through smartBatch?

0 Likes
Message 8 of 42

Ed__Jobe
Mentor
Mentor

@pendean  was saying NOT to use ScriptPro. ScriptPro is a batch utility like smartBatch, but it can be slow, because it restarts AutoCAD for each dwg using the /p switch. It's simple and easy to use, but it has that one drawback.

Ed


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.
How to post your code.

EESignature

0 Likes
Message 9 of 42

neil96VHF
Participant
Participant

Ok, understood. Do I use smartBatch with LayoutToDwg or as a standalone? If so can you screen shot the bit of dialogue that enables me to do, what I'm trying to do?

0 Likes
Message 10 of 42

Ed__Jobe
Mentor
Mentor

First, I misread @pendean comment about ScriptPro. Comparing it to smartBatch (which I don't have any experience with), ScriptPro is free. Although smartBatch is not free, it includes powerful purging tools, which saves you from writing your own scripts. Both work by executing an *.scr file on a dwg. You build a 'batch' by selecting dwgs with it's UI. Then the script is run on each file.

 

LayoutsToDwgs is just a single AutoCAD command that you can write a script for. A script is just what you would type at the command line. Since you can type lisp at the command line, a script can include lisp too. From what I read on Jimmy's website, this command creates a dwg with a single layout. It doesn't copy the layout contents to model space like you requested. But you can script that too. Just use the COPY command and then SCALE the layout using the viewport scale. It might be tricky though to get the layout contents to line up with the modelspace contents.

Ed


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.
How to post your code.

EESignature

0 Likes
Message 11 of 42

neil96VHF
Participant
Participant

Yes exactly, all I want to do is batch export layouts from a whole drawing package (folder). The built in ExportLayout command does exactly what I want on a single open file but has no batch option. I 'm sure, for someone who knows Lisp, writing a simple lisp routine for a single command is very basic.

 

The workflow is: EXPORTLAYOUT at the command line > specify destination > save.

 

This results is the paper space layout being saved in model space in a separate file and location at 1:1 ie 594 x 841mm for A1 ect. See attached. There is no need to scale or purge.

 

Thanks to everyone who has taken time to respond to this ticket, your help is much appreciated.

 

Paper Space

Screenshot 2024-01-11 at 16.20.11 1.png

Model Space

Screenshot 2024-01-11 at 16.20.49.png

 

 

0 Likes
Message 12 of 42

Ed__Jobe
Mentor
Mentor

To write a script for that, using the instructions I linked to previously, open Notepad and type what you would type at the command line. In lisp and scripts, a space equals [Enter]. Save it as an *.scr file. Then use ScriptPro to run the script file on a batch of dwgs.

Ed


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.
How to post your code.

EESignature

0 Likes
Message 13 of 42

neil96VHF
Participant
Participant

Thats really helpful, am I right in thinking that I'd need to include a line in the script file to handle the destination folder dialogue?

 

On executing EXPORTLAYOUT at the command line you are taken to:

neil96VHF_0-1704992287631.png

This save as dialogue:

neil96VHF_1-1704992378684.png

Would it be possible to tell the script to save all of the batch files to a specified folder?

 

0 Likes
Message 14 of 42

Ed__Jobe
Mentor
Mentor
Accepted solution

You can't do a batch if you have to respond to dialogs. Set FILEDIA to 0. The easiest way is to just hard code the path to the folder to save to. Remember to set FILEDIA back to 1 at the end of the script. Here's a sample script. It saves each file to the same folder as the host dwg and suffixes the filename with the layout name. Save the contents to a scr file. Make sure that Notepad doesn't add txt to the end. Test it out on one dwg. Then run it in ScriptPro.

 

;;; *********************
;;; setq global variables
;;; *********************
(vl-load-com)
(setvar "filedia" 0)
;;; get the application object
(setq *acadObj* (vlax-get-acad-object))
;;; get the currently active dwg
(setq *CurDoc* (vla-get-activedocument *acadObj*))
(setq f (vla-get-name *CurDoc*))
(setq layouts (vla-get-layouts *CurDoc*))
(vlax-for layout layouts
  (setq dwgpath (strcat (getvar "dwgprefix")
			(substr f 1 (+(strlen f)-4))
			"-"
  			(vla-get-name layout)
			".dwg"
		)
  )
  (command "EXPORTLAYOUT" dwgpath)
)
(setvar "filedia" 1)

 

 

Ed


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.
How to post your code.

EESignature

Message 15 of 42

neil96VHF
Participant
Participant

Thanks Ed,

 

Ive tested the script you have provided which definitely did something but has returned a fail message and no additional dwg files. Please see attached.

 

Is the script meant to be saved as ANSI / .scr or .lsp?

 

Many thanks for your time,

 

0 Likes
Message 16 of 42

Ed__Jobe
Mentor
Mentor

Is that the log file from ScriptPro?

 

To save the file, copy the text to Notepad. Click File>Save and change the files of type to All Files, then change the extension to ".scr". If you don't change it to All Files, Notepad will add the txt ext and you end up with ExportLayouts.scr.txt.

 

Test the script in AutoCAD on one file. Open a project file and type SCRIPT, then browse the the scr file.

Ed


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.
How to post your code.

EESignature

0 Likes
Message 17 of 42

neil96VHF
Participant
Participant

Do script files work like that on lt mac?

neil96VHF_0-1705076483488.png

neil96VHF_1-1705076533895.png

Im getting this as a warning.

neil96VHF_2-1705077572281.png

I tested with ScriptPro on a pc with full version but dont have access to it right now. The mac allows me to put script command in and locate the file though so should work right?

 

 

 

0 Likes
Message 18 of 42

Ed__Jobe
Mentor
Mentor

I've never used acad on a mac. The LT versions that support lisp, only do basic lisp. My script uses Visual Lisp, the functions that start with "vl-, vlax-". So it won't run on LT, Mac or pc. You have to use the full version.

 

Automatic Save is not a warning. AutoCAD saves the current dwg every 15 minutes (or whatever you have the interval set for).

Ed


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.
How to post your code.

EESignature

0 Likes
Message 19 of 42

neil96VHF
Participant
Participant

Hi Ed.Jobe

 

I have tested the script file on a single file on both AutoCad and AutoCad LT (PC) and both have worked. Following this I have run the script through scriptPro on a small batch of files. The app ran and has reported a status of done, as opposed to the previous attempt of status failed. Could it be that I am not using scriptPro right? 

 

Have you ran run the script through scriptPro yourself?

 

Many thanks,

 

Neil

0 Likes
Message 20 of 42

Ed__Jobe
Mentor
Mentor

Yes, I tested it on ScriptPro with a dwg that had a dozen layouts. I'm not sure why it failed, since I don't know what your did. Maybe it failed on Mac? But at least it's working now.

Ed


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.
How to post your code.

EESignature

0 Likes