예제 #1
0
    def __iter__(self) -> Iterable[Tuple[str, str]]:
        """
        Yields all redraw associations as (object_handle, sort_handle) tuples.

        """
        for handle, sort_handle in take2(self.sortentstable_subclass[self.TABLE_START_INDEX:]):
            yield handle.value, sort_handle.value
예제 #2
0
 def load_table(self, tags: 'Tags') -> None:
     for handle, sort_handle in take2(tags):
         if handle.code != 331:
             raise DXFStructureError('Invalid handle code {}, expected 331'.format(handle.code))
         if sort_handle.code != 5:
             raise DXFStructureError('Invalid sort handle code {}, expected 5'.format(handle.code))
         self.table[handle.value] = sort_handle.value
예제 #3
0
 def load_table(self, tags: "Tags") -> None:
     for handle, sort_handle in take2(tags):
         if handle.code != 331:
             raise DXFStructureError(
                 f"Invalid handle code {handle.code}, expected 331"
             )
         if sort_handle.code != 5:
             raise DXFStructureError(
                 f"Invalid sort handle code {handle.code}, expected 5"
             )
         self.table[handle.value] = sort_handle.value
예제 #4
0
 def get_acad_dstyle(self, dim_style: 'DimStyle') -> dict:
     try:
         data = self.get_xdata_list('ACAD', 'DSTYLE')
     except DXFValueError:
         return {}
     attribs = {}
     codes = dim_style.CODE_TO_DXF_ATTRIB
     for code_tag, value_tag in take2(data):
         group_code = code_tag.value
         value = value_tag.value
         if group_code in codes:
             attribs[codes[group_code]] = value
     return attribs
예제 #5
0
    def get_acad_dstyle(self, dim_style: 'DimStyle') -> dict:
        """ Get XDATA section ACAD:DSTYLE, to override DIMSTYLE attributes for this DIMENSION entity.
        Returns a ``dict`` with DIMSTYLE attribute names as keys.

        (internal API)
        """
        try:
            data = self.get_xdata_list('ACAD', 'DSTYLE')
        except DXFValueError:
            return {}
        attribs = {}
        codes = dim_style.CODE_TO_DXF_ATTRIB
        for code_tag, value_tag in take2(data):
            group_code = code_tag.value
            value = value_tag.value
            if group_code in codes:
                attribs[codes[group_code]] = value
        return self.dim_style_attr_handles_to_names(attribs)
예제 #6
0
 def write_str(self, s: str) -> None:
     data = s.split('\n')
     for code, value in take2(data):
         self.write_tag2(int(code), value)
예제 #7
0
 def __iter__(self) -> Iterable[Tuple[int, int]]:
     for edge in take2(self.values):
         yield edge
예제 #8
0
 def _parse_xlist(self) -> Dict:
     if self._xlist:
         return dict(take2(self._xlist))
     else:
         return dict()
예제 #9
0
 def from_tags(cls, tags):
     return cls(data=((k, v) for k, v in take2(
         tag.value for tag in tags if tag.code in set(cls.SEARCH_CODES))))
예제 #10
0
 def __iter__(self):
     for edge in take2(self.value):
         yield edge
예제 #11
0
 def from_tags(cls, tags: Tags) -> 'TagDict':
     return cls(data=(t for t in take2(tag.value for tag in tags if tag.code in set(cls.SEARCH_CODES))))