Skip to content

Support for TABLE sections outside of a TABLES block in DXF files #1128

Description

@dsn27

Is your feature request related to a problem? Please describe.

Some older DXF files place TABLE sections directly after the HEADER section, without wrapping them in a SECTION / TABLES / ENDSEC block. ACadSharp skips these TABLE entries silently, so all table definitions are never loaded. Since entities in the file reference those tables, the document appears empty even though the geometry is present.

Describe the solution you'd like

In DxfReader.Read(), check for a bare TABLE token at the top of the main loop. When one is found, read it through a recovery path and then continue normally. The ENTITIES section is picked up afterwards as usual. The change has no effect on well-formed files and emits a warning so the caller knows the file is non-standard.

Describe alternatives you've considered

Pre-processing the stream to inject a synthetic SECTION / TABLES / ENDSEC wrapper before parsing would also work, but requires an extra pass over the file. Rejecting the file with an error would be better than the current silent failure, but would break real-world workflows.

Additional context

This pattern appears in DXF exports from older NC/CAM and plotting software. The files are otherwise valid; only the TABLES wrapper is missing.

If this behaviour is something you would like to support, I am happy to provide a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature added

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions