Open andrelmlins opened 6 years ago
Do you mean the HATCH entity? It's possible to add them, but will require quite a bit of work. HATCH entities are one of the most complex entities in the DXF spec. I'm open to pull requests for anyone who wants to work on this. Not sure when I will have time to work on this next.
going to upvote this.
would be great to have this.
Parsing the hatch patterns seems very straight-forward, as they are specified as .pat hatch files, as explained on the https://pattycake.io . All codes are available in the autocad_2012_pdf_dxf-reference_enu.pdf .
Rendering them to svg or canvas is a bit trickier, and I still need to figure out a reasonable approach to do it.
I ended up writing my own hatch parser, but it crashes browser frequently if trying to use canvas image with bounds inside the polygon. Maybe you could draw lines or something??
Yeah, parsing is straight-forward. There's also this pull request from 2019. covering some of it: https://github.com/gdsestimating/dxf-parser/pull/45
There's some compatibility issue between the hatches and the browser. SVG2 planned for <hatch>
and <hatchpath>
elements, but seems they opted against it. Even Autodesk Forge brute-forces hatches as individual stroke lines.
I'm guessing Houdini aka CSS Painting API Worklets is the most recent initiative to bridge this gap, but support is still spotty.
Would it be possible to read the hatch property within an entity?