CompuServe Thread

#Accessing ACAD ".DWG" Fi

11 messages in this thread
#21869From: JIM MC MILLANApr 15, 1988 12:14 PM
I would like to know if it is possible to extract information from a Drawing file "<DRAWINGNAME.DWG>". I am looking at writing a program that can access binary files and extract information for data processing. The kind of information could either be in a text format or in the contents of an attribute block. If anyone has knowledge on how AutoCad stores this information in the drawing file I would appreciate a response. By the way, I do not want to use "DXF" files as this is not a productive way to meet our needs. Regards, Jim Mcmillan.
#21891From: Training [ADESK]Apr 15, 1988 9:36 PM
Jim — We feel that the format of the AutoCAD DWG file is proprietary, so we don't document it. This allows us some flexibility when we change the format of the file, which can happen from one release to another, without worrying too much about upward compatibilty with third-party applications (of course, we will always be able to read a DWG file from an earlier release of AutoCAD into a later release). Could you tell us why you think that DXF (which was originally designed to pass data from AutoCAD to and from other programs) is not sufficient in your case? — Brad ..
#21939From: JIM MC MILLANApr 18, 1988 7:50 AM
Brad, In any given project that we work on, the drawing content can reach 600 plus. My idea, originally was to write a lisp routine that prompted for drawing information, then wrote this data to a sequential file in a comma delimited manner. This I found to be awkward, since it would be more effective to extract the info after all the drawings were complete and ready to be shipped "As Built". In this stage, the ability to have a program that would look at ALL the drawings ".DWG" and extract the info from each attracted me. Writing out individual DXF files would be too time consuming for our purpose, so this idea surfaced. If there is a way to do this that is more effective than the areas that I am looking at, then I would be interested. As a last resort, I will probably write a lisp routine that extracts the information from a titleblock "Block" and again using a sequential file, writes out the relevant data. Regards, Jim McMillan.
#21959From: Training [ADESK]Apr 18, 1988 12:16 PM
Jim — Okay, so it's a matter of time more than the feature itself. That makes sense. Have you thought about automating the DWG-to-DXF process through a combination of DOS (I assume you're on a DOS platform) batch files and AutoCAD script and AutoLISP files? If you're interested, I think I can show you how to make this an unattended operation for multiple DWG files. That might make the process more attractive since it wouldn't tie up on-line operator time. — Brad ..
#21985From: JIM MC MILLANApr 19, 1988 7:35 AM
Brad, Yes, I would like to look at a routine to do that. I will look forward to your reply. Regards, Jim McMillan.
#22102From: Training [ADESK]Apr 21, 1988 7:32 PM
Jim — After thinking about it, I don't think you need anything more complex than a simple script file, similar to this: .. 2 test1 dxfout test1 6 quit y 2 test2 dxfout test2 6 quit y 0 .. This file can be executed from the OS command prompt with the string .. acad x test .. and it will load AutoCAD, start executing the script file (which we have named TEST.SCR), edit a drawing file named TEST1.DWG, DXFOUT the drawing to a file named TEST1.DXF, quit the Drawing Editor, and repeat the process on file TEST2.DWG. After it writes the last DXF file, it exits AutoCAD and returns to the OS prompt. Is this the type of thing you were talking about? — Brad ..
#22185From: JIM MC MILLANApr 25, 1988 8:36 AM
Brad, I have already this type of setup for configuring my plotters, but no, it's not really what I am after. As I mentioned earlier, when you have 500+ drawings to process, I feel that this type of approach would be too time consuming, hence the need for a more effective approach. I am trying to process all the drawings sequentially without the need to use DXFOUT. If I can get the drawing name, revision, date, project, description and so on out of the drawing by reading the compiled file, then I will have come up with a FAST method of extracting info. In the past, I had a Lisp routine that prompted the user for this kind of info, then wrote the data out in a CDF format to a sequential file. Again, I am trying to improve on this, and I get the feel that quite a bit of work may be involved. If you have any suggestions along this line, then please forward them to me. Thanks for the help, Regards, Jim.
#22218From: Training [ADESK]Apr 25, 1988 7:33 PM
Jim — This sounds like a case where you might want to use an external database file that references AutoCAD DWG files. I seen threads here recently that talk about redefining the END and SAVE commands to ensure that a file is created and/or appended to that contains several text fields that describe the contents of the file. This new file can then be searched quickly for information about any particular file or group of files. I suppose that information could then be used to construct a script file that started the DXFOUT process, or whatever batch process you wanted. — Brad ..
#22247From: JIM MC MILLANApr 26, 1988 7:51 AM
Brad, Bingo!, that's what I am after. If you could give me more info on this I would appreciate it. Once, I wrote a program that did a "dir <drawingdirectory> > <target.fil>" then processes the filenames and had DBase read in the names to a datafield. Again, all of the other info had to be added manually: Rev, Description, By, Customer and so on. The approach you are identifying offers a solution, and again, if you have any leads I would appreciate it. Thanks again, Regards, Jim.
#22020From: Craig Sharp [Mem TM]Apr 19, 1988 8:15 PM
Jim: Write a BASIC routine that reads the current directory of drawings and creates a script file that enters each drawing and runs the Autolisp routine, exits the drawing, and then loads the next drawing, etc. Or, if you need alot of information, do the same BASIC routine to write a script file that creates the DXF files, then loads dbase II and extracts the information that you want. BILLLIONS AND BILLLIONS OF bytes. I think ATTEXT and attributes with DBASE is the fastest and simplest, using less precious disk space. Craig. .
#22034From: JIM MC MILLANApr 20, 1988 7:41 AM
Craig, Yes that's the basic I wrote the PD program "PlotMate" on. I have a small routine that will extract info and write it out to a file in a "CDF" format. Then I have a template for PCFile and DBASE, whichever I decide to use that will import the info into data fields. As I stated earlier, if I could access the drawing file directly, I would bypass this step altogether. I am going to give it a try just because I'm persistant! Anyway thanks for the reply, I appreciate your offerings. Regards, Jim McMillan.