Author Topic: Publishing thousand+ drawings from a complicated file system  (Read 3002 times)

0 Members and 1 Guest are viewing this topic.

STHAL

  • Guest
Hello all,
         First a little background into my problem and a semi introduction as this is my first time here! I was recently hired at a mid sized engineering company where at the time I was hired due to my experience with solidworks. On my first day I was told that management decided that they no longer wanted me working in the division that uses solidworks but instead the one that uses autocad- a platform I hadn't really used before. So now I am trying to figure out the ins and outs of a new platform and have been having trouble finding away to print out thousands of drawings using the publish or plot command (this is my first "task" which is to print out a few projects as part of a technology transfer). It has become apparent that I was tasked this as I was the new guy and the company really doesn't have any GOOD way of doing these types of jobs so they just pass it onto whatever new guy comes around.

Printing normally wouldn't be too difficult to do except for the fact that we have a fairly complicated file system that is used to store drawings. As a result in order to add the drawings into the publisher I have to essentially navigate a dozen some folders going back and forth between them for every part. I timed myself and it essentially takes 1 minute per drawing to print it to the pdf over 1000 drawings this comes up to a whopping 2 full days just to print! From previous posts on this forum I was able to learn a little autolisp which I think could be used for this printing, if not autolisp then perhaps VBA (which I have yet to really look into).

Ok so a little more details on the problem at hand.
parts are put into drawings based on a filing system as follows:
each part is given an 8 digit number, the first 5 digits indicate the folder it is located, the last 3 digits indicate the file. Additionally the part has a prefix indicating if it is an "install", "assembly", "drawing" or "schematic" and a suffix indicating the sheet size. However for filing only the prefix is used but it is placed as a suffix in the filename (confusing i know). After the prefix which is used as a suffix the part has a 01, for reasons i don't understand. For example
Part A-07451808-D is an assembly located M:\drawings\07451\808A01.dwg . Part D-07460294-D is a drawing located M:\07460\294D01.dwg

Now lets say I want to print the following parts in this order:
07457340
07460284
07451642
07452993

This would mean I'd have to navigate between folders 07457, 07460, 07451, 07452 once in the publisher under add drawings. Multiply this 250 times and you can see why this would be frustrating! I had the idea of having an autolisp function that would read a text file that had the parts in order on it and then navigate the file sturcture to find the parts! sounds so simple! However I have been unable to find a way to programatically add parts to the publish command so instead I figured I'd programatically create a dsd file and then just open it up, The problem I've been having with this is I can't find any way to determine what layouts each file has without opening it where upon i can use the "Layoutlist" command.

As a workaround for the time being until I can get things running in a correct way I have my autolisp command reading a textfile finding all the parts within the file structure recording their locations in the file structure and then creating a batchfile which will copy all the parts into a centralized location that I can then go into autocad go to the plotter navigate to 1 folder, select all and publish.

All this long winded explanation gets to the following question: is there away to determine the layouts of a file without opening it up into the editor first? If not how would you suggest I go about this printing problem? Below is my code that I've been using:

printlist.txt (example)
Code: [Select]
07440989
07440994
07440995
07440996
07444310

printlist2.txt (example after running SortListLocs, see below)
Code: [Select]
M:\DRAWINGS\07440\989S01.dwg
M:\DRAWINGS\07440\994S01.dwg
M:\DRAWINGS\07440\995S01.dwg
M:\DRAWINGS\07440\996S01.dwg
M:\DRAWINGS\07444\310D01.dwg

SortListLocs.lsp
Code: [Select]
(defun c:SortListLocs (/ fname txtLine Fold1 Part1 PartLoc PartList)

;;(setq Fold1 " ")
(setq fname3 (open "O:/Public/Brakken-Thal/COPYMOVE/copymove.bat" "w"))
(setq fname2 (open "O:/Public/Brakken-Thal/COPYMOVE/PrintList2.txt" "w"))
(setq fname (open "O:/Public/Brakken-Thal/COPYMOVE/PrintList.txt" "r"))
(while (setq txtLine (read-line fname))
(setq Fold1 (substr txtLine 1 5))
(setq Part1 (substr txtLine 6 8))
(setq PartLocI (strcat "M:\\DRAWINGS\\" Fold1 "\\" Part1 "I01.dwg"))
(setq PartLocA (strcat "M:\\DRAWINGS\\" Fold1 "\\" Part1 "A01.dwg"))
(setq PartLocD (strcat "M:\\DRAWINGS\\" Fold1 "\\" Part1 "D01.dwg"))
(setq PartLocS (strcat "M:\\DRAWINGS\\" Fold1 "\\" Part1 "S01.dwg"))

(if (findfile PartLocI) (write-line PartLocI fname2))
(if (findfile PartLocA) (write-line PartLocA fname2))
(if (findfile PartLocD) (write-line PartLocD fname2))
(if (findfile PartLocS) (write-line PartLocS fname2))

(if (findfile PartLocI) (write-line (strcat "CD /D M:\\DRAWINGS\\" Fold1 " & COPY " Part1 "I01.dwg O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & CD /D O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & RENAME " Part1 "I01.dwg " txtLine ".DWG") fname3))
(if (findfile PartLocA) (write-line (strcat "CD /D M:\\DRAWINGS\\" Fold1 " & COPY " Part1 "A01.dwg O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & CD /D O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & RENAME " Part1 "A01.dwg " txtLine ".DWG") fname3))
(if (findfile PartLocD) (write-line (strcat "CD /D M:\\DRAWINGS\\" Fold1 " & COPY " Part1 "D01.dwg O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & CD /D O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & RENAME " Part1 "D01.dwg " txtLine ".DWG") fname3))
(if (findfile PartLocS) (write-line (strcat "CD /D M:\\DRAWINGS\\" Fold1 " & COPY " Part1 "S01.dwg O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & CD /D O:\\Public\\Brakken-Thal\\COPYMOVE\\DWGS & RENAME " Part1 "S01.dwg " txtLine ".DWG") fname3))

; (write-line PartLocA fname2)
; (write-line PartLocD fname2)
; (write-line PartLocS fname2)
)
(close fname)
(close fname2)
(close fname3)

;(setq fname3 (open "c:/TESTPLOTTER/Runme.scr" "w"))
;(write-line "dsd1" fname3)
;(setq fname4 (open "c:/TESTPLOTTER/PrintList2.txt" "r"))
; (while (setq txtLine (read-line fname4))
; (write-line "_.open" fname3)
; (write-line txtLine fname3)
; (write-line "dsd2" fname3)
; (write-line "_.close" fname3)
; )
;(close fname4)
;(write-line "_.open" fname3)
;(write-line "M:\\DRAWINGS\\999\\99995D01.DWT" fname3)
;(write-line "dsd3" fname3)
;(close fname3)

)

