示例#1
0
 def find_attdef(self, tag):
     for entity in iterflatlist(self.data): # flatten nested list
         if isinstance(entity, _Entity) and \
             (entity.name == 'ATTDEF') and \
             (entity['tag'] == tag):
             return entity
     raise KeyError("no attdef with tag '%s' found!" % str(tag))
示例#2
0
 def find_attdef(self, tag):
     """ Find ATTDEF entities in the block definition, which can occur on
     arbitrary places.
     """
     for entity in iterflatlist(self.data): # flat data list
         if isinstance(entity, _Entity) and \
             (entity.DXF_ENTITY_NAME == 'ATTDEF') and \
             (entity['tag'] == tag):
             return entity
     raise KeyError("no attdef with tag '%s' found!" % str(tag))
示例#3
0
文件: entities.py 项目: msarch/py
 def find_attdef(self, tag):
     """ Find ATTDEF entities in the block definition, which can occur on
     arbitrary places.
     """
     for entity in iterflatlist(self.data): # flat data list
         if isinstance(entity, _Entity) and \
             (entity.DXF_ENTITY_NAME == 'ATTDEF') and \
             (entity['tag'] == tag):
             return entity
     raise KeyError("no attdef with tag '%s' found!" % str(tag))
 def test_iterflatten(self):
     l1 = [1, 2, 3]
     l2 = [3, 4, l1]
     l3 = [l2, 7]
     self.assertEqual(list(iterflatlist(l3)), [3, 4, 1, 2, 3, 7])
示例#5
0
文件: test_util.py 项目: msarch/py
 def test_iterflatten(self):
     l1 = [1, 2, 3]
     l2 = [3, 4, l1]
     l3 = [l2, 7]
     self.assertEqual(list(iterflatlist(l3)), [3, 4, 1, 2, 3, 7])