export pattern if no solid fill for MPOLYGON
The "unknown1" tag 78 is the count of pattern
definition lines.
@@ -810,7 +810,6 @@ acdb_mpolygon = DefSubclass(
validator=validator.is_greater_or_equal_zero,
fixer=RETURN_DEFAULT,
),
- "unknown1": DXFAttr(78, default=0),
# MPolygon: offset vector in OCS ???
"offset_vector": DXFAttr(11, xtype=XType.point2d, default=(0, 0)),
# MPolygon: number of degenerate boundary paths (loops), where a
@@ -872,11 +871,12 @@ class MPolygon(BasePolygon):
"pixel_size",
],
)
- if dxf.solid_fill == 0:
- dxf.export_dxf_attribs(tagwriter, "unknown1")
+ if dxf.solid_fill == 0: # export pattern
+ # always write at least tag (78, 0)
+ self.pattern.export_dxf(tagwriter, force=True)
dxf.export_dxf_attribs(tagwriter, "offset_vector")
self.export_degenerated_loops(tagwriter)
- if self.gradient:
+ if self.gradient: # todo: is gradient supported by MPOLYGON?
self.gradient.export_dxf(tagwriter)
def export_degenerated_loops(self, tagwriter: "TagWriter"):
@@ -2018,8 +2018,8 @@ class Pattern:
PatternLine(angle, base_point, offset, dash_length_items)
)
- def export_dxf(self, tagwriter: "TagWriter") -> None:
- if len(self.lines):
+ def export_dxf(self, tagwriter: "TagWriter", force=False) -> None:
+ if len(self.lines) or force:
tagwriter.write_tag2(78, len(self.lines))
for line in self.lines:
line.export_dxf(tagwriter)
