dxf-parser icon indicating copy to clipboard operation
dxf-parser copied to clipboard

Property HATCH

Open andrelmlins opened this issue 7 years ago • 6 comments

Would it be possible to read the hatch property within an entity?

andrelmlins avatar Feb 19 '18 11:02 andrelmlins

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.

bzuillsmith avatar Mar 26 '18 18:03 bzuillsmith

going to upvote this.

kpetrow avatar Aug 06 '21 13:08 kpetrow

would be great to have this.

hschmiedhofer avatar Jan 11 '23 11:01 hschmiedhofer

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.

dlabz avatar Mar 09 '23 17:03 dlabz

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??

kpetrow avatar Mar 09 '23 18:03 kpetrow

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.

dlabz avatar Mar 09 '23 18:03 dlabz