skymakerolof / dxf

DXF parser for node/browser
https://www.npmjs.com/package/dxf
MIT License
335 stars 122 forks source link

Layout & paper space #105

Closed ieskudero closed 2 years ago

ieskudero commented 2 years ago

Hello,

After using this library & threeJS to create a dxf renderer I have encountered a problem that I think most of renderers has. After reading & parsing a dxf file all the entities are drawn in screen. The problem is that some dxf have not only model space entities, but also paper space entities that should be rendered separately. Seen that I couldn't parse any layout I have implemented it myself. I have used these documentations for it:

https://documentation.help/AutoCAD-DXF/WSfacf1429558a55de185c428100849a0ab7-5d8d.htm https://documentation.help/AutoCAD-DXF/WS1a9193826455f5ff18cb41610ec0a2e719-79a0.htm

I have added an objects property to the parsed element and a layout list in it, and added some missing properties to entities (paperspace & layout).

The idea is to use it to get which entities are drawn in which paper space ( or model space ). I didn't figure it out yet, and I will update the parser if some properties are yet missing, but should be a good start for it.

I have forked your project and created a branch with the implementation. I can make a pull request with it if you want.

skymakerolof commented 2 years ago

This looks promising, nice work @ieskudero! Would be great if you could create a pull request also including some kind of test to verify your changes. Thank you!

ieskudero commented 2 years ago

OK, I will try to add the test.

Also, I have parsed Viewport, Vport and Hatch entities. Should I make pull requests with them?

skymakerolof commented 2 years ago

Nice, absolutely! If the changes are not related to each other, try to separate them into their own pull requests rather than putting them all in one big request. If they're all dependent on each other it's fine with just one. Thanks!

skymakerolof commented 2 years ago

Closed by https://github.com/skymakerolof/dxf/pull/106