CAD Forum - Database of tips, tricks and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
Czech English Deutsch
Login/Register:
 Visitors: 3385 
RSS tips RSS channel - CAD tips
RSS discussion RSS channel - CAD discussion

Discussion Discussion forum

HelpCAD discussion

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.

How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

The information that you provide in this form will make up your forum profile which can be viewed by other forum members. Your email address will only be visible by forum admin and moderators and will be used to send you Forum Notifications. To cancel your account, use the page Opt-out or contact webmaster@cadforum.cz.

Help Combining files

 Post Reply Post Reply Page  <12
Author
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2019
Status: Offline
Points: 521
Post Options Post Options   Thanks (0) Thanks(0)   Quote Kent Cooper Quote  Post ReplyReply Direct Link To This Post Posted: 27.Dec.2019 at 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?
Back to Top
AGST View Drop Down
Newbie
Newbie


Joined: 23.Dec.2019
Location: Portugal
Using: Autocad, Eplan
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote AGST Quote  Post ReplyReply Direct Link To This Post Posted: 27.Dec.2019 at 14:48
Originally posted by Kent Cooper Kent Cooper wrote:

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?

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.


Edited by AGST - 27.Dec.2019 at 14:49
Back to Top
Kent Cooper View Drop Down
Senior Member
Senior Member


Joined: 12.Mar.2013
Location: United States
Using: AutoCAD2019
Status: Offline
Points: 521
Post Options Post Options   Thanks (1) Thanks(1)   Quote Kent Cooper Quote  Post ReplyReply Direct Link To This Post Posted: 27.Dec.2019 at 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
Back to Top
AGST View Drop Down
Newbie
Newbie


Joined: 23.Dec.2019
Location: Portugal
Using: Autocad, Eplan
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote AGST Quote  Post ReplyReply Direct Link To This Post Posted: 30.Dec.2019 at 09:27
Originally posted by Kent Cooper Kent Cooper wrote:

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.

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!!!
Back to Top

Related CAD tips:


 Post Reply Post Reply Page  <12
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,109 seconds.