Skip to content

Commit e64aaef

Browse files
Improve DIMASSOC object
1 parent b90fcfc commit e64aaef

File tree

4 files changed

+56
-44
lines changed

4 files changed

+56
-44
lines changed

doc/dynapi.texi

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14060,12 +14060,18 @@ BL, DXF 91
1406014060
BS
1406114061
@item xrefpaths
1406214062
TV*, DXF 301
14063+
@item num_intersec_xrefpaths
14064+
BS
14065+
@item intersec_xrefpaths
14066+
TV*
1406314067
@item has_lastpt_ref
1406414068
B, DXF 75
14065-
@item lastpt_ref
14066-
3BD
14069+
@item intersec_subent_type
14070+
BS, DXF 74
14071+
@item intersec_gsmarker
14072+
BL, DXF 92
1406714073
@item num_intsectobj
14068-
BL, DXF 74
14074+
BL
1406914075
@item intsectobj
1407014076
H*, DXF 332
1407114077

include/dwg.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5282,20 +5282,23 @@ typedef struct _dwg_object_DATALINK
52825282
typedef struct _dwg_DIMASSOC_Ref
52835283
{
52845284
struct _dwg_object_DIMASSOC *parent;
5285-
BITCODE_T classname; /*!< DXF 1 constant */
5286-
BITCODE_RC osnap_type; /*!< DXF 72 */
5287-
BITCODE_BD osnap_dist; /*!< DXF 40 */
5288-
BITCODE_3BD osnap_pt; /*!< DXF 10-30 */
5285+
BITCODE_T classname; /*!< DXF 1 constant */
5286+
BITCODE_RC osnap_type; /*!< DXF 72 */
5287+
BITCODE_BD osnap_dist; /*!< DXF 40 */
5288+
BITCODE_3BD osnap_pt; /*!< DXF 10-30 */
52895289
BITCODE_BS num_xrefs;
5290-
BITCODE_H *xrefs; /*!< DXF 331 the geometry objects, 1 or 2 */
5291-
BITCODE_BS main_subent_type; /*!< DXF 73 */
5292-
BITCODE_BL main_gsmarker; /*!< DXF 91 */
5290+
BITCODE_H *xrefs; /*!< DXF 331 the geometry objects, 1 or 2 */
5291+
BITCODE_BS main_subent_type; /*!< DXF 73 */
5292+
BITCODE_BL main_gsmarker; /*!< DXF 91 */
52935293
BITCODE_BS num_xrefpaths;
5294-
BITCODE_T *xrefpaths; /*!< DXF 301 */
5295-
BITCODE_B has_lastpt_ref; /*!< DXF 75 */
5296-
BITCODE_3BD lastpt_ref; /*!< DXF ?? */
5297-
BITCODE_BL num_intsectobj; /*!< DXF 74 */
5298-
BITCODE_H* intsectobj; /*!< DXF 332 the intersection objects, 1 or 2 */
5294+
BITCODE_T *xrefpaths; /*!< DXF 301 */
5295+
BITCODE_BS num_intersec_xrefpaths;
5296+
BITCODE_T *intersec_xrefpaths; /*!< DXF 302 */
5297+
BITCODE_B has_lastpt_ref; /*!< DXF 75 */
5298+
BITCODE_BS intersec_subent_type; /*!< DXF 74 */
5299+
BITCODE_BL intersec_gsmarker; /*!< DXF 92 */
5300+
BITCODE_BL num_intsectobj;
5301+
BITCODE_H* intsectobj; /*!< DXF 332 the intersection objects, 1 or 2 */
52995302
} Dwg_DIMASSOC_Ref;
53005303

53015304
typedef struct _dwg_object_DIMASSOC

src/dwg.spec

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9896,46 +9896,43 @@ DWG_OBJECT (DIMASSOC)
98969896
FIELD_B (trans_space_flag, 70);
98979897
FIELD_RC (rotated_type, 71);
98989898
FIELD_HANDLE (dimensionobj, 4, 330);
9899-
REPEAT_CN (4, ref, Dwg_DIMASSOC_Ref) // i.e. AcDbOsnapPointRef
9899+
// 6 = maximum of items
9900+
REPEAT_CN (6, ref, Dwg_DIMASSOC_Ref) // i.e. AcDbOsnapPointRef
99009901
REPEAT_BLOCK
9901-
// TODO: there could be much more blocks, up to 5.
9902-
// 0 1 2 3 => 1 2 4 8. skip unset bits
9903-
if (!(FIELD_VALUE (associativity) & (1<<rcount1)))
9902+
// 35 is minimal size of item
9903+
if (dat->byte + 35 > dat->size)
99049904
{
9905-
#ifdef IS_JSON
9906-
ENDHASH;
9907-
#endif
9908-
continue;
9905+
break;
99099906
}
99109907
LOG_HANDLE ("DIMASSOC_Ref.rcount1: %d\n", rcount1);
9911-
// DXF: 1, 72, 10, ??, 75
99129908
SUB_FIELD_T (ref[rcount1], classname, 1); // "AcDbOsnapPointRef"
99139909
SUB_FIELD_RC (ref[rcount1], osnap_type, 72); // 0-13
99149910
// idpaths:
9915-
SUB_FIELD_BL0 (ref[rcount1], num_intsectobj, 74);
9916-
SUB_HANDLE_VECTOR (ref[rcount1], intsectobj, num_intsectobj, 5, 332);
9911+
SUB_FIELD_BL (ref[rcount1], num_xrefs, 0);
9912+
SUB_HANDLE_VECTOR (ref[rcount1], xrefs, num_xrefs, 4, 331);
9913+
9914+
if (FIELD_VALUE (ref[rcount1].osnap_type) != 0)
9915+
{
9916+
SUB_FIELD_BL (ref[rcount1], main_subent_type, 73);
9917+
SUB_FIELD_BL (ref[rcount1], main_gsmarker, 91);
9918+
SUB_FIELD_BL (ref[rcount1], num_xrefpaths, 0);
9919+
FIELD_VECTOR_T (ref[rcount1].xrefpaths, T, ref[rcount1].num_xrefpaths, 301)
9920+
}
99179921

99189922
SUB_FIELD_BD (ref[rcount1], osnap_dist, 40);
99199923
SUB_FIELD_3BD (ref[rcount1], osnap_pt, 10);
99209924

9921-
// XrefFullSubentPath
9922-
SUB_FIELD_BL (ref[rcount1], num_xrefs, 0); // 1 or 2
9923-
SUB_VALUEOUTOFBOUNDS (ref[rcount1], num_xrefs, 100)
9924-
SUB_HANDLE_VECTOR (ref[rcount1], xrefs, num_xrefs, 4, 331);
9925-
99269925
// restrict only when writing, not when reading?
9927-
//if (FIELD_VALUE (ref[rcount1].osnap_type) == 6 || FIELD_VALUE (ref[rcount1].osnap_type) == 11)
9928-
// {
9929-
SUB_FIELD_BL0 (ref[rcount1], main_subent_type, 73);
9930-
SUB_FIELD_BL (ref[rcount1], main_gsmarker, 91);
9931-
SUB_FIELD_BL (ref[rcount1], num_xrefpaths, 0);
9932-
FIELD_VECTOR_T (ref[rcount1].xrefpaths, T, ref[rcount1].num_xrefpaths, 301)
9933-
// }
9934-
SUB_FIELD_B (ref[rcount1], has_lastpt_ref, 75);
9935-
if (FIELD_VALUE (ref[rcount1].has_lastpt_ref))
9926+
if (FIELD_VALUE (ref[rcount1].osnap_type) == 6 || FIELD_VALUE (ref[rcount1].osnap_type) == 11)
99369927
{
9937-
SUB_FIELD_3BD (ref[rcount1], lastpt_ref, 0);
9928+
SUB_FIELD_BL (ref[rcount1], num_intsectobj, 0);
9929+
SUB_HANDLE_VECTOR (ref[rcount1], intsectobj, num_intsectobj, 5, 332);
9930+
SUB_FIELD_BL (ref[rcount1], intersec_subent_type, 74);
9931+
SUB_FIELD_BL (ref[rcount1], intersec_gsmarker, 92);
9932+
SUB_FIELD_BL (ref[rcount1], num_intersec_xrefpaths, 0);
9933+
FIELD_VECTOR_T (ref[rcount1].intersec_xrefpaths, T, ref[rcount1].num_intersec_xrefpaths, 302)
99389934
}
9935+
SUB_FIELD_B (ref[rcount1], has_lastpt_ref, 75);
99399936
SET_PARENT_OBJ (ref[rcount1]);
99409937
END_REPEAT_BLOCK
99419938
END_REPEAT (ref)

src/dynapi.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11428,12 +11428,18 @@ static const Dwg_DYNAPI_field _dwg_DIMASSOC_Ref_fields[] = {
1142811428
0,0,0, 0 },
1142911429
{ "xrefpaths", "TV*", sizeof (BITCODE_TV*), OFF (struct _dwg_DIMASSOC_Ref, xrefpaths),
1143011430
1,1,0, 301 },
11431+
{ "num_intersec_xrefpaths", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_DIMASSOC_Ref, num_intersec_xrefpaths),
11432+
0,0,0, 0 },
11433+
{ "intersec_xrefpaths", "TV*", sizeof (BITCODE_TV*), OFF (struct _dwg_DIMASSOC_Ref, intersec_xrefpaths),
11434+
1,1,0, 0 },
1143111435
{ "has_lastpt_ref", "B", sizeof (BITCODE_B), OFF (struct _dwg_DIMASSOC_Ref, has_lastpt_ref),
1143211436
0,0,0, 75 },
11433-
{ "lastpt_ref", "3BD", sizeof (BITCODE_3BD), OFF (struct _dwg_DIMASSOC_Ref, lastpt_ref),
11434-
1,0,0, 0 },
11435-
{ "num_intsectobj", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, num_intsectobj),
11437+
{ "intersec_subent_type", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_DIMASSOC_Ref, intersec_subent_type),
1143611438
0,0,0, 74 },
11439+
{ "intersec_gsmarker", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, intersec_gsmarker),
11440+
0,0,0, 92 },
11441+
{ "num_intsectobj", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, num_intsectobj),
11442+
0,0,0, 0 },
1143711443
{ "intsectobj", "H*", sizeof (BITCODE_H*), OFF (struct _dwg_DIMASSOC_Ref, intsectobj),
1143811444
1,1,0, 332 },
1143911445
{NULL, NULL, 0, 0, 0,0,0, 0},

0 commit comments

Comments
 (0)