예제 #1
0
def closed_edge_hatch(request):
    _hatch = Hatch.new()
    _path = _hatch.paths.add_edge_path()
    if request.param == 'arc':
        _path.add_arc((0, 0), radius=1, start_angle=0, end_angle=360, ccw=1)
    elif request.param == 'ellipse':
        _path.add_ellipse((0, 0), major_axis=(5, 0), ratio=0.2, start_angle=0,
                          end_angle=360)
    return _hatch
예제 #2
0
def test_default_new():
    entity = Hatch.new(
        handle="ABBA",
        owner="0",
        dxfattribs={
            "color": 7,
        },
    )
    assert entity.dxf.layer == "0"
    assert entity.dxf.color == 7
예제 #3
0
def test_write_correct_polyline_path_tag_order(entity):
    entity = Hatch.from_text(HATCH)
    entity.paths.add_polyline_path(
        [(0, 0), (1, 0), (1, 1)],
        is_closed=True,
    )
    result = TagCollector.dxftags(entity)
    tags = list(result.pop_tags([92, 72, 73]))
    # 92 = path type 3: external polyline path
    # 72 = has_bulge
    # 73 = is_closed
    # The group codes 72 and 73 are swapped in comparison to MPOLYGON
    assert tags == [(92, 3), (72, 0), (73, 1)]
예제 #4
0
def hatch_pattern():
    return Hatch.from_text(HATCH_PATTERN)
예제 #5
0
def spline_edge_hatch():
    return Hatch.from_text(EDGE_HATCH_WITH_SPLINE)
예제 #6
0
def edge_hatch():
    return Hatch.from_text(EDGE_HATCH)
예제 #7
0
def path_hatch():
    return Hatch.from_text(PATH_HATCH)
예제 #8
0
def hatch():
    return Hatch.new()
예제 #9
0
def test_write_dxf():
    entity = Hatch.from_text(HATCH)
    result = TagCollector.dxftags(entity)
    expected = basic_tags_from_text(HATCH)
    assert result == expected
예제 #10
0
def test_default_init():
    entity = Hatch()
    assert entity.dxftype() == "HATCH"
    assert entity.dxf.handle is None
    assert entity.dxf.owner is None
예제 #11
0
def entity():
    return Hatch.from_text(HATCH)
예제 #12
0
def test_default_new():
    entity = Hatch.new(handle='ABBA', owner='0', dxfattribs={
        'color': 7,
    })
    assert entity.dxf.layer == '0'
    assert entity.dxf.color == 7
예제 #13
0
def test_full_circle_edge_scaling():
    _hatch = Hatch.new()
    _path = _hatch.paths.add_edge_path()
    _arc = _path.add_arc((0, 0), radius=1, start_angle=0, end_angle=360, ccw=1)
    _hatch.transform(Matrix44.scale(0.5, 0.5, 0.5))
    assert _arc.radius == pytest.approx(0.5)