ACadSharp icon indicating copy to clipboard operation
ACadSharp copied to clipboard

Error converting from DWG to DXF

Open ShadowGreg opened this issue 1 year ago • 4 comments

I'm trying to convert a DWG to DXF. But the file saved is corrupted.

 public static void Main(string[] args) {
        var path = Ui.Prompt("Enter path to dwg file: ");
        CadDocument doc = DwgReader.Read(path);
        doc.Header.Version = ACadVersion.AC1018;
        var dxfPath = Ui.Prompt("Enter path to dxf file: ");
        using (DxfWriter writer = new DxfWriter(dxfPath, doc,false))
        {
            writer.OnNotification += NotificationHelper.LogConsoleNotification;
            writer.Write();
        }             
    }

Exception text in AutoCad When reading from HATCH, starting at line 3152, it was found the following error:

Error: Group code 47 expected Corrupt or incomplete input DXF file - drawing import failed.

Text in NotificationHelper

Entity type not implemented : ACadSharp.Entities.Wipeout Object not implemented : ACadSharp.Objects.SortEntitiesTable Object not implemented : ACadSharp.Objects.SortEntitiesTable Object not implemented : ACadSharp.Objects.SortEntitiesTable Object not implemented : ACadSharp.Objects.SortEntitiesTable Object not implemented : ACadSharp.Objects.SortEntitiesTable Object not implemented : ACadSharp.Objects.AcdbPlaceHolder
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale
Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale Object not implemented : ACadSharp.Objects.Scale

ShadowGreg avatar Jan 23 '24 06:01 ShadowGreg

Hi @ShadowGreg,

The type of the Hatch that you are trying to convert seems to be using the flooding method, which uses the variable PixelSize from the Hatch, that is not written at the moment.

I'll open a branch to fix this issue, could you provide the Dwg that you are trying to convert? or a copy of it with only the Hatch that is making if fail? it will help with the implementation.

Thanks!

DomCR avatar Jan 23 '24 09:01 DomCR

Your file seems to have characters in the Text and MText that the writer cannot process correctly, I'll create another branch to take a look at this second issue.

DomCR avatar Jan 23 '24 16:01 DomCR

PR that fixed the text format for Tolerance and MText but the dxf file produced by ACadSharp is still invalid in this particular case.

  • https://github.com/DomCR/ACadSharp/pull/253

DomCR avatar Jan 26 '24 07:01 DomCR