.NET

Reply
Distinguished Contributor
jmaeding
Posts: 1,044
Registered: ‎12-27-2006
Message 1 of 11 (617 Views)

Error during save, recommend recover...nag screen, how to not display

617 Views, 10 Replies
09-28-2012 06:31 PM

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()
http://onesmallstepforcad.com/

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 2 of 11 (575 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-01-2012 02:06 PM in reply to: jmaeding

Hi,

 

ever tried to run wblock/clone/xxxx instead of saveas?

 

- alfred -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
jmaeding
Posts: 1,044
Registered: ‎12-27-2006
Message 3 of 11 (572 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-01-2012 02:44 PM in reply to: Alfred.NESWADBA

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()
http://onesmallstepforcad.com/

*Expert Elite*
Alfred.NESWADBA
Posts: 9,401
Registered: ‎06-29-2007
Message 4 of 11 (567 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-01-2012 03:06 PM in reply to: jmaeding

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 -

-------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------
Distinguished Contributor
jmaeding
Posts: 1,044
Registered: ‎12-27-2006
Message 5 of 11 (559 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-01-2012 05:47 PM in reply to: Alfred.NESWADBA

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()
http://onesmallstepforcad.com/

ADN Support Specialist
Balaji_Ram
Posts: 736
Registered: ‎03-21-2011
Message 6 of 11 (537 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-03-2012 04:17 AM in reply to: jmaeding

Hi James,

 

 

Can you please try the sample code from a Devnote that Stephen posted in his recent reply ?

 

http://forums.autodesk.com/t5/Autodesk-ObjectARX/Hiding-AutoCAD-messages-while-processing-on-drawing...

 



Balaji
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
jmaeding
Posts: 1,044
Registered: ‎12-27-2006
Message 7 of 11 (522 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-03-2012 08:55 AM in reply to: Balaji_Ram

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()
http://onesmallstepforcad.com/

ADN Support Specialist
Balaji_Ram
Posts: 736
Registered: ‎03-21-2011
Message 8 of 11 (494 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-05-2012 09:08 AM in reply to: jmaeding

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.



Balaji
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
jmaeding
Posts: 1,044
Registered: ‎12-27-2006
Message 9 of 11 (488 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-05-2012 09:48 AM in reply to: Balaji_Ram

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()
http://onesmallstepforcad.com/

ADN Support Specialist
Balaji_Ram
Posts: 736
Registered: ‎03-21-2011
Message 10 of 11 (438 Views)

Re: Error during save, recommend recover...nag screen, how to not display

10-10-2012 02:46 AM in reply to: jmaeding

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

 

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!