def test_drawing(self): dwg = ezdxf.new('AC1024') for attr in getattributes(DrawingProxy('AC1024')): if not hasattr(dwg, attr): raise Exception( "attribute '%s' of DrawingProxy() does not exist in Drawing() class" % attr)
def test_acdsrecord(self): section = AcDsDataSection(ACDSSECTION, DrawingProxy('AC1027')) records = [entity for entity in section.entities if entity.dxftype() == 'ACDSRECORD'] self.assertTrue(len(records) > 0) record = records[0] self.assertTrue(record.has_section('ASM_Data')) self.assertTrue(record.has_section('AcDbDs::ID')) self.assertFalse(record.has_section('mozman')) with self.assertRaises(KeyError): asm_data = record['mozman'] asm_data = record['ASM_Data'] binary_data = (tag for tag in asm_data if tag.code == 310) length = sum(len(tag.value) for tag in binary_data) / 2 self.assertEqual(asm_data[2].value, length)
def setUp(self): self.dwg = DrawingProxy('AC1024') self.table = Table(Tags.from_text(AC1024TABLE), self.dwg)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.tables = TablesSection(Tags.from_text(TEST_TABLES), self.dwg)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.sections = Sections(StringIterator(TEST_HEADER), self.dwg)
#!/usr/bin/env python #coding:utf-8 # Author: mozman -- <*****@*****.**> # Purpose: test generic wrapper # Created: 22.03.2011 # Copyright (C) 2011, Manfred Moitzi # License: MIT License from __future__ import unicode_literals import unittest from ezdxf.testtools import ClassifiedTags, DXFStructureError, DXFAttr, DXFAttributes, DefSubclass, DrawingProxy from ezdxf.dxfentity import DXFEntity DWG = DrawingProxy('AC1009') class PointAccessor(DXFEntity): DXFATTRIBS = DXFAttributes( DefSubclass( None, { 'point': DXFAttr(10, 'Point3D'), 'flat': DXFAttr(11, 'Point2D'), 'xp': DXFAttr(12, 'Point3D'), 'flex': DXFAttr(13, 'Point2D/3D'), 'flags': DXFAttr(70), 'just_AC1015': DXFAttr(71, default=777, dxfversion='AC1015'), })) def __init__(self, tags): super(PointAccessor, self).__init__(tags, drawing=DWG)
def test_build(self): section = AcDsDataSection(ACDSSECTION, DrawingProxy('AC1027')) self.assertEqual('ACDSDATA', section.name.upper()) self.assertTrue(len(section.entities) > 0)
# Author: mozman -- <*****@*****.**> # Purpose: test SECTION ACDSDATA # Created: 04.05.2014 # Copyright (C) 2014, Manfred Moitzi # License: MIT License from __future__ import unicode_literals import unittest from ezdxf.testtools import DrawingProxy from ezdxf.tags import Tags from ezdxf.acdsdata import AcDsDataSection DWG = DrawingProxy('AC1027') class TestAcDsDataSection(unittest.TestCase): def test_build(self): section = AcDsDataSection(ACDSSECTION, DrawingProxy('AC1027')) self.assertEqual('ACDSDATA', section.name.upper()) self.assertTrue(len(section.entities) > 0) def test_acdsrecord(self): section = AcDsDataSection(ACDSSECTION, DrawingProxy('AC1027')) records = [entity for entity in section.entities if entity.dxftype() == 'ACDSRECORD'] self.assertTrue(len(records) > 0) record = records[0] self.assertTrue(record.has_section('ASM_Data')) self.assertTrue(record.has_section('AcDbDs::ID'))
def setUp(self): self.dwg = DrawingProxy('AC1009') self.section = ClassesSection(Tags.from_text(TESTCLASSES), self.dwg)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.section = BlocksSection(Tags.from_text(TESTBLOCKS), self.dwg)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.section = ObjectsSection(Tags.from_text(TESTOBJECTS), self.dwg)
def setUp(self): tags = Tags.from_text(TESTCUSTOMPROPERTIES) dwg = DrawingProxy('AC1009') self.header = HeaderSection(tags) self.header.set_headervar_factory(dwg.dxffactory.headervar_factory)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.section = EntitySection(Tags.from_text(TESTENTITIES), self.dwg)
def setUp(self): self.dwg = DrawingProxy('AC1009') self.space = EntitySpace(self.dwg.entitydb)