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
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();
}
}
Can't find what you're looking for? Ask the community or share your knowledge.