Create makes one paper space layout, Layout1, whose sheet is the *Paper_Space block and whose limits run from 0,0 to 12,9. Space::Paper adds an entity to it: the entity goes to the ENTITIES section with its Paper flag set, owned by the *Paper_Space block record.
A drawing’s other layouts each draw their sheet in a block of their own, and a LAYOUT object names its block’s record in Block. plan.dxf here is a drawing AutoCAD saved with two layouts; the loop finds the block of Layout2.
C++
auto plan = DxfIO::LoadFile("plan.dxf");if (!plan){ std::println("line {}: {}", plan.error().Line, plan.error().What); return 1;}DxfIO::Document &sheets = plan->Document;std::string sheet;for (const DxfIO::Object &one : sheets.Objects){ const auto *layout = std::get_if<DxfIO::Objects::Layout>(&one); if (layout == nullptr || layout->Name != "Layout2") { continue; } for (const DxfIO::Tables::BlockRecord &record : sheets.BlockRecord.Records) { if (record.Record.Base.Self == layout->Block) { sheet = record.Record.Name; } }}std::println("Layout2 is drawn in {}", sheet);
Edit::Add with the block’s name puts the entity in that block, owned by its block record. The block’s BLOCK record carries the paper space flag, so the entity takes it too.