vagran / dxf-viewer

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

Provide information about dimension #28

Closed dotoritos-kim closed 1 year ago

dotoritos-kim commented 1 year ago

DXF Reference Common Dimension Group Codes

The dimension line separates the material as above.

And in dxf-parser , it is classified in the code above. I think you need to create a separate group for one dimension line. so, I think you should create a separate rendering class and classification logic for one dimension line.

vagran commented 1 year ago

Hello, I have seen your pull request, but it does not seem to be valid, I have tried to run your branch, but it still does not display any dimensions. BTW, I have added contribution guidelines to make it clear what a valid pull request should look like. Regarding dimensions support. This indeed is the most awaited entity to support next from the TODO list. I will probably proceed with looking into it as well (actually I have already started some activities during this weekend). For now I have the following findings and roadmap:

  1. For the initial implementation we can limit support to linear dimensions (vertical, horizontal, rotated and aligned) with a very limited features support (will need to identify them for release notes and readme, and also update list of todo features for DIMENSION entity).
  2. Here is a good source of additional information about parameters defining the dimension.
  3. There are quite a lot of system variables which define how the dimension should look like. Some initial minimal subset should be identified to start with (rendered dimension size and position -related).
  4. These variable can be originated from several sources, taking precedence in the following order: a. Dimension style override in DIMENSION entity. b. Dimension style defined in DIMSTYLE table entry. Need to implement this table parsing and lookup. c. DXF file header. d. Some predefined default values (example).
  5. Dimension entity should be decomposed into rendering primitives in the same way it is done for other entities. It should be lines, text, and solid trianges for arrowhead arrow style.
  6. Initially we can render all dimensions with a default arrowhead, providing possibility to finish this feature later.
  7. Dimension text is either overridden or calculated as distance between the dimension anchor points. When overriding text some special values should be recognized - single space " " to suppress text, missing group tag or empty string is default text. "<>" pattern in the override text should be replaced by the default text. Default text units and formatting is defined by several system variables like DIMLFAC, DIMLUNIT and DIMFRAC
vagran commented 1 year ago

v1.0.21 released with most of this stuff implemented. Feel free to open new issues for still unimplemented dimension-related features (preferably with example files attached).