The intent of the above program is to read a text file, take it line by line edit each number so that the first 5 digits are the folder number the last 3 are the part number tack on I01.dwg, A01.dwg, D01.dwg or S01.dwg, search to see if any such drawing exists, if it does add the part to a 2nd txt file and write out a copy and rename command in a batchfile so that the end result is a batchfile that will move all parts to a central folder and a 2nd txtfile that has the locs of every part pulled. As you can see I was playing naround with the idea of building a script that goes in and uses commands to build the dsd file, unfortunately this route has not worked out so well as it will go to the first one and quit out. Many drawings are read only, but not all (depends on if they have an engineering change order on them or not). Any ideas/expertise would be much appreciated!!! If I wasn't clear somehow please let me know and I'll clarify as best I can!

thanks again!
« Last Edit: June 15, 2011, 11:49:27 AM by STHAL »

STHAL

  • Guest
Re: Publishing thousand+ drawings from a complicated file system
« Reply #1 on: June 16, 2011, 10:12:08 AM »
No ideas huh? I was considering looking down the objectdbx route but I am really not a programmer by trade and while autolisp is easy enough I'm a tad intimidated by objectdbx. Can anyong suggest a good tutorial on objectdbx that I can use as a jumping off point? Based on what I've read Objectdbx will at least allow me to open up each drawing 1 by 1 and then extract the names of the layouts for each drawing which can then be referenced when building the dsd file.

So if anyone can suggest a good tutorial or a reference section that can explain how to setup, write and run a objectdbx program, it would be very much appreciated!

SOFITO_SOFT

  • Guest
Re: Publishing thousand+ drawings from a complicated file system
« Reply #2 on: June 16, 2011, 12:50:35 PM »
Helo swampy people ...

A little code of my brother Yarik of Hispacad ...
I hope it serves you to get the layout-list without opening a dwg ....
Works for me "FerPect" in A2008 ....
Code: [Select]
(defun layout-list-of-file (file / odbx list_lay lays)
 (vl-load-com)
  (setq
    odbx (if (< (setq vers (substr (getvar "acadver") 1 2)) "16")
      (vla-GetInterfaceObject
        (vlax-get-acad-object)
        "ObjectDBX.AxDbDocument"
      )
      (vla-GetInterfaceObject
        (vlax-get-acad-object)
        (strcat "ObjectDBX.AxDbDocument." vers)
      )
    )
    list_lay (list)
  )
  (vla-open odbx file)
  (setq lays(vlax-get odbx 'layouts))
  (vlax-for lay lays
   (setq list_lay (cons (vla-get-name lay) list_lay))
    )
  (vlax-release-object lays)
  (vlax-release-object odbx)
  list_lay
  )

Verifing in command line:
Command: (layout-list-of-file "C:\\Unfold.dwg" )
("PEPE" "Model" "LOLO" "Layout2" "Layout1")

is OK!...

Greetings from Madrid....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Publishing thousand+ drawings from a complicated file system
« Reply #3 on: June 16, 2011, 12:51:40 PM »
I thought you wouldn't be able to do this with ObjectDBX if the drawing was make read-only, but it seems you can.  There have been code posted to help you with the dbx part.
[ http://www.theswamp.org/index.php?topic=31827.0 ] - By Lee Mac
[ http://www.theswamp.org/index.php?topic=29933.0 ] - By T.Willey

And Welcome to theSwamp.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

STHAL

  • Guest
Re: Publishing thousand+ drawings from a complicated file system
« Reply #4 on: June 16, 2011, 05:49:28 PM »
Thanks very much for the help! I have a preliminary version that is working though it has quite a few bugs (errr features?) in it that need to be worked out. Once thats done I'll post it so you guys can tear it apart  :-P

Bhull1985

  • Guest
Re: Publishing thousand+ drawings from a complicated file system
« Reply #5 on: December 30, 2013, 09:07:38 AM »
Was this ever finished? :)