Skip to content

in_dxf: MINSERT column/row count default to 1 when the group is omitted - #1385

Open
tuxiasumari wants to merge 1 commit into
LibreDWG:masterfrom
tuxiasumari:fix-minsert-grid-defaults
Open

in_dxf: MINSERT column/row count default to 1 when the group is omitted#1385
tuxiasumari wants to merge 1 commit into
LibreDWG:masterfrom
tuxiasumari:fix-minsert-grid-defaults

Conversation

@tuxiasumari

Copy link
Copy Markdown
Contributor

Symptom

A single-column MINSERT (71=2, no 70 group) round-trips as 70=0: DXF omits INSERT groups 70/71 when the count is 1 — ezdxf and AutoCAD both do — but the importer materialized the missing group as 0, and dwg2dxf then writes the explicit 0 back out.

Fix

Apply the documented defaults when the MINSERT completes, next to the existing 3DFACE default in the same chain. (Setting them earlier, at the AcDbMInsertBlock upgrade, does not work: the generic field matcher refuses to overwrite an already-set field when the real 70/71 group arrives.)

import ezdxf
d = ezdxf.new("R2000")
blk = d.blocks.new("B1"); blk.add_circle((0, 0), 1)
ref = d.modelspace().add_blockref("B1", (0, 0))
ref.grid(size=(2, 1), spacing=(10, 10))   # 2 rows, 1 column
d.saveas("minsert.dxf")

make check green; 1657-file real-DWG corpus unchanged.

@rurban rurban added the cla_needed Waiting for the Copyright assignment label Aug 10, 2026
DXF omits INSERT groups 70/71 when the count is 1 (ezdxf and AutoCAD
both do), so a single-column MINSERT imported with num_cols 0 and
dwg2dxf wrote the 0 back out explicitly. Set the documented defaults
when the object completes, next to the existing 3DFACE default.
@tuxiasumari
tuxiasumari force-pushed the fix-minsert-grid-defaults branch from 1f9b9b1 to 36b1399 Compare August 11, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla_needed Waiting for the Copyright assignment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants