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

Problem reading gradient hatch from files v2004 #27

Closed
arturred opened this issue Jun 27, 2018 · 11 comments
Closed

Problem reading gradient hatch from files v2004 #27

arturred opened this issue Jun 27, 2018 · 11 comments
Labels
bug Something isn't working

Comments

@arturred
Copy link

I have problems decoding hatch with gradient in these files v2004 :

DWG.zip

Can you please take a look if the spec is correct? Strangely the same files converted to version 2000 or 2007 open fine.

@rurban
Copy link
Contributor

rurban commented Jun 27, 2018

I see, HATCH handle: 0.3.1E9F74 [5] in CascoUrbano.dwg is wrong.
Will check.

The problem is not with the HATCH itself, but earlier from the common_entity_data already with the colors. So it affects all entities with RGB colors. Thanks a lot!
Working on it in the smoke/enc branch

@arturred
Copy link
Author

Great :) Thanks for fast response.

@rurban rurban reopened this Jun 28, 2018
@rurban
Copy link
Contributor

rurban commented Jun 28, 2018

I could fix this bug now. It was of course another ODA spec bug with RBG colors.

The colors of gradient HATCH'es are still not fully converted to DXF properly though. There are some special tricks. Will do this later.

@arturred
Copy link
Author

Are your commits for rgb colors final, because I applied them fast way but still get corrupted hatch (number of gradient colors is too big and I get corrupted name strings) ?

@rurban
Copy link
Contributor

rurban commented Jun 28, 2018

Nope, not yet. Still get corrupted 2013 DWGs and nan's.

@arturred
Copy link
Author

For v2004 I get corrupted hatch only if color has together AcDbColor reference (0x40) and complex color (0x80)

@arturred
Copy link
Author

for 2013 I'm not sure about reading has_ds_binary_data. ODA spec says so, but reading this byte corrupts next reading.

@rurban
Copy link
Contributor

rurban commented Jun 28, 2018

Exactly, this is wrong. Just deleted it by myself some minutes ago. Great analysis.
It's basically the same as nolinks.

b974888 should have it fixed.

@rurban rurban closed this as completed Jun 28, 2018
@arturred
Copy link
Author

Ok, I figured out where the problem occurs. Here is extracted hatch 0x1E9F74 and screenshot from editor
hatch_with_color_ref.zip
Gradient has two colors : reference color DIC6 and white color. To decode the colors correctly you must check the ignored_color_byte of Dwg_HATCH_Color that is really flags like in ENC: (flags & 1) is color.name, (flags & 2) is color.book_name. In this case it's value of 3 so you need to read FIELD_T twice.

Also after tests I think that in ENC decoder if you have (flags & 0x40) then you should ignore (flags & 0x80) because the color value you will read in COMMON_ENTITY_HANDLE_DATA.

ODA spec is really buggy.

@rurban
Copy link
Contributor

rurban commented Jun 28, 2018

I'll leave now for holidays for a week, and will incooperate this into the next release.
I think the 2 strings name and book_name are only for entities, not for objects, but I'll have to check your new example still.

Yes, the color handle is read from COMMON_ENTITY_HANDLE_DATA. There needs to be a check for the flag & 0x40.

@rurban rurban reopened this Jun 28, 2018
rurban added a commit that referenced this issue Jun 28, 2018
This fixes the error with hatch_color_ref.dwg from [GH #27]
and several LAYER entities with attached large EED data.
rurban added a commit that referenced this issue Jun 28, 2018
This fixes the error with hatch_color_ref.dwg from [GH #27]
and several LAYER entities with attached large EED data.
rurban added a commit that referenced this issue Jun 28, 2018
This fixes the error with hatch_color_ref.dwg from [GH #27]
and several LAYER entities with attached large EED data.
rurban added a commit that referenced this issue Jun 28, 2018
And on overlong stringsize just skip it to the end.

This fixes the error with hatch_color_ref.dwg from [GH #27]
and several LAYER entities with attached large EED data.
rurban added a commit that referenced this issue Jul 13, 2018
referenced by color handle of some entities WIP
See 2004/CascoUrbano GH #27
@rurban rurban added the bug Something isn't working label Jul 15, 2018
rurban added a commit that referenced this issue Jul 23, 2018
@rurban
Copy link
Contributor

rurban commented Jul 23, 2018

gradient_fills are now stable

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