r10/from_autocad_r10_mac/tablet.dwg and the xenix variant cannot decode a POLYLINE_2D, which is wrongly identified as POLYLINE_MESH, with 2D and 3D nd MESH vertices, with bulge and tangent_dir.
the pline_flag offset calc is wrong, for ltype preR11. there the ltype has only size 1.

type: 19 [RCd]
Detect polyline: start_byte: 62826, flag_r11: 0x82, opts_r11: 0x1, pline_flag: **0x14** !
Add entity POLYLINE_MESH [1946] Decode entity POLYLINE_MESH

... VERTEX_2D's

@offset: 0xf124
type: 20 [RCd]
Detect vertex: start_byte: 63043, flag_r11: 0x2, opts_r11: 0x1c, vertex_flag: 0x44
Add entity VERTEX_MESH [1953] Decode entity VERTEX_MESH

Entity number: 1953, Type: 20, Addr: f642
flag_r11: 0x2 [RC 0] @63044.0
          HAS_LTYPE(0x2) 
size: 42 [RS] @4.0
layer: 6 [H(RSd) 8] @63046.0
opts_r11: 0x1c [RSx 0] @63050.0
          HAS_BULGE(0x4) HAS_FLAG(0x8) HAS_TANGENT_DIR(0x10) 
ltype: 0 [H(RC) 6] @63050.0
object_map{3DC} = 1953
=> handle: (0.2.3DC)
point: (8.01401, 1.70443) [2RD 10] @63067.0
flag: 0xc4 [RC 0] @63068.0
      UNUSED_4(0x4) MESH(0x40) PFACE_MESH(0x80) 
ERROR: offset 16

...

@offset: 0xf23e
type: 20 [RCd]
Detect vertex: start_byte: 63325, flag_r11: 0x2, opts_r11: 0x1c, vertex_flag: 0x71
Add entity VERTEX_3D [1961] Decode entity VERTEX_3D

Entity number: 1961, Type: 20, Addr: f75c
flag_r11: 0x2 [RC 0] @63326.0
          HAS_LTYPE(0x2) 
size: 42 [RS] @4.0
layer: 6 [H(RSd) 8] @63328.0
opts_r11: 0x1c [RSx 0] @63332.0
          HAS_BULGE(0x4) HAS_FLAG(0x8) HAS_TANGENT_DIR(0x10) 
ltype: 0 [H(RC) 6] @63332.0
object_map{3DC} = 1961
=> handle: (0.2.3DC)
point: (7.94132, 1.70044) [2RD 10] @63349.0
flag: 0xa3 [RC 0] @63350.0
      EXTRA_VERTEX(0x1) CURVE_FIT(0x2) 3D(0x20) PFACE_MESH(0x80) 
ERROR: offset 16

converted to DXF the MESH vertex would be 
  0
VERTEX
  5
E2A
  8
SYMBOLS
  6
CONTINUOUS
 10
8.014006349535594
 20
1.704433980068487
 30
0.0
 42
-0.1003814048191414

and the VERTEX_3D would be
  0
VERTEX
  5
E32
  8
SYMBOLS
  6
CONTINUOUS
 10
7.941315150782691
 20
1.700435391019081
 30
0.0
 42
-0.1003814048191623
 
with the owning POLYLINE being
  0
POLYLINE
  5
7C0
  8
SYMBOLS
  6
CONTINUOUS
 66
     1
 10
0.0
 20
0.0
 30
0.0
 70
     1

(a closed POLYLINE_2D)
decode_r11: wrong POLYLINE/VERTEX decode
This is a GitHub Issue
repo:libredwg
owner:LibreDWG
Title : decode_r11: wrong POLYLINE/VERTEX decode
Issue date:

--- start body ---
r10/from_autocad_r10_mac/tablet.dwg and the xenix variant cannot decode a POLYLINE_2D, which is wrongly identified as POLYLINE_MESH, with 2D and 3D nd MESH vertices, with bulge and tangent_dir.
the pline_flag offset calc is wrong, for ltype preR11. there the ltype has only size 1.

type: 19 [RCd]
Detect polyline: start_byte: 62826, flag_r11: 0x82, opts_r11: 0x1, pline_flag: **0x14** !
Add entity POLYLINE_MESH [1946] Decode entity POLYLINE_MESH

... VERTEX_2D's

@offset: 0xf124
type: 20 [RCd]
Detect vertex: start_byte: 63043, flag_r11: 0x2, opts_r11: 0x1c, vertex_flag: 0x44
Add entity VERTEX_MESH [1953] Decode entity VERTEX_MESH

Entity number: 1953, Type: 20, Addr: f642
flag_r11: 0x2 [RC 0] @63044.0
          HAS_LTYPE(0x2) 
size: 42 [RS] @4.0
layer: 6 [H(RSd) 8] @63046.0
opts_r11: 0x1c [RSx 0] @63050.0
          HAS_BULGE(0x4) HAS_FLAG(0x8) HAS_TANGENT_DIR(0x10) 
ltype: 0 [H(RC) 6] @63050.0
object_map{3DC} = 1953
=> handle: (0.2.3DC)
point: (8.01401, 1.70443) [2RD 10] @63067.0
flag: 0xc4 [RC 0] @63068.0
      UNUSED_4(0x4) MESH(0x40) PFACE_MESH(0x80) 
ERROR: offset 16

...

@offset: 0xf23e
type: 20 [RCd]
Detect vertex: start_byte: 63325, flag_r11: 0x2, opts_r11: 0x1c, vertex_flag: 0x71
Add entity VERTEX_3D [1961] Decode entity VERTEX_3D

Entity number: 1961, Type: 20, Addr: f75c
flag_r11: 0x2 [RC 0] @63326.0
          HAS_LTYPE(0x2) 
size: 42 [RS] @4.0
layer: 6 [H(RSd) 8] @63328.0
opts_r11: 0x1c [RSx 0] @63332.0
          HAS_BULGE(0x4) HAS_FLAG(0x8) HAS_TANGENT_DIR(0x10) 
ltype: 0 [H(RC) 6] @63332.0
object_map{3DC} = 1961
=> handle: (0.2.3DC)
point: (7.94132, 1.70044) [2RD 10] @63349.0
flag: 0xa3 [RC 0] @63350.0
      EXTRA_VERTEX(0x1) CURVE_FIT(0x2) 3D(0x20) PFACE_MESH(0x80) 
ERROR: offset 16

converted to DXF the MESH vertex would be 
  0
VERTEX
  5
E2A
  8
SYMBOLS
  6
CONTINUOUS
 10
8.014006349535594
 20
1.704433980068487
 30
0.0
 42
-0.1003814048191414

and the VERTEX_3D would be
  0
VERTEX
  5
E32
  8
SYMBOLS
  6
CONTINUOUS
 10
7.941315150782691
 20
1.700435391019081
 30
0.0
 42
-0.1003814048191623
 
with the owning POLYLINE being
  0
POLYLINE
  5
7C0
  8
SYMBOLS
  6
CONTINUOUS
 66
     1
 10
0.0
 20
0.0
 30
0.0
 70
     1

(a closed POLYLINE_2D)
--- end body ---
