DomCR / ACadSharp

C# library to read/write cad files like dxf/dwg.
MIT License
431 stars 119 forks source link

Document.Layouts returning no layouts #495

Open ITSJORDAN-TFA opened 1 week ago

ITSJORDAN-TFA commented 1 week ago

Describe the bug When reading a DWG AC1014 created from DraftSight, it is returning document.Layouts.Count as 0, when it should be 2.

Additional context Add any other context about the problem here. If the issue is related to an specific dwg/dxf file and if able, attach that file to the issue of an equivalent with the same error. I cannot attach the file due to data restrictions but could there be anything that happens in DraftSight that causes this DWG to be mismsatched? Other DWGs from draftsight work fine though

public bool HasReadableLayouts()
        {
            using (DwgReader reader = new DwgReader(filePath))
            {
                var document = reader.Read();
                if (document.Layouts.Count() == 0) return false;
                return true;
       }
}
DomCR commented 1 week ago

Hi @ITSJORDAN-TFA,

Older version like AC1014, have an object called VP_ENT_HDR_CTRL_OBJ, which stores the layout and viewport information. This object hasn't been implemented yet, I'll open a branch to fix it.

Thanks for the report!

ITSJORDAN-TFA commented 4 days ago

Thanks @DomCR, I really love this library!

I will keep an eye out on the branch as I'm curious how you work on these sort of things, the file type is a black box for me