Can Corruption of DWG File Be Totally Avoided?
The Cost of Absolute Safety
and What is the Norm
What Can Be Done If the
CADD System Is Really Unstable?
What Are the Methods of DWG File
Repair?
The Clean Preview Picture and
Corrupted DWG
What is unhandled access violation exception error and
what is the number that follows
Interesting bug case study: bloaters
What to do with a crashed hard disk or corrupted backup
One day you save the drawing OK,
the next day
it crashes on the OPEN command
Partial List Of IntelCAD Clients
We don't think so. No matter how much effort will go into the quality control of a software product, a few errors will always escape the scrutinizing eye of all levels of programmers writing and checking the code.
With the complexity of today's CADD software, operating system, network, huge variety of hardware components available on the market, multitude of other programs running parallel in the computer's memory and not always obeying the rules, there is always a certain small probability that the cad file will get corrupted. This is true for AutoCAD, Microstation and for all other CADD software products, as CADD files are one of the most complex and biggest files stored on today's computers.
The 3-rd party add-on applications and programmable customization provide the real power of the modern CADD software. AutoCAD has its AutoLISP, ObjectARX, VBA. Microstation has MDL, JMDL, and VBA. Add-on programs come from thousands of small companies around the world and from tens of thousands of programmers working in companies that use AutoCAD for design. These programs are often not as thoroughly checked for errors as the AutoCAD itself (IntelCAD Systems software is the exception here, of course ;) and are the main reason of most of today's CAD file errors. In the plenitude of these programs (most of them very high quality) there is a sufficient number of routines that don't implement proper error handling. This leads to data corruption sooner or later.
So why doesn't Autodesk remove all the programmability from AutoCAD and make their program run only in DOS with no network connections, so that there are less chances for file errors? Well, this "solution" could be compared to removing all the electrical installations from the next model of Ford, except the ones that are needed by the engine, in order to make the electrical installation simpler and thus more reliable. So you could not have electrical windows, fans, air condition, CD player - all you could do is drive in a more reliable vehicle. How would you like that? I would rather have a problem from time to time and enjoy all the modern conveniences. Now, if I could definitely figure out that a fault in the CD player is causing frequent problems that affect the whole electrical installation, I would try to get the manufacturer to fix it or I would go with a different make of the player that is compatible with the car. That's what has to be done if you detect an ARX program that is the culprit of corrupting DWG files.
Most of the companies using only a few CADD stations enjoy relatively bug-less operation. When they have a crash and a drawing gets corrupted once a year, there is really no point for screaming "WHY". The answer is: because of the statistics of any very complex system. Details are really not important, as most likely the next crash due next year will happen for a different reason. ANY software will corrupt its data some day, ANY hard disk may crash and corrupt thousands of files in a moment.
If you need to raise reliability to 99.99999%, you need to order a CADD system developed and working in a similar fashion to a flight control system in an Airbus 320 passenger plane: multiple redundant computers running separately written software, controlling the flight and each other for errors, and handling each remotely possible fault. Such a system would be as close to perfect as it gets, but it would cost not $4000 per unit but rather $4000000 or more. In the case of drafting, I'd rather stay at $4000 and digest occasional failure.
It has to be accepted as a fact of life that each complex system will fail at a certain point - that's just pure statistics. More reliability can be purchased by paying a higher price, but the cost grows exponentially. Assume that, for a base price of $3000 for a regular computer with a regular operating system and $4000 for a regular CADD software you get 1 drawing lost out of the 1000 that have been drawn in a year (backup is also corrupted). Let's say that you lost 120 hrs at $30/hr in it, that's $3600. To make your system (computer, OS and CADD software)10x more reliable you would need to pay a range of $100000 for it, as each part and each software piece will have to go through ten fold quality control in comparison to the cheap basic solution. There is no financial justification for it. This cost of safety can only be justified in "mission critical" applications, such as installed on board of airplanes, missiles etc., not in our everyday design and drafting.
Obviously, if your CADD station corrupts drawings a few times a week and you are losing hours after hours of design, then something is wrong. All add-on ARX software should be investigated first. Eliminate one program at a time and work without it, see if the crashing stops. If the station runs pure AutoCAD with no 3-rd party software (Autodesk's own products like Softdesk or Express Tools are also considered 3-rd party in this case) and it still crashes or corrupts files, then look into conflicts between AutoCAD and other applications running parallel in the memory. If AutoCAD is the only application running, then there might be a memory conflict between AutoCAD and one of the Windows drivers (such as mouse or display driver). Other possibilities, usually least likely, are network and hardware problems (such as network card errors, hard disk errors etc.).
Removing ARX applications from the AutoCAD run-time environment can be done by using the AutoCAD ARX command. As stated earlier, most cases of DWG corruption is caused by some add-on ARX. If the ARX is identified (by the above described way of elimination) then contact it's manufacturer with the bug report and ask for the fix. The conflicts caused by other software and hardware are more difficult to debug and will require people knowledgeable in CADD, operating system, network etc. to juggle different options until the conflict is resolved (theoretically the companies that resell AutoCAD should be able to do it - you can judge for yourself how close this theory is to reality).
Yes, AutoCAD users are not the only ones struggling with the problem of corrupted data files. However they have an easier life than Microstation users as, since Release 13, Autodesk included a free automatic recovery utility in the package (RECOVER command). This utility works in 90% of cases and fixes corrupted data without requiring any knowledge from the user.
What about remaining 10%? There is a number of popular tricks that do the work for another 5% of cases, some of them are:
Some files that AutoCAD cannot recover show a nice preview image when selecting them in the "Open Drawing" dialog, leading people to believe that they must still contain all the entities that show in the preview.
The sad fact is, that preview has nothing to do with the real content of the corrupted file. It is a small bitmap screenshot of the AutoCAD screen in the moment when the dwg was last saved. In a healthy drawing this reflects the content saved to the file. However it is possible to chop off 95% of the R14 file, leaving just the beginning 5% portion, and this "handicapped" dwg will still display a pretty preview, despite the fact that all the objects in the drawing are missing and recovery is pointless.
Conclusion: corrupted drawings with the preview missing have the same chance of successful recovery as the ones that have the preview still intact.
When you receive an unhandled access violation error message, it means that the program that is running, either ACAD or one of ARXs running in its memory space, has violated the rules, usually by trying to read data from a non-existent memory location, or to write into memory location that has not been allocated by the program. It is often the result of poor ARX programming, where the programmer "forgets" to allocate or deallocate memory for data structures.
Acad files trigger this kind of error, when invalid data (eg. invalid pointer to another object in the database) causes acad.exe to access an invalid memory location. The number that follows unhandled access violation exception message is just the memory address where the conflict occurred; most often it doesn't provide the real clue of what corrupted the file or what type of bug you are dealing with.
When you look for help in the Autodesk newsgroups, try to provide the following details:
REGAPP Virus: One of the major ARX programs on the market (we have the suspect, but no 100% proof) saves in a dwg regapp table registered application with an invalid name, such as "##*a%")?s*" . Anytime this drawing is used as an xref, new "##*a%")?s*" RegApp entries will be added to the drawing referencing it, as AutoCAD doesn't recognize that "##*a%")?s*" is already registered in the current drawing: the new acad virus is born!!!. This may blow the size of a simple drawing dramatically, e.g. from 200kB to 4 Mb, as the invalid REGAPP entries multiply with every opening of the file that has xrefs with the invalid RegApp attached. We've seen files that contained more than 100000 invalid REGAPP entries. Audit will report no errors, but at a certain limit the file starts crashing. Any drawing that will reference these monsters becomes "infected". This bug spreads only in versions R14 and up. In R13 appid table checking was better, and did not allow for errant table entries to multiply.
Since the original discovery in 1998 (the first bug discovered by Alex Januszkiewicz had the name "*" - he called it STAR virus), we helped a few more companies that had other invalid RegApp names crippling their system. The common denominator was that they were all using at a certain point the same major 3-rd party ARX (could be just a coincidence, but...).
If you have a file where the visual content doesn't justify the file size and it seems to
be getting progressively worse, you can check if the "bloating" is indeed
caused by this virus by doing the following test:
Copy and paste the following line (in blue) to the AutoCAD command prompt line, while in the
suspected drawing:
(tblnext "appid" 5)(while (print (tblnext
"appid")))
If this action produces a similar listing to the one below (often scrolling infinitely):
((0 . "APPID") (2 . "ACAD") (70 . 0))
((0 . "APPID") (2 . "RAK") (70 . 0))
((0 . "APPID") (2 . "ADE") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
((0 . "APPID") (2 . "##*a%") (70 . 0))
where some weird text like (2 . "##*a%") repeats, then you have a problem with
a multiplying RegApp, that spreads through the xrefs (in a healthy drawing each entry in the
listing should be unique). This can cripple the whole project in a matter of weeks, to the
point, where it takes a 1/2 hr to open a drawing and then it crashes with a variation of
the unhandled exception error. AutoCAD doesn't "see" this problem as
an error, so it
allows for the free spreading of the "virus". In the past three years we
have pulled a number of
companies out of this trouble by providing a customized "vaccine" that gradually
cleans up the whole system.
Anonymous Group Objects: Another major third party software for
Acad R14 adds tens of thousands of anonymous GROUP objects and doesn't discard them when
they are no longer needed. Some drawings have bloated from 3MB to 20MB (17MB in the
anonymous groups no longer used).
To check, if your file is bloated by GROUPs, use the GROUP command. If it freezes the session,
you've got tens of thousands of junk GROUPs there and better clean it up :).
If you have drawings with the RegApp virus, we can deliver a custom "vaccine" that will clean up the system in a few weeks by cleaning "infected" drawings when you open them and or as soon as the virus modifies the RegApp table.
If your acad files are polluted with megabytes of unwanted groups, use GroupsAway, our
shareware program, to do the cleanup. It is now available for a free download. See Downloads.
The two cases above are just two examples of the contamination and corruption that can cripple an entire CADD project. AutoCAD itself is a very stable and reliable product (as much as it can be for a very complex graphics program interacting with all system resources).
We find that lots of bugs are introduced into acad files by buggy ARX applications, some of them from major third party developers. ObjectARX has all the power, but the work of a sloppy or inexperienced programmer can do a lot of damage (and as in the case described above, invent a new DWG virus by accident). Any mistake, like incorrect memory allocation or freeing up memory that belongs to an open database object will lead to a system crash at best, and DWG and system corruption at worst. Visual LISP and VB programs now have also the potential of corrupting files, as they may easily crash AutoCAD, (for example by incorrect use of reactors).
Copyright (c) 1999-2004, IntelCAD Systems
The material on this page cannot be published in any form without written permission from
IntelCAD Systems.
Home
About IntelCAD Systems
Contacting IntelCAD Systems
Partial List Of IntelCAD Clients
Ordering Information
Rebar Detailing (IntelCAD-RC)
AttExt - Standalone Tool for Attribute Extraction
xRepath - Standalone Tool for Xref Re-Pathing
Audit DWG Tool
DWF to DWG Converter
3D DWG Viewer / Virtual Walkthrough Software
Downloads
Programming Services
Alex's CAD Articles
Free Real-time Automatic Translation: French, German, Italian, Spanish, Portugese
Web Search
Links to Other CADD Related Sites
Any problems (invalid links etc), comments regarding this site, please contact webmaster@intelcad.com
This page was last updated on May 24, 2004