diff --git a/doc/dynapi.texi b/doc/dynapi.texi index 0822c3c59..830c08f74 100644 --- a/doc/dynapi.texi +++ b/doc/dynapi.texi @@ -9314,6 +9314,8 @@ BL, DXF 90 B, DXF 70 @item rotated_type RC, DXF 71 +@item has_lastpt_ref +B @item ref Dwg_DIMASSOC_Ref* diff --git a/include/dwg.h b/include/dwg.h index ec7d689d7..55e9d99b6 100644 --- a/include/dwg.h +++ b/include/dwg.h @@ -5364,6 +5364,7 @@ typedef struct _dwg_object_DIMASSOC BITCODE_BL associativity; /*!< DXF 90, bitmask 0-15 */ BITCODE_B trans_space_flag; /*!< DXF 70 boolean */ BITCODE_RC rotated_type; /*!< DXF 71 */ + BITCODE_B has_lastpt_ref; // copy of last ref field Dwg_DIMASSOC_Ref *ref; /* 1-4x, with possible holes, depends on associativity bitmask */ } Dwg_Object_DIMASSOC; diff --git a/src/dwg.spec b/src/dwg.spec index f56cf236f..a81c4a01a 100644 --- a/src/dwg.spec +++ b/src/dwg.spec @@ -9950,7 +9950,7 @@ DWG_ENTITY_END FIELD_B (dimension.flip_arrow1, 297) // (varies) UNSTABLE -// 1-4 references, see associativity bits 1-8. +// 1-6 references, see associativity bits 1-8. DWG_OBJECT (DIMASSOC) HANDLE_UNKNOWN_BITS; @@ -9959,12 +9959,11 @@ DWG_OBJECT (DIMASSOC) FIELD_B (trans_space_flag, 70); FIELD_RC (rotated_type, 71); FIELD_HANDLE (dimensionobj, 4, 330); - // 6 = maximum of items REPEAT_CN (6, ref, Dwg_DIMASSOC_Ref) // i.e. AcDbOsnapPointRef REPEAT_BLOCK - // there could be more blocks, up to 5. + // there could be more blocks, up to 5 or 6. // 0 1 2 3 => 1 2 4 8. skip unset bits - if (!(FIELD_VALUE (associativity) & (1 << rcount1))) + if (!(FIELD_VALUE (associativity) & (1 << rcount1)) && !FIELD_VALUE(has_lastpt_ref)) { #ifdef IS_JSON ENDHASH; @@ -10001,6 +10000,7 @@ DWG_OBJECT (DIMASSOC) FIELD_VECTOR_T (ref[rcount1].intersec_xrefpaths, T, ref[rcount1].num_intersec_xrefpaths, 302) } SUB_FIELD_B (ref[rcount1], has_lastpt_ref, 75); + FIELD_VALUE(has_lastpt_ref) = SUB_FIELD_VALUE(ref[rcount1], has_lastpt_ref); SET_PARENT_OBJ (ref[rcount1]); END_REPEAT_BLOCK END_REPEAT (ref) diff --git a/src/dynapi.c b/src/dynapi.c index 9a85dbd96..8542ea00c 100644 --- a/src/dynapi.c +++ b/src/dynapi.c @@ -7777,6 +7777,8 @@ static const Dwg_DYNAPI_field _dwg_DIMASSOC_fields[] = { 0,0,0, 70 }, { "rotated_type", "RC", sizeof (BITCODE_RC), OFF (struct _dwg_object_DIMASSOC, rotated_type), 0,0,0, 71 }, + { "has_lastpt_ref", "B", sizeof (BITCODE_B), OFF (struct _dwg_object_DIMASSOC, has_lastpt_ref), + 0,0,0, 0 }, { "ref", "Dwg_DIMASSOC_Ref*", sizeof (Dwg_DIMASSOC_Ref*), OFF (struct _dwg_object_DIMASSOC, ref), 1,1,0, 0 }, {NULL, NULL, 0, 0, 0,0,0, 0}, diff --git a/test/unit-testing/dynapi_test.c b/test/unit-testing/dynapi_test.c index 148c4bdfb..6aeefe88c 100644 --- a/test/unit-testing/dynapi_test.c +++ b/test/unit-testing/dynapi_test.c @@ -46465,6 +46465,21 @@ static int test_DIMASSOC (const Dwg_Object *obj) else fail ("DIMASSOC.dimensionobj [H]"); } + { + BITCODE_B has_lastpt_ref; + if (dwg_dynapi_entity_value (dimassoc, "DIMASSOC", "has_lastpt_ref", &has_lastpt_ref, NULL) + && has_lastpt_ref == dimassoc->has_lastpt_ref) + pass (); + else + fail ("DIMASSOC.has_lastpt_ref [B] " FORMAT_B " != " FORMAT_B "", dimassoc->has_lastpt_ref, has_lastpt_ref); + has_lastpt_ref++; + if (dwg_dynapi_entity_set_value (dimassoc, "DIMASSOC", "has_lastpt_ref", &has_lastpt_ref, 0) + && has_lastpt_ref == dimassoc->has_lastpt_ref) + pass (); + else + fail ("DIMASSOC.has_lastpt_ref [B] set+1 " FORMAT_B " != " FORMAT_B "", dimassoc->has_lastpt_ref, has_lastpt_ref); + dimassoc->has_lastpt_ref--; + } { struct _dwg_object_object* parent; if (dwg_dynapi_entity_value (dimassoc, "DIMASSOC", "parent", &parent, NULL)