From 289d93282c27f5bab0889b842fe5803410210494 Mon Sep 17 00:00:00 2001 From: mozman Date: Mon, 10 Oct 2022 15:55:50 +0200 Subject: [PATCH] fix #751 invalid DXF attribute name --- NEWS.md | 2 ++ src/ezdxf/entities/xdict.py | 2 +- tests/test_01_dxf_entities/test_104_extension_dict.py | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 632f59db4..521b5de24 100644 --- a/NEWS.md +++ b/NEWS.md @@ -14,6 +14,8 @@ Version 1.0.0b0 - dev fix keyword only argument in virtual_block_reference_entities() call - BUGFIX: [#749](https://github.com/mozman/ezdxf/issues/749) fix infinite loop in MTEXT rendering with tabulators +- BUGFIX: [#751](https://github.com/mozman/ezdxf/issues/751) + fix invalid DXF attribute name Version 0.18.1 - 2022-09-03 --------------------------- diff --git a/src/ezdxf/entities/xdict.py b/src/ezdxf/entities/xdict.py index 8fff50d73..83a7079b1 100644 --- a/src/ezdxf/entities/xdict.py +++ b/src/ezdxf/entities/xdict.py @@ -188,7 +188,7 @@ def add_dictionary( doc = dictionary.doc assert doc is not None, "valid DXF document required" new_dict = doc.objects.add_dictionary( - owner=dictionary.dxf.hande, + owner=dictionary.dxf.handle, hard_owned=hard_owned, ) dictionary[name] = new_dict diff --git a/tests/test_01_dxf_entities/test_104_extension_dict.py b/tests/test_01_dxf_entities/test_104_extension_dict.py index bc61f3fab..ce9674b92 100644 --- a/tests/test_01_dxf_entities/test_104_extension_dict.py +++ b/tests/test_01_dxf_entities/test_104_extension_dict.py @@ -120,3 +120,13 @@ def test_link_dxf_object_to_extension_dict(doc): xdict.link_dxf_object("MyEntry", obj) assert "MyEntry" in xdict assert obj.dxf.owner == owner + + +def test_add_new_dictionary_to_xdict(doc): + # issue #751 + msp = doc.modelspace() + line = msp.add_line((0, 0), (1, 0)) + xdict = line.new_extension_dict() + new_dict = xdict.add_dictionary("TEST") + assert new_dict.dxf.owner == xdict.handle +