Skip to content

Commit 812ff03

Browse files
Improve DIMASSOC object
1 parent dcfe2e0 commit 812ff03

File tree

4 files changed

+75
-51
lines changed

4 files changed

+75
-51
lines changed

doc/dynapi.texi

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14116,12 +14116,18 @@ BL, DXF 91
1411614116
BS
1411714117
@item xrefpaths
1411814118
TV*, DXF 301
14119+
@item num_intersec_xrefpaths
14120+
BS
14121+
@item intersec_xrefpaths
14122+
TV*
1411914123
@item has_lastpt_ref
1412014124
B, DXF 75
14121-
@item lastpt_ref
14122-
3BD
14125+
@item intersec_subent_type
14126+
BS, DXF 74
14127+
@item intersec_gsmarker
14128+
BL, DXF 92
1412314129
@item num_intsectobj
14124-
BL, DXF 74
14130+
BL
1412514131
@item intsectobj
1412614132
H*, DXF 332
1412714133

include/dwg.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5338,20 +5338,23 @@ typedef struct _dwg_object_DATALINK
53385338
typedef struct _dwg_DIMASSOC_Ref
53395339
{
53405340
struct _dwg_object_DIMASSOC *parent;
5341-
BITCODE_T classname; /*!< DXF 1 constant */
5342-
BITCODE_RC osnap_type; /*!< DXF 72 */
5343-
BITCODE_BD osnap_dist; /*!< DXF 40 */
5344-
BITCODE_3BD osnap_pt; /*!< DXF 10-30 */
5341+
BITCODE_T classname; /*!< DXF 1 constant */
5342+
BITCODE_RC osnap_type; /*!< DXF 72 */
5343+
BITCODE_BD osnap_dist; /*!< DXF 40 */
5344+
BITCODE_3BD osnap_pt; /*!< DXF 10-30 */
53455345
BITCODE_BS num_xrefs;
5346-
BITCODE_H *xrefs; /*!< DXF 331 the geometry objects, 1 or 2 */
5347-
BITCODE_BS main_subent_type; /*!< DXF 73 */
5348-
BITCODE_BL main_gsmarker; /*!< DXF 91 */
5346+
BITCODE_H *xrefs; /*!< DXF 331 the geometry objects, 1 or 2 */
5347+
BITCODE_BS main_subent_type; /*!< DXF 73 */
5348+
BITCODE_BL main_gsmarker; /*!< DXF 91 */
53495349
BITCODE_BS num_xrefpaths;
5350-
BITCODE_T *xrefpaths; /*!< DXF 301 */
5351-
BITCODE_B has_lastpt_ref; /*!< DXF 75 */
5352-
BITCODE_3BD lastpt_ref; /*!< DXF ?? */
5353-
BITCODE_BL num_intsectobj; /*!< DXF 74 */
5354-
BITCODE_H* intsectobj; /*!< DXF 332 the intersection objects, 1 or 2 */
5350+
BITCODE_T *xrefpaths; /*!< DXF 301 */
5351+
BITCODE_BS num_intersec_xrefpaths;
5352+
BITCODE_T *intersec_xrefpaths; /*!< DXF 302 */
5353+
BITCODE_B has_lastpt_ref; /*!< DXF 75 */
5354+
BITCODE_BS intersec_subent_type; /*!< DXF 74 */
5355+
BITCODE_BL intersec_gsmarker; /*!< DXF 92 */
5356+
BITCODE_BL num_intsectobj;
5357+
BITCODE_H* intsectobj; /*!< DXF 332 the intersection objects, 1 or 2 */
53555358
} Dwg_DIMASSOC_Ref;
53565359

53575360
typedef struct _dwg_object_DIMASSOC

src/dwg.spec

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9934,6 +9934,33 @@ DWG_ENTITY_END
99349934
FIELD_B (dimension.flip_arrow2, 296); \
99359935
FIELD_B (dimension.flip_arrow1, 297)
99369936

9937+
#define AcDbOsnapPointRef_fields(index) \
9938+
LOG_HANDLE ("DIMASSOC_Ref.rcount1: %d\n", index); \
9939+
SUB_FIELD_T (ref[index], classname, 1); /* "AcDbOsnapPointRef" */ \
9940+
SUB_FIELD_RC (ref[index], osnap_type, 72); /* 0-13 */ \
9941+
SUB_FIELD_BL (ref[index], num_xrefs, 0); \
9942+
SUB_HANDLE_VECTOR (ref[index], xrefs, num_xrefs, 4, 331); \
9943+
if (FIELD_VALUE (ref[index].osnap_type) != 0) \
9944+
{ \
9945+
SUB_FIELD_BL (ref[index], main_subent_type, 73); \
9946+
SUB_FIELD_BL (ref[index], main_gsmarker, 91); \
9947+
SUB_FIELD_BL (ref[index], num_xrefpaths, 0); \
9948+
FIELD_VECTOR_T (ref[index].xrefpaths, T, ref[4].num_xrefpaths, 301) \
9949+
} \
9950+
SUB_FIELD_BD (ref[index], osnap_dist, 40); \
9951+
SUB_FIELD_3BD (ref[index], osnap_pt, 10); \
9952+
if (FIELD_VALUE (ref[index].osnap_type) == 6 \
9953+
|| FIELD_VALUE (ref[index].osnap_type) == 11) \
9954+
{ \
9955+
SUB_FIELD_BL (ref[index], num_intsectobj, 0); \
9956+
SUB_HANDLE_VECTOR (ref[index], intsectobj, num_intsectobj, 5, 332); \
9957+
SUB_FIELD_BL (ref[index], intersec_subent_type, 74); \
9958+
SUB_FIELD_BL (ref[index], intersec_gsmarker, 92); \
9959+
SUB_FIELD_BL (ref[index], num_intersec_xrefpaths, 0); \
9960+
FIELD_VECTOR_T (ref[index].intersec_xrefpaths, T, ref[index].num_intersec_xrefpaths, 302) \
9961+
} \
9962+
SUB_FIELD_B (ref[index], has_lastpt_ref, 75);
9963+
99379964
// (varies) UNSTABLE
99389965
// 1-4 references, see associativity bits 1-8.
99399966
DWG_OBJECT (DIMASSOC)
@@ -9944,48 +9971,30 @@ DWG_OBJECT (DIMASSOC)
99449971
FIELD_B (trans_space_flag, 70);
99459972
FIELD_RC (rotated_type, 71);
99469973
FIELD_HANDLE (dimensionobj, 4, 330);
9947-
REPEAT_CN (4, ref, Dwg_DIMASSOC_Ref) // i.e. AcDbOsnapPointRef
9974+
REPEAT_CN (6, ref, Dwg_DIMASSOC_Ref) // i.e. AcDbOsnapPointRef
99489975
REPEAT_BLOCK
9949-
// TODO: there could be much more blocks, up to 5.
9950-
// 0 1 2 3 => 1 2 4 8. skip unset bits
9951-
if (!(FIELD_VALUE (associativity) & (1<<rcount1)))
9976+
// index 0 1 2 3 => bits 1 2 4 8. skip unset bits
9977+
if (!(FIELD_VALUE (associativity) & (1 << rcount1)))
99529978
{
99539979
#ifdef IS_JSON
99549980
ENDHASH;
99559981
#endif
99569982
continue;
99579983
}
9958-
LOG_HANDLE ("DIMASSOC_Ref.rcount1: %d\n", rcount1);
9959-
// DXF: 1, 72, 10, ??, 75
9960-
SUB_FIELD_T (ref[rcount1], classname, 1); // "AcDbOsnapPointRef"
9961-
SUB_FIELD_RC (ref[rcount1], osnap_type, 72); // 0-13
9962-
// idpaths:
9963-
SUB_FIELD_BL0 (ref[rcount1], num_intsectobj, 74);
9964-
SUB_HANDLE_VECTOR (ref[rcount1], intsectobj, num_intsectobj, 5, 332);
9965-
9966-
SUB_FIELD_BD (ref[rcount1], osnap_dist, 40);
9967-
SUB_FIELD_3BD (ref[rcount1], osnap_pt, 10);
9968-
9969-
// XrefFullSubentPath
9970-
SUB_FIELD_BL (ref[rcount1], num_xrefs, 0); // 1 or 2
9971-
SUB_VALUEOUTOFBOUNDS (ref[rcount1], num_xrefs, 100)
9972-
SUB_HANDLE_VECTOR (ref[rcount1], xrefs, num_xrefs, 4, 331);
9973-
9974-
// restrict only when writing, not when reading?
9975-
//if (FIELD_VALUE (ref[rcount1].osnap_type) == 6 || FIELD_VALUE (ref[rcount1].osnap_type) == 11)
9976-
// {
9977-
SUB_FIELD_BL0 (ref[rcount1], main_subent_type, 73);
9978-
SUB_FIELD_BL (ref[rcount1], main_gsmarker, 91);
9979-
SUB_FIELD_BL (ref[rcount1], num_xrefpaths, 0);
9980-
FIELD_VECTOR_T (ref[rcount1].xrefpaths, T, ref[rcount1].num_xrefpaths, 301)
9981-
// }
9982-
SUB_FIELD_B (ref[rcount1], has_lastpt_ref, 75);
9983-
if (FIELD_VALUE (ref[rcount1].has_lastpt_ref))
9984-
{
9985-
SUB_FIELD_3BD (ref[rcount1], lastpt_ref, 0);
9986-
}
9984+
AcDbOsnapPointRef_fields(rcount1)
99879985
SET_PARENT_OBJ (ref[rcount1]);
99889986
END_REPEAT_BLOCK
9987+
if (FIELD_VALUE (ref[0].has_lastpt_ref)
9988+
|| FIELD_VALUE (ref[1].has_lastpt_ref)
9989+
|| FIELD_VALUE (ref[2].has_lastpt_ref)
9990+
|| FIELD_VALUE (ref[3].has_lastpt_ref))
9991+
{
9992+
AcDbOsnapPointRef_fields(4)
9993+
}
9994+
if (FIELD_VALUE (ref[4].has_lastpt_ref))
9995+
{
9996+
AcDbOsnapPointRef_fields(5)
9997+
}
99899998
END_REPEAT (ref)
99909999

999110000
START_OBJECT_HANDLE_STREAM;

src/dynapi.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11478,12 +11478,18 @@ static const Dwg_DYNAPI_field _dwg_DIMASSOC_Ref_fields[] = {
1147811478
0,0,0, 0 },
1147911479
{ "xrefpaths", "TV*", sizeof (BITCODE_TV*), OFF (struct _dwg_DIMASSOC_Ref, xrefpaths),
1148011480
1,1,0, 301 },
11481+
{ "num_intersec_xrefpaths", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_DIMASSOC_Ref, num_intersec_xrefpaths),
11482+
0,0,0, 0 },
11483+
{ "intersec_xrefpaths", "TV*", sizeof (BITCODE_TV*), OFF (struct _dwg_DIMASSOC_Ref, intersec_xrefpaths),
11484+
1,1,0, 0 },
1148111485
{ "has_lastpt_ref", "B", sizeof (BITCODE_B), OFF (struct _dwg_DIMASSOC_Ref, has_lastpt_ref),
1148211486
0,0,0, 75 },
11483-
{ "lastpt_ref", "3BD", sizeof (BITCODE_3BD), OFF (struct _dwg_DIMASSOC_Ref, lastpt_ref),
11484-
1,0,0, 0 },
11485-
{ "num_intsectobj", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, num_intsectobj),
11487+
{ "intersec_subent_type", "BS", sizeof (BITCODE_BS), OFF (struct _dwg_DIMASSOC_Ref, intersec_subent_type),
1148611488
0,0,0, 74 },
11489+
{ "intersec_gsmarker", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, intersec_gsmarker),
11490+
0,0,0, 92 },
11491+
{ "num_intsectobj", "BL", sizeof (BITCODE_BL), OFF (struct _dwg_DIMASSOC_Ref, num_intsectobj),
11492+
0,0,0, 0 },
1148711493
{ "intsectobj", "H*", sizeof (BITCODE_H*), OFF (struct _dwg_DIMASSOC_Ref, intsectobj),
1148811494
1,1,0, 332 },
1148911495
{NULL, NULL, 0, 0, 0,0,0, 0},

0 commit comments

Comments
 (0)