How to use the ezdxf.lldxf.extendedtags.ExtendedTags.from_text function in ezdxf

To help you get started, we’ve selected a few ezdxf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozman / ezdxf / tests / test_low_level_dxf / test_060_dxf_attributes.py View on Github external
def entity(self):
        return AttributeChecker(ExtendedTags.from_text(XTEMPLATE))
github mozman / ezdxf / tests / test_01_dxf_entities / test_101_dxfnamespace.py View on Github external
def processor():
    return SubclassProcessor(ExtendedTags.from_text(TEST_1))
github mozman / ezdxf / tests / test_01_dxf_entities / test_dxfentity.py View on Github external
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
github mozman / ezdxf / tests / test_01_dxf_entities / test_dxfentity.py View on Github external
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
github mozman / ezdxf / tests / test_modern_structures / test_spline.py View on Github external
def spline():
    return Spline(tag_processor(ExtendedTags.from_text(_SPLINE_TPL)))
github mozman / ezdxf / tests / test_01_dxf_entities / test_dxfentity.py View on Github external
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
github mozman / ezdxf / tests / test_legacy_structures / test_viewport_entity_R12.py View on Github external
def viewport():
    return Viewport(ExtendedTags.from_text(_VPORT_TPL))
github mozman / ezdxf / src / ezdxf / entities / dxfentity.py View on Github external
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)
github mozman / ezdxf / ezdxf / modern / underlay.py View on Github external
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