Skip to content
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

XData group code exception when casting to string #180

Open
croggero opened this issue May 11, 2022 · 1 comment
Open

XData group code exception when casting to string #180

croggero opened this issue May 11, 2022 · 1 comment

Comments

@croggero
Copy link

I am getting a "System.InvalidCastException : Unable to cast object of type 'System.Double' to type 'System.String'." when trying to parse a DXF created with AutoCAD 2017. The group code in question is 1040 (see https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-A2A628B0-3699-4740-A215-C560E7242F63) when reading XData. The error occurs on the following line.

DxfXData.PopulateFromBuffer(buffer, hasXData.XData, pair.StringValue);

The DXF lines are

...
330
10000001
100
AcDbXrecord
1040
86.0
  0
ACAD_PROXY_OBJECT
  5
10000005
...
@brettfo
Copy link
Member

brettfo commented May 11, 2022

Can you share the full DXF file with me? Also, can you share the steps you used to create that file? According to the spec link you provided that file is incorrect.

Each registered application group begins with a 1001 group code

The code is failing because it's expecting something like 1001/SomeAppId to appear before the 1040 code (which is a double.)

Obviously, AutoCAD isn't following their own spec (I've found numerous instances where this is the case), but I'd like for this library to work with it, but I'd like to better understand exactly how a drawing gets in to that state as well as what the expected behavior is.

My guess is that in a case like this where there's no 1001 application code, I can likely assume the application code to be "ACAD", but I'd like to explore a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants