Git Product home page Git Product logo

Comments (6)

brettfo avatar brettfo commented on August 17, 2024

Can you attach two files, both before and after the MTEXT corruption? I might be able to look at the differences and figure out what's going on. If you don't want the files to be public you can email them directly to me at brett.forsgren @ outlook.com and I'll keep them private and delete them as soon as I'm done.

from dxf.

rocchellid avatar rocchellid commented on August 17, 2024

I did another 2 tests even simpler:

1st:

var a = DxfFile.Load(File);
a.Entities.Where(x => x.EntityType == DxfEntityType.MText).ToList().ForEach(x =>
{
if (a.Entities.Remove(x))
{
a.Entities.Add(x);
}
});
a.Save(Path.Combine(Path.GetDirectoryName(File), "aaa.dxf"));

result: file corrupted

2nd even more basic:

var a1 = DxfFile.Load(File);
a1.Save(Path.Combine(Path.GetDirectoryName(File), "bbb.dxf"));

result: file corrupted

AutoCAD error detail:

The following error was encountered while reading
in MTEXT starting at line 2414:
Missing DXF group code: 90
Invalid or incomplete DXF input -- drawing discarded

I created file with AutoCAD 2015 and put only a multiline text.

Regards,
Davide

Test.zip

from dxf.

brettfo avatar brettfo commented on August 17, 2024

Thank you for the file! Unfortunately it seems that AutoCAD isn't following their own spec (page 139), so this may take me a while to figure out.

If you're interested, the MText in the working file (Test MText.dxf) is on lines 2189 to 2258, and in the non-working file (bbb.dxf) is on lines 2413 to 2524, but the one that this library writes does contain a code 90 on line 2465.

from dxf.

rocchellid avatar rocchellid commented on August 17, 2024

I've done some tests.
The most trivial was to remove the 90 (with its value) but nothing has changed.
I then exported with another package and it works; so I took the MTEXT part of the save that goes and put in place of your MTEXT part and now yours goes too; so the problem is (should) only in the MTEXT piece.
I manually added 90 with the values 0,1,2 and it keeps going (I have attached the files).
I also made a comparison of your save and I attached the report.
Unfortunately I was not able to do an identical export (in the one done with the other package the coordinates are all rounded) and the layer is different but otherwise nothing should change.
Hope this can help you find the problem faster.
One last note: AutoCAD Viewer 2020 does not open them, but AutoCAD 2015 does.
Regards,
Davide

Test MText alternative +90.zip

Report.zip

from dxf.

rocchellid avatar rocchellid commented on August 17, 2024

I have found problem: I have removed code from 420 to 441 and 63 and now your save is ok.
Code 63 must exist only if 90 is 1 (see spec) and I think also code from 420 to 439 (really to 441).

You save two times code 430 and 50.

https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-5E5DB93B-F8D3-4433-ADF7-E92E250D2BAB

Regards,
Davide

from dxf.

brettfo avatar brettfo commented on August 17, 2024

Thank you for figuring this out! I just pushed commit fef3892 to main that fixes this.

from dxf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.