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

LibreCAD HATCH misrenders in AutoDesk software #1739

Open
Rodrigodd opened this issue Feb 16, 2024 · 4 comments
Open

LibreCAD HATCH misrenders in AutoDesk software #1739

Rodrigodd opened this issue Feb 16, 2024 · 4 comments

Comments

@Rodrigodd
Copy link

Expected behavior

The following hatched shape should render correctly in other software:

image

Observed behavior

Autodesk Viewer and Autodesk DWG True View, renders it incorrectly:

image

Converting it to GeoJSON, using the GDAL project, generates a invalid Polygon, see OSGeo/gdal#9240.

The problem appears to be that the Hatch entity in the DXF files contains a boundary formed by disjoint shapes, which is invalid? I am not well versed in the DXF specification, so I hope someone more experience here can answer that. It will also help with the GDAL issue above.

Steps to reproduce or sample file

Draw two disjoint rectangles. Choose Tool->Hatch. Select Both rectangles. Press Enter. Choose Solid Fill, and OK.

sample file: test.zip

Operating System and LibreCAD version info

Version: 2.2.0.2
Compiler: GNU GCC 13.1.0
Compiled on: Jul 29 2023
Qt Version: 5.12.11
Boost Version: 1.75.0
System: Windows 10 (10.0)

It is actually Windows 11, but the About box reported it as Windows 10.

@dxli
Copy link
Member

dxli commented Feb 19, 2024

it's rendered correctly in the lastest development version.

@Rodrigodd
Copy link
Author

@dxli Yes, but not in the Autodesk software. My point is that the HATCH boundary geometry may be invalid, at least according to Autodesk, which, I believe, owns the DXF format.

@dxli
Copy link
Member

dxli commented Feb 20, 2024

dxf format specifies:

  1. number of loops;
  2. edges of a loop;
  3. edge type (lines here);
  4. edge line positions.

Beyond that, we don't simulate Autodesk behaviors. In this particularly case, valid loops can be created from edges, so hatch is created this way.

@lordofbikes
Copy link
Member

The DXF reference for HATCH SOLID is not very specific about the composition of boundary path data. There is much room for interpretation.
Basically the same applies as in OSGeo/gdal#9240, namely that the created geometry is invalid.

So what LibreCAD can do is to prohibit the use of non intersecting/including multi loop boundaries for hatch. But somebody might see this as feature and will be disappointed when we change it.

As we know the code how the hatch is created, we also have the working code to render this as expected. But we don't know the closed code from Autodesk, so it would require some valuable efforts to reverse-engineer the Autodesk code to find a way to create this special case of HATCH in a DXF.

The conclusion is, that you simply create two hatch, one for each square, and you will have a DXF which is valid for OSGeo, Autodesk and LibreCAD.

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

3 participants