Jump to content

Recommended Posts

Posted

Everyone, i work for a structural engineering company, and quite a few of our jobs have 100+ drawings. Usually we create a drawing register showing all of our drawings and their revisions in Excel, but we also like to have a drawing list on our front page so when people recieve our drawings they don't need to look at the register to find out where to go to find each drawing. In the past we have tried to link our excel spreadsheet to Autocad but have not had very good results.

 

What i am hoping for is a macro/lisp that will read the DWG name from the specific folder, and create text in autocad to put on our first drawing for that job. For example we want a drawing list on our drawing number 01. Our DWG files are named similar to the following: 200902-A-Level 1 Plan.dwg (being the job number-revision-drawing name. I am hoping there is some kind of way i can get that information extracted (minus the job number) and put into text on our first drawing. Either that or if it could read the drawing name and revision from the title block. Obviously the macro would have to read from that job folder only.

 

Is there anyone else who does something similar to this? or has a better alternative? Like i said iver tried exporting our excel spreadsheet into the first drawing but we have problems with the size, cropping etc.

 

thanks for any help

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    11

  • gazzalp

    7

  • MarcoW

    3

  • JohnM

    1

Top Posters In This Topic

Posted Images

Posted

Instead of inserting excel have you given any thought to coping the data to AutoCAD.

Open you excel worksheet

Highlight the data

Use CTRL+C or edit copy or whatever you use to copy to the clipboard

In AutoCAD go to the EDIT menu and select PAST SPECIAL

In the dialog box select AutoCAD entities from the list

Click OK and park it.

Takes all of 10 seconds.

Posted

Yes thats true but than anytime we issue drawings we have to do that, we issue drawings every day. I want something where i dont have to open excel, id rather just issue autocad drawings and not worry about any other programs. I then also have to add any new drawings into excel which means typing them out and adding the revisions; but im sure theres a way to get the computer to do it for me.

Posted

Have you looked into using 'sheetsets'? You can do this with easily with a sheetset option but it will be time consuming to get to that stage, you will have to re-create the titleblock used (inserting in fields rather then attributes) and then when working with the project, linking all the drawings (you can link in existing drawings) to the sheetset. Doing this, you have the option of creating an 'autopopulating' drawing list (and a bunch of other options in there) into a table format. This table can be easily updated by right-clicking on it and using 'autoupdate data links'.

 

Without getting too far ahead, you may want to check out 'sheetsets'.

Posted

I'd spend the time and setup sheetsets, but this should get you started...

 

(defun c:Dir2Text (/ #Pnt1 #Pnt2 #List #String)
 (cond
   ((and (setq #Pnt1 (getpoint "\nSpecify first corner: "))
         (setq #Pnt2 (getcorner #Pnt1 "\nSpecify opposite corner: "))
    ) ;_ and
    (setq #List   (vl-sort (vl-remove-if-not
                             '(lambda (x) (wcmatch x "*.dwg"))
                             (vl-directory-files (getvar 'dwgprefix))
                           ) ;_ vl-remove-if-not
                           '<
                  ) ;_ vl-sort
          #String ""
    ) ;_ setq
    (foreach x #List (setq #String (strcat #String (vl-filename-base x) "\\P")))
    (AT:MText #Pnt1 #String (abs (- (car #Pnt1) (car #Pnt2))) nil 1)
   )
 ) ;_ cond
 (princ)
) ;_ defun

 

You'll need this subroutine to create the text: http://www.cadtutor.net/forum/showpost.php?p=278945&postcount=40

Posted

@ Gazzalp:

I know exactly what you mean ! Been here and there asking for help but it don't really got me an answer. So I figured to try something for my own.

 

First of all the sheet sets: it works in a different way than you and I want. We need a rgister sheet where all the info out of the titleblock is gathered.

 

Example (just a quick idea):

nr. descr. date size

01 - 04 1st floor 01-10-2009 ISOA1

02 - 04 2nd floor 01-10-2009 ISOA1

03 - 04 3rd floor 01-10-2009 ISOA1

04 - 04 4th floor 01-10-2009 ISOA1

 

Whenever one of the titleblocks are modigied it should be changed in the register.

 

That is what you mean am I right?

 

My guess is that it can be done with the "eattext" command in Autocad. It already works in my situation only there are some issues that I can't solve. (Sorting tables etc..)

 

So for now, at this moment, I can't give you a real solution but you should try to experiment with the command. Please feel free to ask me for I am just in need as you are to solve this.

 

Also search the forum with keywords "eattext" or "drawinglist".

Look, I've been trying...:

http://www.cadtutor.net/forum/showthread.php?t=37813&highlight=eattext&page=3

Posted

Cadologist - Ive looked into sheet sets for other things, i cant say i was a fan of them. They would take a lot of getting used to, and then ive got another 20 people to try and teach, so thats not the best solution for me i dont think. thanks though.

 

Alanjt - What exactly does this lisp do and how do i go about incorporating it?

 

MarcoW - you are correct thats what i am after, but it doesnt neccisserily have to read it from the title block. our dwg names also include the drawing number, title and revision, so it could read it from the dwg name if possible. I will have a go at the eattext command shortly, thanks

Posted

Marco, i have played around with eattext and it works pretty well. A couple of problems i have found that you might know how to overcome:

 

1. i am extracting from our titleblock, where our drawing name is over two lines. Therefore the attrbutes are "drawing title line 1" and "drawing title line 2". When extracting this information autocad puts it into a table, but with the rows "drawing title line 1" and "drawing title line 2" whereas i would prefer if in the table it was just called "drawing title" and both titles would come under that one row. Any ideas on how to fix this?

 

2. my only other problem so far is say for example i do this for a job, and then later add one more drawing. Rather then again either doing this command, or manually typing in the new drawing is there a way to update? ie. just add the one drawing to this table in order? It would be great if when i first select the drawings i want to extract from, i could instead select the whole job directory. That way in the future when i select the table and "refresh" it would add any more drawings that i have since added because it knows to update from the directory.

Posted

I will try to post reaction tonight or else tomorrow. (No time to do so now...)

 

One question, where are you from (country)?

Posted

Alanjt - What exactly does this lisp do and how do i go about incorporating it?

Did you actually try it?

Posted

You'll have to excuse the directory list, I'm at home...

 

Dir2Text.jpg

 

It will collect all dwg names located in directory of current drawing and place them in an MText object, based on picked location.

Posted

This one will number them:

 

(defun c:Dir2Text (/ #Pnt1 #Pnt2 #List #String)
 (cond
   ((and (setq #Pnt1 (getpoint "\nSpecify first corner: "))
         (setq #Pnt2 (getcorner #Pnt1 "\nSpecify opposite corner: "))
    ) ;_ and
    (setq #List   (vl-sort (vl-remove-if-not
                             '(lambda (x) (wcmatch x "*.dwg"))
                             (vl-directory-files (getvar 'dwgprefix))
                           ) ;_ vl-remove-if-not
                           '<
                  ) ;_ vl-sort
          #String ""
    ) ;_ setq
    (foreach x #List
      (setq #String
             (strcat #String (itoa (1+ (vl-position x #List))) " - " (vl-filename-base x) "\\P")
      ) ;_ setq
    ) ;_ foreach
    (AT:MText #Pnt1 #String (abs (- (car #Pnt1) (car #Pnt2))) nil 1)
   )
 ) ;_ cond
 (princ)
) ;_ defun

 

Dir2Text-2.PNG

Posted

Slow day and I'm having a little fun...

 

Dir2Text.gif

 

(defun c:Dir2Text (/ #Pnt1 #List #String #Text #Read)
 (cond
   ((setq #Pnt1 (getpoint "\nSpecify first corner: "))
    (setq #List   (vl-sort (vl-remove-if-not
                             '(lambda (x) (wcmatch x "*.dwg"))
                             (vl-directory-files (getvar 'dwgprefix))
                           ) ;_ vl-remove-if-not
                           '<
                  ) ;_ vl-sort
          #String ""
    ) ;_ setq
    (foreach x #List
      (setq #String
             (strcat #String (itoa (1+ (vl-position x #List))) " - " (vl-filename-base x) "\\P")
      ) ;_ setq
    ) ;_ foreach
    (setq #Text (AT:MText #Pnt1 #String 0 nil 1))
    (while (eq 5 (car (setq #Read (grread T 15 2))))
      (redraw)
      (grvecs (list 7
                    #Pnt1
                    (list (car (cadr #Read)) (cadr #Pnt1))
                    (list (car (cadr #Read)) (cadr #Pnt1))
                    (cadr #Read)
                    (cadr #Read)
                    (list (car #Pnt1) (cadr (cadr #Read)))
                    (list (car #Pnt1) (cadr (cadr #Read)))
                    #Pnt1
              ) ;_ list
      ) ;_ grvecs
      (vla-put-width #Text (abs (- (car #Pnt1) (car (cadr #Read)))))
    ) ;_ while
   )
 ) ;_ cond
 (redraw)
 (princ)
) ;_ defun

Posted

alanjt - yes i have tried it and get the following error message: error: no function definition: AT:MTEXT

 

I put on mtext as per the subroutine then ran this lisp, it asked for corners which i gave and then gave the error. Im not sure how to use it or what it does...

 

Marco - i am from australia, why?

Posted
alanjt - yes i have tried it and get the following error message: error: no function definition: AT:MTEXT

 

I put on mtext as per the subroutine then ran this lisp, it asked for corners which i gave and then gave the error. Im not sure how to use it or what it does...

 

Marco - i am from australia, why?

 

You have to load the routine posted here and the AT:MText subroutine I linked. It's giving that error because AT:MText is not loaded.

Posted

I have loaded both and still get the same message. Could you advise me as to what this function actually does? the video files you posted here dont seem to show that it does what i want (maybe you only posted part of what it does?)

Posted

I have to jump on board here and reiterate / strongly emphasize sheet sets. Sheet Set manager can turn sheet management into a dream. As stated it will take time to get it started but it is more than worth the effort you put into it. You would have the solution to your current problem already licked if sheet set was implemented.

Posted
I have loaded both and still get the same message. Could you advise me as to what this function actually does? the video files you posted here dont seem to show that it does what i want (maybe you only posted part of what it does?)

 

You'll have to excuse the directory list, I'm at home...

 

[ATTACH]15117[/ATTACH]

 

It will collect all dwg names located in directory of current drawing and place them in an MText object, based on picked location.

 

This was a 'to get you started'. Until you post an actual example of what you want, it's difficult to decipher your paragraph. A picture is worth a thousand words.

 

 

If you are getting an error saying AT:MText, you do NOT have it loaded.

Posted
I have to jump on board here and reiterate / strongly emphasize sheet sets. Sheet Set manager can turn sheet management into a dream. As stated it will take time to get it started but it is more than worth the effort you put into it. You would have the solution to your current problem already licked if sheet set was implemented.

 

Ditto......

 

Why must we deal with this:warn.PNG

 

I'm sure there's a good reason (spam related), it's just annoying.

Posted

LoL

This is just turning into an exercise for fun...

 

I wanted to fix the 1-9 number to display as 01-09.

 

dir2text-3.PNG

 

(defun c:Dir2Text (/ #Pnt1 #List #Pos #String #Text #Read)
 (cond
   ((setq #Pnt1 (getpoint "\nSpecify first corner: "))
    (setq #List   (vl-sort (vl-remove-if-not
                             '(lambda (x) (wcmatch x "*.dwg"))
                             (vl-directory-files (getvar 'dwgprefix))
                           ) ;_ vl-remove-if-not
                           '<
                  ) ;_ vl-sort
          #String ""
    ) ;_ setq
    (foreach x #List
      (setq #Pos (1+ (vl-position x #List)))
      (if (< #Pos 10)
        (setq #Pos (strcat "0" (itoa #Pos)))
        (setq #Pos (itoa #Pos))
      ) ;_ if
      (setq #String (strcat #String #Pos " - " (vl-filename-base x) "\\P"))
    ) ;_ foreach
    (setq #Text (AT:MText #Pnt1 #String 0 nil 1))
    (while (eq 5 (car (setq #Read (grread T 15 2))))
      (redraw)
      (grvecs (list 7
                    #Pnt1
                    (list (car (cadr #Read)) (cadr #Pnt1))
                    (list (car (cadr #Read)) (cadr #Pnt1))
                    (cadr #Read)
                    (cadr #Read)
                    (list (car #Pnt1) (cadr (cadr #Read)))
                    (list (car #Pnt1) (cadr (cadr #Read)))
                    #Pnt1
              ) ;_ list
      ) ;_ grvecs
      (vla-put-width #Text (abs (- (car #Pnt1) (car (cadr #Read)))))
    ) ;_ while
   )
 ) ;_ cond
 (redraw)
 (princ)
) ;_ defun

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...