Merge multiple files/folios into one file
Sebastien3489
Posted messages
14
Status
Member
-
cricri1461 -
cricri1461 -
Hello everyone,
While drawing electrical plans on third-party software, when converting all my sheets into .dwg, a file is created for each sheet.
For example, if I have 5 sheets, I end up with 5 files.
Some clients being a bit reluctant to the idea of having one file per sheet, I always group them together manually, side by side.
When there are 5 sheets, it’s manageable. When there are 30, it becomes less easy.
Our sheets always have a standard format, either A4 landscape or A3 landscape.
Is it possible to create a macro in AUTOCAD that allows the software to retrieve all the files from a selected folder and arrange them side by side in the order of the folder?
I’ve already found something on other forums, but I always encounter an error unfortunately.
Thank you.
Configuration: Windows 7 / Mozilla 11.0
While drawing electrical plans on third-party software, when converting all my sheets into .dwg, a file is created for each sheet.
For example, if I have 5 sheets, I end up with 5 files.
Some clients being a bit reluctant to the idea of having one file per sheet, I always group them together manually, side by side.
When there are 5 sheets, it’s manageable. When there are 30, it becomes less easy.
Our sheets always have a standard format, either A4 landscape or A3 landscape.
Is it possible to create a macro in AUTOCAD that allows the software to retrieve all the files from a selected folder and arrange them side by side in the order of the folder?
I’ve already found something on other forums, but I always encounter an error unfortunately.
Thank you.
Configuration: Windows 7 / Mozilla 11.0
5 answers
-
Hello,
I'm directing you to a site that seems to have already addressed this issue.
http://cadxp.com/topic/26514-assembler-plusieurs-dwg-en-1-seul/
Otherwise, show me what you've found that isn't working, maybe I could fix this macro.
See you! -
Thank you.
I tested this solution:
https://cadxp.com/#entry46469
(2nd post)
Unfortunately, I have an error:
Duplicate definition of the EPLFRAME block ignored.
; error: Automation error Key not found
Thank you.
Sébastien D.-
Hi,
The message Definition of the EPLFRAME block ignored just indicates that the EPLFRAME block already exists in the current drawing, and you are trying to insert a drawing that contains a block of the same name, which will not be redefined. This is not an error, just a warning.
I tried the lisp and it works. However, the modification proposed in the following post contains an error:
Since your object is in vlisp, you could also do
(vla-move ojb (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point next_ins))
instead of
(command "_.move" (entlast) "" "_none" ll "_none" next_ins)
You need to use
(vla-move obj (vlax-3d-point '(0.0 0.0 0.0)) (vlax-3d-point next_ins))
Hoping to have helped you. See you later.- Yoda,
By chance, I changed the name of my files and it seems to be working.
My files are named as follows: "=TD 2.1+01_6" with
- =TD 2.1 being the name of the table
- +01 the revision of the diagram
- _6 for folio 6
By changing the name, it works. Is it possible for it to work with this same file name, generated by my drawing software?
Also, the folio included consists of a block, and I can't dissociate it. The client therefore cannot make modifications when they want to do their As-built. I tried to select everything and dissociate it but without success.
I made the modification but my folios are no longer next to each other.
Thank you very much anyway. I think I will finally find a solution to my problem.
Sébastien
-
-
Thank you ;)
Indeed, it works. I managed to extract my .dwg files named: 1.dwg, 2.dwg, ... and it is even simpler.
However, how does Autocad choose the order of insertion for the files? Indeed, it inserts them in an illogical order...
Is it possible to impose an order of insertion? File 1.dwg then 2.dwg, ... up to 100-200?
Thank you-
Hello,
The list is created as it is returned by the system.
To get a sorted list, you need to use a sorting function.
Fortunately, there is a ready-made one, vl-sort.
Here’s how to modify the program (just one line to change).
(setq
lst_dwg (vl-sort (vl-directory-files prefix "*.dwg" 1) '<)
next_ins pt_ins
delta_x 0.0
delta_y 0.0
last_pt nil
)
See you later! -
Hi,
Unfortunately, it's not working.
It still injects the files in the wrong order.
I tried renaming the file to folio 1.dwg, folio 2.dwg but to no avail...
My lisp: https://www.wetransfer.com/downloads/33987be8e39b8c06f7f08b8f0a9aaa5920150410193705/5b46529fab6d45de6a27986dfd97c1f520150410193705/c95bbc
Thanks ;) -
Did you save the modified file correctly?
Did you reload the new lisp correctly?
Enter this line of code in the autocad command line
(vl-sort '("folio 2.dwg" "folio 1.dwg") '<)
You should have seen this result, proof that it works
("folio 1.dwg" "folio 2.dwg")
Make sure to reload the modified lisp. See you! -
-
-
-
Yoda,
I've done a series of tests and it seems to be working ;)
I change the names of my files via a macro in Excel and AutoCAD places the files in the requested order ;).
However, in an effort to automate even further, is it possible to launch the application and have it work like this:
1. I open AutoCAD (OK now)
2. I load the macro (OK now)
3. I run the macro (OK now)
4. I choose the insertion point + format
5. I select the file (OK now)
6. All the sheets are inserted (OK now)
7. The macro selects all the sheets + launches the DECOMPOS function (I've looked for a solution but without success) (Currently, I do ctrl+a + DECOMPOS)
8. The macro opens the save window to save the file
9. The macro deletes all the sheets and goes back to point 5 for a second series of plans while keeping the insertion point + format
Thank you ;)-
-
Yoda,
I tested the loop and it seems great.
Is there a way for Autocad to remember the file path of the list of files?
Indeed, when I save each series of folios, Autocad retains the file path, but to open the "template" file, I always have to navigate through my folders and subfolders to get there.
Thank you.- Hello
Try modifying these lines
(defun c:cahier_bloc ( / old_osmd prefix pt_ins pt_tmp lst_dwg n dx dy loop key pt pt_last obj ll ur lg loop init-dir);modify this line
;
;
;
(setq loop "Yes")
(setq init-dir "");add this line
(while (= loop "Yes")
(setq prefix (strcat (vl-filename-directory (getfiled "Select a DWG TEMOIN file" init-dir "dwg" 16)) "\\"));modify this line
See you later
-
-
-
Yoda,
Unfortunately, without success.
I uploaded my macro but I think everything is fine.
Thank you
https://www.wetransfer.com/downloads/3a58a186f6d54dc91bf5e62052326b1420150423181650/77e9dd0737e33a2c78b459415fc5847620150423181650/212552-
-
-
Hello sébastien3489
I'm currently working on electrical schematics, and I'm also looking for a way to combine all the electrical schematic sheets into a single file. (One file is much more convenient for clients, especially with a small hundred pages!)
I tried to make all the modifications in your post and several other posts, but it doesn't work! Could you share your lisp?
Thanks
-