Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def entity(self):
return AttributeChecker(ExtendedTags.from_text(XTEMPLATE))
def xtags2():
return ExtendedTags.from_text(XTAGS2)
def processor():
return SubclassProcessor(ExtendedTags.from_text(TEST_1))
def test_supports_dxfattrib(self):
tags = ExtendedTags.from_text("10\n1.0\n20\n2.0\n30\n3.0\n")
point = PointAccessor(tags)
assert point.supports_dxf_attrib('xp') is True
def test_getdxfattr_no_DXF_default_value_at_wrong_dxf_version(self):
tags = ExtendedTags.from_text("10\n1.0\n20\n2.0\n30\n3.0\n")
point = PointAccessor(tags)
# just_AC1015 has a DXF default value, but the drawing has an insufficient DXF version
with pytest.raises(DXFValueError):
point.get_dxf_attrib('just_AC1015')
# except the USER defined default value
assert point.get_dxf_attrib('just_AC1015', 17) == 17
def spline():
return Spline(tag_processor(ExtendedTags.from_text(_SPLINE_TPL)))
def test_get_2d_point(self):
tags = ExtendedTags.from_text("13\n1.0\n23\n2.0\n")
point = PointAccessor(tags)
assert (1., 2.) == point.dxf.flex
def viewport():
return Viewport(ExtendedTags.from_text(_VPORT_TPL))
def from_text(cls: Type[T], text: str, doc: 'Drawing' = None) -> T:
""" Load constructor from text for testing. (internal API)"""
return cls.load(ExtendedTags.from_text(text), doc)
2
1
"""
underlay_def_subclass = DefSubclass('AcDbUnderlayDefinition', {
'filename': DXFAttr(1), # File name of underlay
'name': DXFAttr(2), # underlay name - pdf=page number to display; dgn=default; dwf=????
})
# (PDF|DWF|DGN)DEFINITION - requires entry in objects table ACAD_(PDF|DWF|DGN)DEFINITIONS,
# ACAD_(PDF|DWF|DGN)DEFINITIONS do not exist by default
class PdfDefinition(DXFEntity):
__slots__ = ()
TEMPLATE = ExtendedTags.from_text(_PDF_DEF_TPL)
CLASS = ExtendedTags.from_text(_PDF_DEF_CLS)
DXFATTRIBS = DXFAttributes(none_subclass, underlay_def_subclass)
@property
def entity_name(self):
return self.dxftype()[:3] + "UNDERLAY"
def post_new_hook(self):
self.set_reactors([self.dxf.owner])
_DWF_DEF_CLS = """0
CLASS
1
DWFDEFINITION
2
AcDbDwfDefinition