vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
310 stars 97 forks source link

Is it possible to support acad_proxy_entity parsing 310 binary chunks? #35

Closed kaldr closed 1 year ago

kaldr commented 1 year ago

I'm working on a Chinese project of dxf files based on dxf-viewer.

I've already done some work on entities such as attdef, linear dimension. And created some plugins to do annotation with simple drawings such as circle or rectangle, cursor selection, magnetic adsorption of lines and rerendering manual-created objects on canvas, text searching and locating, border searching for drawings. But my code adapts to this project too much, so i haven't rebuilt my code and contributed them to this project yet.

I'm going to apply to join your development group later. I think i'm helpful on some tasks :)

I'm now solving hatch, image, and acad_proxy_entity.

Acad_proxy_entity has a 310 binary chunks value, I can't decode the and stuck on it.

Such as:

0 ACAD_PROXY_ENTITY 5 41590 330 4116D 100 AcDbEntity 8 WALL 100 AcDbProxyEntity 90 498 91 528 71 31 97 55 70 0 160 8 310 0800000000000000 162 2 311 80 161 965 310 0500000000000012502030000820ECE7F703879A0C4DE8CB133369FDAC49E8ECECECECECECECECE7F703879A0C4DE897133369DDB049E8ECECECECECECECECECECECECECECECECECECECECECECECECECED89ECECECECECECED89ECECECECECED2E71EC02280019BF94AE078155102000800800000165028010 330 0 330 0 330 0 330 0 330 4158F 330 41591 340 0 340 0 340 462B 340 0 330 0 330 0 94 0

Are you going to solve this problem or provide some ideas to me? There is so little information on it. I've even search in Russian and German, noting helpful. The only helpful link is broken and can't visit in China. T^T

vagran commented 1 year ago

Hello, As I understand ACAD_PROXY_ENTITY may be generated by third-party software, so its content is usually understandable only by this software unless it is documented somewhere. Tag 310 encodes a binary chunk as a sequence of hexadecimal-encoded bytes (so to get the binary data, just parse each digit pair into a byte), however interpretation of the resulting binary data depends on a particular entity type, which as I said is defined by some 3rd party software and might not be documented. What effect are you trying to achive? Do you want to display content of these enities? This is only possible if you know what exactly it contains, which software has generated it, and having its format documentation. The simpliest way is just ignoring these entities (which is the way to go for a generic viewer). Is not dxf-viewer currently just skipping them or it produces some parsing error? In case of error it would be great to get the sample file.

BTW linear dimensions are now supported on a basic level, check yesterday release.

Regarding contribution, there is actually no huge need for that now. It is often non-trivial to integrate 3rd party code into this project, making the changes be seamless with the overall project architecture and approach. The best contribution now is bug reporting, some ideas for future features, advices and sample files (samples demonstrating some bug or missing feature are most valuable). Also I have plans to greatly refactor this project code in some future, rewriting it in TypeScript, also fully re-writing from scratch the DXF parser component which was initially adopted from other open-source project.

kaldr commented 1 year ago

Hello, As I understand ACAD_PROXY_ENTITY may be generated by third-party software, so its content is usually understandable only by this software unless it is documented somewhere. Tag 310 encodes a binary chunk as a sequence of hexadecimal-encoded bytes (so to get the binary data, just parse each digit pair into a byte), however interpretation of the resulting binary data depends on a particular entity type, which as I said is defined by some 3rd party software and might not be documented. What effect are you trying to achive? Do you want to display content of these enities? This is only possible if you know what exactly it contains, which software has generated it, and having its format documentation. The simpliest way is just ignoring these entities (which is the way to go for a generic viewer). Is not dxf-viewer currently just skipping them or it produces some parsing error? In case of error it would be great to get the sample file.

BTW linear dimensions are now supported on a basic level, check yesterday release.

Regarding contribution, there is actually no huge need for that now. It is often non-trivial to integrate 3rd party code into this project, making the changes be seamless with the overall project architecture and approach. The best contribution now is bug reporting, some ideas for future features, advices and sample files (samples demonstrating some bug or missing feature are most valuable). Also I have plans to greatly refactor this project code in some future, rewriting it in TypeScript, also fully re-writing from scratch the DXF parser component which was initially adopted from other open-source project.

Thank you. So it's a little bit hard for me to find another way to decode the binary chunk.

Files are too big, so I compressed one. For example, in this file, dxf-viewer doesn't render the dimension and other entities:

image

Based on my checks, I think these entities are in ACAD_PROXY_ENTITY. Of course, in AutoCAD, these entities are not shown either. In another CAD software, which can process 310 tag binary chunk, the correct figure is below:

image

acad_proxy_entity_example.zip

I will provide some other bugs I found for dxf-viewer project in other issues when I'm free.

Refactor with Typescript is a great idea. My best wishes! :) thank you for your replying again.