libredwg icon indicating copy to clipboard operation
libredwg copied to clipboard

Improve logging of LTYPE dashes in dwgread output

Open michal-josef-spacek opened this issue 11 months ago • 5 comments

Example (r14): ltype1.dwg.gz

This is line with two text dashes.

Output:

Next object: 27 Handleoff: 0xB [UMC] Offset: -1254 [MC] @1896
==========================================
Object number: 27/1B, Size: 510 [MS], Type: 57 [BS], Address: 1898
Add table record LTYPE [27] Decode table record LTYPE
handle: 0.1.28 [H 5]
EED[0] size: 0 (end)
num_eed: 0
bitsize: 3980 [RL]
 Hdlsize: 0x64, hdl_dat: @497.4 - @510.0 (510)
num_reactors: 0 [BL 0]
ownerhandle: (4.1.5) abs:5 [H 330]
xdicobjhandle: (3.0.0) abs:0 [H 360]
--common_size: 52
name: "FOO" [T 2]
is_xref_ref: 1 [B 0]
is_xref_resolved: 0 [BS 0]
is_xref_dep: 0 [B 0]
xref: (5.0.0) abs:0 [H 0]
description: "---- FOO ---- BAR ---- FOO ---- BAR ---- FOO --" [T 3]
pattern_len: 1.8 [BD 0]
alignment: 0x41 [RC 72]
numdashes: 6 [RC 73]
dashes[0].length: 0.5 [BD 49]
dashes[0].complex_shapecode: 0 [BS 75]
dashes[rcount1].style: (5.0.0) abs:0 [H 340]
dashes[0].x_offset: 0 [RD 44]
dashes[0].y_offset: 0 [RD 45]
dashes[0].scale: 1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[0].shape_flag: 0 [BS 74]
dashes[1].length: -0.2 [BD 49]
dashes[1].complex_shapecode: 0 [BS 75]
dashes[rcount1].style: (5.1.10) abs:16 [H 340] => STYLE STANDARD
dashes[1].x_offset: -0.1 [RD 44]
dashes[1].y_offset: -0.05 [RD 45]
dashes[1].scale: 0.1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[1].shape_flag: 2 [BS 74]
dashes[2].length: -0.2 [BD 49]
dashes[2].complex_shapecode: 0 [BS 75]
dashes[rcount1].style: (5.0.0) abs:0 [H 340]
dashes[2].x_offset: 0 [RD 44]
dashes[2].y_offset: 0 [RD 45]
dashes[2].scale: 1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[2].shape_flag: 0 [BS 74]
dashes[3].length: 0.5 [BD 49]
dashes[3].complex_shapecode: 0 [BS 75]
dashes[rcount1].style: (5.0.0) abs:0 [H 340]
dashes[3].x_offset: 0 [RD 44]
dashes[3].y_offset: 0 [RD 45]
dashes[3].scale: 1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[3].shape_flag: 0 [BS 74]
dashes[4].length: -0.2 [BD 49]
dashes[4].complex_shapecode: 4 [BS 75]
dashes[rcount1].style: (5.1.10) abs:16 [H 340] => STYLE STANDARD
dashes[4].x_offset: -0.1 [RD 44]
dashes[4].y_offset: -0.05 [RD 45]
dashes[4].scale: 0.1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[4].shape_flag: 2 [BS 74]
dashes[5].length: -0.2 [BD 49]
dashes[5].complex_shapecode: 0 [BS 75]
dashes[rcount1].style: (5.0.0) abs:0 [H 340]
dashes[5].x_offset: 0 [RD 44]
dashes[5].y_offset: 0 [RD 45]
dashes[5].scale: 1 [BD 46]
dashes[rcount1].rotation: 0 [BD 50]  0º
dashes[5].shape_flag: 0 [BS 74]
strings_area: "FOO" [TF 256 0]
dashes[1] @0
dashes[4] @4
 padding: +4
 object_map{28} = 27
 padding: 0/0 (4 bits)
crc: 2927 [RSx]
 check_CRC 1896-2408 = 512: 2927 == 2927

I am focusing to lines:

strings_area: "FOO" [TF 256 0]
dashes[1] @0
dashes[4] @4

In strings area is "FOO" \0 "BAR", but in logging is only "FOO", because \0. I think that we need better logging of strings_area than TF. I am proposing hexadecimal output.

I am proposing to log real text to each dash. Something like:

dashes[1] FOO @0
dashes[4] BAR @4

michal-josef-spacek avatar Mar 12 '24 12:03 michal-josef-spacek

PR for adding of text to log: https://github.com/LibreDWG/libredwg/pull/957

michal-josef-spacek avatar Mar 12 '24 12:03 michal-josef-spacek

Another issue is r13 DWG (AC1012) which has on begin of strings_area \0 Example: ltype1_r13.dwg.gz

Same example as previous (FOO and BAR)

Output:

strings_area: "" [TF 256 0]
dashes[1] @0
dashes[4] @1

I don't understand what this \0 mean. Some unknown RC before strings_area?

michal-josef-spacek avatar Mar 12 '24 12:03 michal-josef-spacek

I updated PR. Actual logging output:

...
strings_area: "FOO" [TF 256 0]
dashes[1].text: "FOO" [TF 3 9] @0
dashes[4].text: "BAR" [TF 3 9] @4
...

michal-josef-spacek avatar Mar 12 '24 14:03 michal-josef-spacek

I updated PR for LTYPE version on R13. Tested on DWGs.

michal-josef-spacek avatar Mar 12 '24 19:03 michal-josef-spacek

The only thing to do is bad strings_area

michal-josef-spacek avatar Mar 12 '24 19:03 michal-josef-spacek