XData

class ezdxf.entities.xdata.XData

Internal management class for XDATA.

See also

__contains__(appid: str) bool

Returns True if DXF tags for appid exist.

add(appid: str, tags: Iterable[tuple[int, Any] | DXFTag]) None

Add a list of DXF tags for appid. The tags argument is an iterable of (group code, value) tuples, where the group code has to be an integer value. The mandatory XDATA marker (1001, appid) is added automatically if front of the tags if missing.

Each entity can contain only one list of tags for each appid. Adding a second list of tags for the same appid replaces the existing list of tags.

The valid XDATA group codes are restricted to some specific values in the range from 1000 to 1071, for more information see also the internals about Extended Data.

get(appid: str) Tags

Returns the DXF tags as Tags list stored by appid.

Raises:

DXFValueError – no data for appid exist

discard(appid)

Delete DXF tags for appid. None existing appids are silently ignored.

has_xlist(appid: str, name: str) bool

Returns True if list name from XDATA appid exists.

Parameters:
  • appid – APPID

  • name – list name

get_xlist(appid: str, name: str) list[tuple]

Get list name from XDATA appid.

Parameters:
  • appid – APPID

  • name – list name

Returns: list of DXFTags including list name and curly braces ‘{’ ‘}’ tags

Raises:
set_xlist(appid: str, name: str, tags: Iterable) None

Create new list name of XDATA appid with xdata_tags and replaces list name if already exists.

Parameters:
  • appid – APPID

  • name – list name

  • tags – list content as DXFTags or (code, value) tuples, list name and curly braces ‘{’ ‘}’ tags will be added

discard_xlist(appid: str, name: str) None

Deletes list name from XDATA appid. Ignores silently if XDATA appid or list name not exist.

Parameters:
  • appid – APPID

  • name – list name

replace_xlist(appid: str, name: str, tags: Iterable) None

Replaces list name of existing XDATA appid by tags. Appends new list if list name do not exist, but raises DXFValueError if XDATA appid do not exist.

Low level interface, if not sure use set_xdata_list() instead.

Parameters:
  • appid – APPID

  • name – list name

  • tags – list content as DXFTags or (code, value) tuples, list name and curly braces ‘{’ ‘}’ tags will be added

Raises:

DXFValueError – XDATA appid do not exist

transform(m: Matrix44) None

Transform XDATA tags with group codes 1011, 1012, 1013, 1041 and 1042 inplace. For more information see Extended Data Internals.