ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why is the custom filled file so large?

1 REPLY 1
Reply
Message 1 of 2
javalitterboy
205 Views, 1 Reply

Why is the custom filled file so large?

These two files only use different padding, everything else is the same, but why is there such a big difference in file size.

 

custom padding.dwg  130MB     iso padding.dwg 5MB 

 

 

Tags (1)
Labels (1)
1 REPLY 1
Message 2 of 2
tbrammer
in reply to: javalitterboy

To my surprise, it is the hatchpatterns you use in the large file.

I used the code below to set all hatchpatterns to "ANSI31", saved the file and its size changed from 130MB to 5.8MB.

I suppose that AutoCAD stores some kind of "hatch graphics cache" within the DWG to avoid long calculations. The drawing contains more than 46000 hatches! That would be about 2.7kB data overhead per hatch.

 

void SetHatchesANSI31() {
	AcDbDatabase* pDB = acdbHostApplicationServices()->workingDatabase();
	AcDbObjectId IdModelSpace = acdbSymUtil()->blockModelSpaceId(pDB);
	Acad::ErrorStatus es;
	AcDbBlockTableRecord* model;
	if ((es = acdbOpenObject(model, IdModelSpace)) == Acad::eOk)	{
		AcDbBlockTableRecordIterator* pit = nullptr;
		es = model->newIterator(pit);
		if (pit) {
			AcDbObjectId entId;
			AcDbHatch* hatch;
			for (pit->start(); !pit->done(); pit->step()) {
				es = pit->getEntityId(entId);
				if ((es = acdbOpenObject(hatch, entId, AcDb::kForWrite)) == Acad::eOk)	{
					es = hatch->setPattern(AcDbHatch::kPreDefined, L"ANSI31");
					hatch->close();
				}
			}
			delete pit;
		}
		model->close();
	}
}

 


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report