Git Product home page Git Product logo

Comments (11)

rocchellid avatar rocchellid commented on July 18, 2024

Just read form http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-79f8.htm

50 | Rotation angle in radians
50 | Column heights; this code is followed by a column count (Int16), and then the number of column heights

That's why AutoCAD doesn't use code 50 for rotation ... and why you type it twice ...

from dxf.

brettfo avatar brettfo commented on July 18, 2024

The spec lists code 50 being written multiple times; once as the rotation angle, and then again as column heights, but it's not very clear exactly how the column heights are written. E.g., it says for the second instance of code 50:

Column heights; this code is followed by a column count (Int16), and then the number of column heights

But code 50 is supposed to be a double, not int16, but that's not too bad because we can always cast it, but then it says it's followed by the number of column heights. Does this mean if there are 3 column heights of values (1.5, 2.5, 3.5) that it'll write 4 code pairs: 50/3, 50/1.5, 50/2.5, 50/3.5?

Do you have an example MTEXT with multiple column heights? I can likely figure out what's expected and make it work appropriately.

On another note, I don't want to skip the first code 50 rotation angle, because other apps might depend on that value, but once I figure out how to handle the subsequent code 50's, the first one won't be a problem.

from dxf.

rocchellid avatar rocchellid commented on July 18, 2024

I have attached an example of DXF with 5 static columns; what I see in the DXF is a somewhat thick structure ACAD_MTEXT_COLUMN_INFO_BEGIN - ACAD_MTEXT_COLUMN_INFO_END with different data on the columns.
Regards,
Davide

Columns.zip

from dxf.

brettfo avatar brettfo commented on July 18, 2024

Columns.dxf is specifying its column data in XDATA, not as code 50 values, so unfortunately I can't draw enough information from this to determine exactly how the various code 50 columns are supposed to work. E.g., if you open Columns.dxf in notepad or any other text editor and look at lines 2229-2274 you'll see where all of this is specified. The column count is either being defined by the value 1070/5 on lines 2243-2244 or the value 1070/5 on lines 2263-2264, but I can't say for certain.

I'm reluctant to add any special handling to this library for the AutoCAD-specific XDATA (denoted by 1001/ACAD on lines 2229-2230) because:

  1. It's application specific, not generic to all DXF files
  2. I haven't seen any official spec from Autodesk about what these values actually mean.

If you want to add this XDATA handling to your own app, you can read (and set for writing) the raw data with something like this:

var dxf = DxfFile.Load("Columns.dxf");
var mtext = dxf.Entities.OfType<DxfMText>().First();
var acadXData = mtext.XData["ACAD"];
// `acadXData` is an `IList<>` that you can enumerate through

Since this issue was opened for the handling of code 50 values I'll leave it open in case more information is gathered.

from dxf.

rocchellid avatar rocchellid commented on July 18, 2024

I agree with you on not managing the columns (by the way I don't care specifically).
But I ask you to remove the other code 50 in order not to have the double repetition as now which is interpreted by AutoCAD as an angle.
Regards,
Davide

from dxf.

brettfo avatar brettfo commented on July 18, 2024

Since the spec defines those other code 50 values, I can't remove them, but if I can find an example of how those other values are used I can fix the behavior so that it's correct and the rotation angle isn't overwritten.

If you ever run into a file with MTEXT with those extra code 50 values, I'd love to see a copy of it so I can see exactly what it's doing.

from dxf.

rocchellid avatar rocchellid commented on July 18, 2024

Maybe I understood: the explanation in the PDF is a bit convoluted but looking (PNG attached) it corresponds to the DXF (attached) I would say that it is "clear": 50 indicates that the next integer data (1070) is the number of columns (5)
Regards,
David

Example.zip

from dxf.

brettfo avatar brettfo commented on July 18, 2024

Ohh, this is annoying. The spec doesn't say that these code pairs are double-encoded in XDATA, but the drawing you sent me obviously shows this. It appears that through code 44 (what I call LineSpacingFactor), the values are in normal code pairs, but the next set of codes introduced in the 2008 spec are really held inside XDATA, even though the spec doesn't say it. I'm hesitant to do more without understanding it better, but could you do me a favor and try to load the file I've attached to this message? It's the same as the Example.dxf you just posted, but I converted the XDATA back to regular code pairs, e.g., I changed ColumnType (code 75) from the XDATA form:

1070
    75
1070
     2

to a normal form:

 75
     2

I want to see if your version of AutoCAD understands the normal form, or only the XDATA form. Based on how it handles it I'll have to decide what to do.

Example.zip

from dxf.

rocchellid avatar rocchellid commented on July 18, 2024

AutoCad 2015 response: Xdata wasn't read. Invalid or incomplete DXF input -- drawing discarded.
Also Autodesk Viewer 2020 can't read the file.
As you can see from the attachment, the codes you have not put are essential ...

Errors.zip

from dxf.

brettfo avatar brettfo commented on July 18, 2024

Thanks for checking. I'll think about it a bit and then start working on reading/writing those values from XDATA.

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.