add ExtensionDict.link_dxf_object()
@@ -9,7 +9,7 @@ from ezdxf.lldxf.const import (
if TYPE_CHECKING:
from ezdxf.lldxf.tagwriter import TagWriter
- from ezdxf.eztypes import Dictionary, Drawing, DXFEntity
+ from ezdxf.eztypes import Dictionary, Drawing, DXFEntity, DXFObject
__all__ = ['ExtensionDict']
@@ -39,6 +39,10 @@ class ExtensionDict:
assert self._xdict is not None
return self._xdict
+ @property
+ def handle(self) -> str:
+ return self._xdict.dxf.handle
+
def __getitem__(self, key: str):
return self.dictionary[key]
@@ -109,3 +113,7 @@ class ExtensionDict:
placeholder = doc.objects.add_placeholder(dictionary.dxf.handle)
dictionary[name] = placeholder
return placeholder
+
+ def link_dxf_object(self, name: str, obj: 'DXFObject') -> None:
+ self.dictionary[name] = obj.dxf.handle
+ obj.dxf.owner = self.handle
