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

Object of class AcDbDictionary can't be cast to AcDbEntity #851

Open
turtle0x1 opened this issue Oct 1, 2023 · 15 comments
Open

Object of class AcDbDictionary can't be cast to AcDbEntity #851

turtle0x1 opened this issue Oct 1, 2023 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@turtle0x1
Copy link

I converted a DWG with an empty model space and one paper space layout to JSON using dwgread. I then converted that JSON back to DWG using dwgwrite. When trying to open the DWG AutoCAD 2024 fatal errors ("unhandled access violation").

image

When doing the dwgwrite I get a fair few errors/warnings (just a sample of the "scariest" looking ones);

ERROR: Required object or entity key missing
ERROR: Unknown MTEXTOBJECTCONTEXTDATA.num_unknown_bits 488 ignored
ERROR: Unexpected STRING at 1386408 of 1509528 tokens, expected OBJECTS OBJECT. json_OBJECTS:3042
ERROR: Expected JSON STRING
ERROR: Unknown num_dashes field
ERROR: Unknown EVALUATION_GRAPH.unknown_bits ....
ERROR: Unknown subclass field EVAL_Node.node
Warning: Object handle not found 3305242624/0xC5020000

Would it be okay to email over the DWG?

Also I see encoding only supports outputting to the the 2000 format, is writing to a later format still on the roadmap?

@rurban
Copy link
Contributor

rurban commented Oct 2, 2023

Would it be okay to email over the DWG?

Yes, please

@rurban rurban self-assigned this Oct 2, 2023
@rurban rurban added the bug Something isn't working label Oct 2, 2023
@rurban
Copy link
Contributor

rurban commented Oct 2, 2023

Also I see encoding only supports outputting to the the 2000 format, is writing to a later format still on the roadmap?

Sure. But for this period we favored the easier preR13 tasks

@turtle0x1
Copy link
Author

Would it be okay to email over the DWG?

Yes, please

Still at the gmail address?

@rurban
Copy link
Contributor

rurban commented Oct 2, 2023

any you find

@rurban
Copy link
Contributor

rurban commented Oct 2, 2023

The producer fails with ../oda gh_851_gh851.json:
Object of class AcDbDictionary can't be cast to AcDbEntity.
(20M, pretty large. with 2419 DICTIONARY objects, and 8613 entities). Sorry, impossible to find the error there

@turtle0x1
Copy link
Author

What could be causing so many dictionary objects?

rurban added a commit that referenced this issue Oct 2, 2023
maybe the reason for the GH #851 readDWG crash
rurban added a commit that referenced this issue Oct 2, 2023
maybe the reason for the GH #851 readDWG crash
@turtle0x1
Copy link
Author

turtle0x1 commented Oct 2, 2023

The above commit have fixed the fatal error, but AutoCAD now renders some the text as pink & one object is in the wrong position.

It also enters a recovery process, 130 errors, erases 25 objects.

rurban added a commit that referenced this issue Oct 3, 2023
maybe the reason for the GH #851 readDWG crash
rurban added a commit that referenced this issue Oct 4, 2023
maybe the reason for the GH #851 readDWG crash.
simplifies a lot.
@turtle0x1
Copy link
Author

turtle0x1 commented Oct 4, 2023

The above Autocad still renders attribute tags / mtext within a block on the paperspace as pink for some reason, any ideas? Maybe something I could look at? (I'll need some pointers)

But down to 74 errors on open, 25 removed again, a 43% decrease 🎉 (I know this a non-goal, but still nice!)

rurban added a commit that referenced this issue Oct 4, 2023
maybe the reason for the GH #851 readDWG crash.
simplifies a lot.
rurban added a commit that referenced this issue Oct 4, 2023
maybe the reason for the GH #851 readDWG crash.
simplifies a lot.
rurban added a commit that referenced this issue Oct 5, 2023
maybe the reason for the GH #851 readDWG crash.
simplifies a lot.
rurban added a commit that referenced this issue Oct 5, 2023
maybe the reason for the GH #851 readDWG crash.
simplifies a lot.
@turtle0x1
Copy link
Author

This one causes autocad to crash and never load for me

@rurban
Copy link
Contributor

rurban commented Oct 11, 2023

This one causes autocad to crash and never load for me

That's bad, because we need that long-term. There are still problems with MTEXT attributes, yes. I see them.

@rurban
Copy link
Contributor

rurban commented Nov 29, 2023

Still the same problem

@turtle0x1
Copy link
Author

Still crashes when using the JSON generated by the old version using the command ./programs/dwgwrite -I json -o out.dwg in.dwg. Will try regenerating the JSON file.

@rurban rurban changed the title Fatal error autocad Object of class AcDbDictionary can't be cast to AcDbEntity Feb 5, 2024
@rurban
Copy link
Contributor

rurban commented Feb 5, 2024

Missing implemention of MTEXTATTRIBUTEOBJECTCONTEXTDATA, causing these errors.
Which needs the Embedded Object logic for a SCALE object.

However, with this example all MTEXTATTRIBUTEOBJECTCONTEXTDATA.enable_context fields are 0.

you can try with a --enable-debug version

rurban added a commit that referenced this issue Feb 5, 2024
as embedded SCALE object, if the SCALE is not 1:1.
See GH #851
rurban added a commit that referenced this issue Feb 5, 2024
as embedded SCALE object, if the SCALE is not 1:1.
See GH #851
rurban added a commit that referenced this issue Feb 5, 2024
as embedded SCALE object, if the SCALE is not 1:1.
See GH #851
@turtle0x1
Copy link
Author

I think your implying I should retest this? If so I can do that by the end of week if thats alright?

@rurban
Copy link
Contributor

rurban commented Feb 6, 2024

I've already tested it. It doesn't crash anymore but mtext attributes are still not supported, leading to this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants