I am batching through files and purfging reg apps.
Some files at our office, usually from 2006 and below, give the error dialog "error during saver, recommend recover...".
I have no problem with a file being skipped because it had an error, but that nag screen is stopping the batch process.
I am reading the drawings in through dbx, not operating on an open drawing in the editor.
Is there some way to keep the db.saveas method from showing this dialog?
I am on version 2012.
thanks
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Hi,
ever tried to run wblock/clone/xxxx instead of saveas?
- alfred -
wblock method would not be a good approach, as its far too agressive a cleaning mechanism.
I am running on thousands of drawings and do not want to change anything but the excess app ids.
I cannot touch handles or grouping.
Do you have ideas in mind that accomplish this?
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Hi,
then another method could be not to open the defect database, but to use insert-like functionality into a new database and then run the saveas with the new database.
You also may run the audit-function on each of the database resident objects, maybe this cleans up some defects that makes "saveas" available without interrupting dialog.
Good luck, - alfred -
well, the problem is the "realdwg" exe that adesk made for me in the past, did not show these messages.
It just failed or ran.
I do not want to do any extraction and making new drawings, you are making a ton of assumptions about how well that matches the original drawing.
I have watched adesk mess this up with its civil batch converter, it takes a while to encounter and notice all the little problems that come up.
The dumb thing is, I believe its saving the drawing successfully. One of the reasons I use the tool is simply to save drawings to current version, so its all working except for the wonderful message.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Hi James,
Can you please try the sample code from a Devnote that Stephen posted in his recent reply ?
Thanks for the reply Balaji,
I am not a C++ guy, though I can read and understand what he is doing. I just have never even done a hello world prog in VS with C++ so maybe time to start.
In the past, I did not run into this because autodesk compiled an exe for me that cleaned regapps. I even have the code, but no realdwg license to compile for 2010+, and no skills currently to make sure I am compiling correctly.
Is there a chance I could get autodesk to compile the exe for me?
If not, I essentially have to either hire someone to help me or live with the nag screens.
Can you help?
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Hi James,
If you can please share the source code and let me know who in Autodesk built the earlier version of the exe, I can get in touch to find if an updated version of it is available for 2010+.
If not, I will enquire with my colleagues to find out if we can build it from the source and give it you.
Since ADN usually do not distribute binaries other than a few OCX controls, I am not sure if I am permitted to build the code and give it to you. But I will surely find out and try.
I will email you the full source code, in the mean time, the portion that cleaned things was this:
// This is command 'PURGEAPP' bool asdkRemoveApp(CString csArgFile) { Acad::ErrorStatus es; AcDbDatabase *pDb=new AcDbDatabase(false,true); acdbHostApplicationServices()->setWorkingDatabase(pDb); if(Acad::eOk!=pDb->readDwgFile(csArgFile)) { //AfxMessageBox("Could not Read "+csArgFile); return false; } pDb->setRetainOriginalThumbnailBitmap(true); // Get the RegAppTable AcDbRegAppTable* pRegTable; pDb->getRegAppTable(pRegTable,AcDb::kForRead); // Create an iterator of the RegAppTable AcDbRegAppTableIterator* it; if((es = pRegTable->newIterator(it,Adesk::kTrue,Adesk::kTrue)) != Acad::eOk) { pRegTable->close(); return false; } pRegTable->close(); AcDbObjectIdArray idArray; // iterate through the RegAppTable while(!it->done() ) { // get a RegAppRecord AcDbObjectId recId; //if((es = it->getRecord(rec,AcDb::kForRead)) != Acad::eOk) if((es = it->getRecordId(recId)) != Acad::eOk) { delete it; return false; } if(recId.isValid()) idArray.append(recId); it->step(); } delete it; // Now through the Layer Filters...this will simply remove them all. AcDbLayerTable *pLT=NULL; if(Acad::eOk==pDb->getLayerTable(pLT,AcDb::kForRead)) { AcDbObjectId ltExtDictId=pLT->extensionDictionary(); pLT->close(); AcDbDictionary *pLTExtDict=NULL; if(Acad::eOk==acdbOpenObject(pLTExtDict,ltExtDictId,AcDb::kForRead)) { AcDbDictionary *pLFDict=NULL; if(Acad::eOk==pLTExtDict->getAt(_T("ACAD_LAYERFILTERS"),(AcDbObject*&)pLFDict,AcDb::kForWrite)) { pLFDict->setTreatElementsAsHard(false); AcDbDictionaryIterator *pDictItr=pLFDict->newIterator(); pLFDict->close(); for(;!pDictItr->done();pDictItr->next()) { AcDbObjectId ltFilterId=pDictItr->objectId(); if(ltFilterId.isValid()) idArray.append(ltFilterId); } delete pDictItr; } pLTExtDict->close(); } } else return false; pDb->purge(idArray); for(int i=0;i<idArray.length();i++) { AcDbObject *pObj=NULL; if(Acad::eOk==acdbOpenObject(pObj,idArray[i],AcDb::kForWrite)) { if(Acad::eOk!=pObj->erase()) { pObj->close(); return false; } pObj->close(); } else return false; } pDb->saveAs(csArgFile); acdbHostApplicationServices()->setWorkingDatabase(NULL); delete pDb; return true; }
I would have asked specific permission from Stephen Preston to post the code, but Kean's post in C# does exactly the same thing so this is just the C++ version.
He was the one who did the last compile for me, though Calyton Hotson did the original.
thanks for considering the realdwg compile.
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Hi James,
Here are the steps that I tried, but havent got the recover dialog. Can you see if I am missing some step ?
The attachment is ~3MB recording so I am sharing it using dropbox. Here is the link :
https://www.dropbox.com/s/f8uche9w3qw416a/Demo.zip
A couple things different you are doing than I:
I will try on an open dwg and see what happens, but its not really a case I care about. I always run on dwgs not open in the editor.
If it is the regapp cleaning step that is causing the recover thing to show, you can imagine that is a strong argument for not running the purge using an in process method. A standalone exe does not even know acad is running, so will never stop a process, it will suceed or fail, exactly what people running batches want.
My tools check file sizes and change dates to see if tools are working, they do not need to get return values or errors from the purging mechanism.
thanks
internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties
Can't find what you're looking for? Ask the community or share your knowledge.