-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double Bug in MText rotation #184
Comments
Just read form http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ff18cb41610ec0a2e719-79f8.htm 50 | Rotation angle in radians That's why AutoCAD doesn't use code 50 for rotation ... and why you type it twice ... |
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:
But code 50 is supposed to be a Do you have an example 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. |
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. |
I'm reluctant to add any special handling to this library for the AutoCAD-specific XDATA (denoted by
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 |
I agree with you on not managing the columns (by the way I don't care specifically). |
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 |
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) |
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
to a normal form:
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. |
AutoCad 2015 response: Xdata wasn't read. Invalid or incomplete DXF input -- drawing discarded. |
Thanks for checking. I'll think about it a bit and then start working on reading/writing those values from XDATA. |
Hi, just so you know, QCad seems to behave the same way than AutoCad when reading, the second Anyway, thanks for your work. I just started using your library, it's simple, straightforward, and very promising! |
There is a double problem about the rotation angle in MText: the first is that you write it twice, the first correct and the second at 0, so when you read the DXF the 2nd overwrites the first and therefore all the writings are at 0.
The second problem is that in reality AutoCAD never writes code 50 (the angle) but only compiles 11 and 21 from which the angle is obtained; indeed the 50 gives him his own annoyance.
In practice, never write 50.
Or remove the data (which is always 0 in reading as it never appears in a DXF) or you calculate it by doing:
Read: (360M - Angle.FromRadiant (Math.Atan2 (MText.XAxisDirection.X, MText.XAxisDirection.Y)) + 90M)
Write: XAxisDirection = new DxfVector (Rotation.Cos (), Rotation.Sin (), 0)
Tested with AutoCAD 2015.
Regards,
Davide
The text was updated successfully, but these errors were encountered: