How to use ezdxf - 10 common examples

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
30
0.0
 11
1.0
 21
1.0
 31
1.0
"""


class AttributeChecker(DXFEntity):
    TEMPLATE = XTEMPLATE
    DXFATTRIBS = DXFAttributes(
        DefSubclass(None, {
            'handle': DXFAttr(5),
            'block_record': DXFAttr(330),
        }),
        DefSubclass('AcDbEntity', {
            'paperspace': DXFAttr(67, default=0),
            'layer': DXFAttr(8, default='0'),
            'linetype': DXFAttr(6, default='BYLAYER'),
            'ltscale': DXFAttr(48, default=1.0),
            'invisible': DXFAttr(60, default=0),
            'color': DXFAttr(62, default=256),
        }),
        DefSubclass('AcDbLine', {
            'start': DXFAttr(10, XType.any_point),
            'end': DXFAttr(11, XType.any_point),
            'thickness': DXFAttr(39),
            'extrusion': DXFAttr(210, XType.point3d),
        }))
github mozman / ezdxf / tests / test_07_render / test_702_render_forms.py View on Github external
def test_box():
    b = box(3, 2)
    assert len(b) == 4
    assert b == (Vector(0, 0), Vector(3, 0), Vector(3, 2), Vector(0, 2))
github mozman / ezdxf / tests / test_07_render / test_702_render_forms.py View on Github external
def test_closed_arrow():
    a = arrow2(3, 60, 45)
    assert len(a) == 4
    assert a == (Vector(-3, 1.5), Vector(0, 0), Vector(-3, -1.5), Vector(-1.5, 0))
github mozman / ezdxf / tests / test_02_dxf_graphics / test_210_polyline_vertex_attributes.py View on Github external
def test_vertext_attribs_xy():
    result = vertex_attribs((1, 2), format='xy')
    assert result == {'location': Vector(1, 2)}
github mozman / ezdxf / tests / test_02_dxf_graphics / test_242_transform.py View on Github external
def test_spline_transform_interface():
    spline = Spline()
    spline.set_uniform([(1, 0, 0), (3, 3, 0), (6, 0, 1)])
    spline.dxf.start_tangent = Vector(1, 0, 0)
    spline.dxf.end_tangent = Vector(2, 0, 0)
    spline.dxf.extrusion = Vector(3, 0, 0)
    spline.transform(Matrix44.translate(1, 2, 3))
    assert spline.control_points[0] == (2, 2, 3)
    # direction vectors are not transformed by translation
    assert spline.dxf.start_tangent == (1, 0, 0)
    assert spline.dxf.end_tangent == (2, 0, 0)
    assert spline.dxf.extrusion == (3, 0, 0)
github mozman / ezdxf / tests / test_04_dxf_high_level_structs / test_newdrawings.py View on Github external
def test_new_AC1021():
    dwg = ezdxf.new('AC1021')
    assert 'AC1021' == dwg.dxfversion
github mozman / ezdxf / tests / test_dxf_structures / test_sections.py View on Github external
def sections():
    dwg = ezdxf.new('R12')
    return Sections(load_dxf_structure(internal_tag_compiler(TEST_HEADER)), dwg)
github mozman / ezdxf / tests / test_tools.py View on Github external
def test_drawing():
    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)