예제 #1
0
    def add(self, appid: str, tags: Iterable[Union[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 :ref:`xdata_internals`.

        """
        data = Tags(dxftag(code, value) for code, value in tags)
        if len(data) == 0 or data[0] != (XDATA_MARKER, appid):
            data.insert(0, dxftag(XDATA_MARKER, appid))
        self._add(data)
예제 #2
0
파일: xdata.py 프로젝트: yening2020/ezdxf
 def add(self, appid: str, tags: Iterable) -> None:
     data = Tags(dxftag(code, value) for code, value in tags)
     if len(data) == 0 or data[0] != (XDATA_MARKER, appid):
         data.insert(0, dxftag(XDATA_MARKER, appid))
     self._add(data)