Display full version of the post: Help Combining files

AGST
23.12.2019, 11:42
Hello all!I'm new to this forum and what led me here was my new job as a CAD Designer!  I have a work in hands where i need to take multiple DWG files and create a master one where all of them are displayed in a single sheet, side by side in 10 rows filled from top to bottom, left to right.I added a image of what is intended:If i do this manually it takes a lot of time, so i seek your help, asking if you know any program that does this job automatically.Thank you in advance!Best Regards!

John Connor
23.12.2019, 12:29
And just how big is the "single" sheet that will hold all twelve drawings?

AGST
23.12.2019, 12:36
Thank you for the quick reply!There isn't a predefined size and the 12 sheets is an example, normally is 30+ files in the same sheet.This is a client requirement, he wants a single sheet with all the drawings in it...This is a finished example of what the client wants, done manually:Thank you in advance for your help!

Kent Cooper
23.12.2019, 14:57
You may be able to use BlockChart.lsp with its BC command, available >here<.  It goes from lower left in horizontal rows, and builds upward from there, but could be modified to do the sequence you describe instead, and to space things farther apart than it does [you can do that yourself by changing the 1 value assigned to the 'space' variable], if it otherwise does what you want.  It needs you to have all those drawings in one folder, with no other drawing files in that folder, and the current drawing limits need to be wide enough in the X direction for a reasonable number of them to make a row, or the whole collection will be stacked in one tall column.But I do wonder:  do any of your drawings have Xref's in them?  I can imagine that being a problem....
Kent Cooper2019-12-23 14:57:32

AGST
23.12.2019, 15:32
Thank you for your reply.Our drawings are all single layered. They dont have any xref's in them.I'm going to try your solution, i'm afraid the .lsp file won't run on our programs.PS: The link you mentioned redirects to this post...
AGST2019-12-23 15:35:40

Kent Cooper
23.12.2019, 17:28
Try this:https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-to-update-2-useful-lisp/m-p/8778578/highlight/true#M384961What makes you afraid it won't run?  Are you using AutoCAD LT that can't use AutoLisp (your info lists AutoCAD without any elaboration)?
Kent Cooper2019-12-23 17:34:14

John Connor
24.12.2019, 13:09
Your client will be looking at postage stamps when you're done.

AGST
26.12.2019, 08:44
[QUOTE=John Connor]Your client will be looking at postage stamps when you're done.[/QUOTE]
Don't ask me why, but it's a demand they make!

AGST
26.12.2019, 13:00
[QUOTE=Kent Cooper]You may be able to use BlockChart.lsp with its BC command, available >here<.  It goes from lower left in horizontal rows, and builds upward from there, but could be modified to do the sequence you describe instead, and to space things farther apart than it does [you can do that yourself by changing the 1 value assigned to the 'space' variable], if it otherwise does what you want.  It needs you to have all those drawings in one folder, with no other drawing files in that folder, and the current drawing limits need to be wide enough in the X direction for a reasonable number of them to make a row, or the whole collection will be stacked in one tall column.But I do wonder:  do any of your drawings have Xref's in them?  I can imagine that being a problem....
[/QUOTE]
Hi Kent, the BlockChart.lsp worked like a charm, it did in fact a single column of all the files, can you help me modify the code so that a new column is used when it reaches 10 rows?Ty in advance

AGST
27.12.2019, 10:51
Hi guys!!!I seek your help please!!The code that Kent so kindly provided, sorts the DWG's from bottom left to top in a single column.I need to modify it, so it sorts from top left to bottom and left to right in 10 rows per column.Here's the code:(defun C:BC (/ blkfolder space nextLL rowht rowL blkLL blkUR objwid objht)  (vl-load-com)  (setvar 'osmode 0)  (alert "Pick OK here, then double-click any file in desired folder: ")  (setq    blkfolder (getfiled "Find folder" "" "dwg" 0)    blkfolder (substr blkfolder 1 (1+ (vl-string-position 92 blkfolder 1 T))); path without dwg name    space 100 ; between blocks and min. from limits <------ set as desired    nextLL (mapcar '+ (getvar 'limmin) (list space space 0)); lower left of next block    rowht 0 ; height of tallest block in row    rowL nextLL; left end of baseline of row  ); end setq  (foreach blk (vl-directory-files blkfolder "*.dwg" 1)    (command "_.insert" (strcat blkfolder blk) (getvar 'viewctr) "" "" "")    (vla-getboundingbox (vlax-ename->vla-object (entlast)) 'minpt 'maxpt)    (setq      blkLL (vlax-safearray->list minpt)      blkUR (vlax-safearray->list maxpt)      objwid (- (car blkUR) (car blkLL))      objht (- (cadr blkUR) (cadr blkLL))    )    (if (> (+ (car nextLL) objwid space) (car (getvar 'limmax)))      (setq ; then - start new row above previous row        nextLL (polar rowL (/ pi 2) (+ rowht space))        rowL nextLL        rowht 0      ); end setq    ); end if - no else [next in current row]    (command "_.move" (entlast) "" blkLL nextLL)    (setq nextLL (polar nextLL 0 (+ objwid space)))    (if (> objht rowht) (setq rowht objht))  ); end foreach); end defunCan anyone give some help please?Thank you in advance!

Kent Cooper
27.12.2019, 14:14
That shouldn't be difficult, but first:How should the location of the first one be determined?  Ask the User?  Something in relation to the drawing limits?  Some fixed location every time?

AGST
27.12.2019, 14:48
[QUOTE=Kent Cooper]That shouldn't be difficult, but first:How should the location of the first one be determined?  Ask the User?  Something in relation to the drawing limits?  Some fixed location every time?[/QUOTE]
Thank you for the quick reply Kent.The location of the first one doesn't matter, it can even start at (x=0,y=0), as long as the imported DWG's follow the disposition from top to bottom and left to right and mantain 100 units between each one (horizontally and vertically).Vertically a max of 10 rows, then it starts another column from the top.Thank you in advance for your time.
AGST2019-12-27 14:49:37

Kent Cooper
27.12.2019, 21:09
Try this -- very minimally tested.  It complains if drawings contain Xlines or Rays [it can't find their extents] or Xrefs [it doesn't like Inserting], but in the absence of such things, it seems to work.(vl-load-com)(defun C:BC (/ blkfolder space nextUL colwd colUL blkLL blkUR blkwd blkht)  (setq osm (getvar 'osmode))  (setvar 'osmode 0)  (alert "Pick OK here, then double-click any file in desired folder: ")  (setq    blkfolder (getfiled "Find folder" "" "dwg" 0)    blkfolder (substr blkfolder 1 (1+ (vl-string-position 92 blkfolder 1 T))); path without dwg name    space 100 ; between blocks and min. from limits <------ set as desired    colUL (list space (- space) 0); upper left of first column [one space-width to right of and below 0,0]    nextUL colUL ; for first Block    rowno 1    colwd 0 ; width of widest block in column [to set X coordinate of next column]  ); end setq  (foreach blk (vl-directory-files blkfolder "*.dwg" 1)    (command "_.insert" (strcat blkfolder blk) (getvar 'viewctr) "" "" "")    (vla-getboundingbox (vlax-ename->vla-object (entlast)) 'minpt 'maxpt)    (setq      blkLL (vlax-safearray->list minpt)      blkUR (vlax-safearray->list maxpt)      blkwd (- (car blkUR) (car blkLL))      blkht (- (cadr blkUR) (cadr blkLL))    ); setq    (if (= rowno 11)      (setq ; then - start new column to right of previous column        colUL (polar colUL 0 (+ colwd space))        nextUL colUL        colwd 0        rowno 1      ); setq    ); if - no else [next in current column]    (command      "_.zoom" "_object" (entlast) ""      "_.move" (entlast) "" (list (car blkLL) (cadr blkUR)) nextUL    ); command    (setq      nextUL (polar nextUL (* pi 1.5) (+ blkht space))      rowno (1+ rowno)      colwd (max blkwd colwd)    ); setq  ); foreach  (setvar 'osmode osm)  (command "_.zoom" "_extents")  (princ)); defun

AGST
30.12.2019, 09:27
[QUOTE=Kent Cooper]Try this -- very minimally tested.  It complains if drawings contain Xlines or Rays [it can't find their extents] or Xrefs [it doesn't like Inserting], but in the absence of such things, it seems to work.[/QUOTE]
Hello Kent,I can't thank you enough for your help...It's perfect!!! It's exactly what i needed!!!You just saved my life!!!I wish you the best!!!And a happy new year!!!

AGST
09.03.2020, 12:00
[QUOTE=Kent Cooper]Try this -- very minimally tested.  It complains if drawings contain Xlines or Rays [it can't find their extents] or Xrefs [it doesn't like Inserting], but in the absence of such things, it seems to work.[/QUOTE]
Hello Kent, i hope the new year is running well for you.I'm here asking for your help once more, so i thank you in advance for your time.Problem: Let's suppose i have a DWG with all the drawings inside him, but when i plot the file to a PDF, i need it to output one drawing per page, instead of the whole drawing in one sheet. Is it possible?At the moment, i need to select each drawing manually and add it as windows to the final plot file. Using this method i'm prone to mistakes due the monotous task of selecting alot of them manually.I hope you can help me, thank you once again for your time.

philippe JOSEPH
09.03.2020, 12:58
Hello AGST, try this command : +PUBLISH ( GB ) , +PUBLICAR ( POR ).It can be difficult to get it well and in any case set correctly the print settings at least of the first page.

AGST
09.03.2020, 15:08
[QUOTE=philippe JOSEPH]Hello AGST, try this command : +PUBLISH ( GB ) , +PUBLICAR ( POR ).It can be difficult to get it well and in any case set correctly the print settings at least of the first page.[/QUOTE]
Hello Joseph, that method only prints one sheet with all the drawings on it, i need a routine that marks each drawing as an individual window, so that when i plot, each drawing is considered as a page in the PDF.The drawings are evenly spaced in the main file, as a result of a merge made from the routine above.