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
def test_default_new(): entity = Hatch.new( handle="ABBA", owner="0", dxfattribs={ "color": 7, }, ) assert entity.dxf.layer == "0" assert entity.dxf.color == 7
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)]
def hatch_pattern(): return Hatch.from_text(HATCH_PATTERN)
def spline_edge_hatch(): return Hatch.from_text(EDGE_HATCH_WITH_SPLINE)
def edge_hatch(): return Hatch.from_text(EDGE_HATCH)
def path_hatch(): return Hatch.from_text(PATH_HATCH)
def hatch(): return Hatch.new()
def test_write_dxf(): entity = Hatch.from_text(HATCH) result = TagCollector.dxftags(entity) expected = basic_tags_from_text(HATCH) assert result == expected
def test_default_init(): entity = Hatch() assert entity.dxftype() == "HATCH" assert entity.dxf.handle is None assert entity.dxf.owner is None
def entity(): return Hatch.from_text(HATCH)
def test_default_new(): entity = Hatch.new(handle='ABBA', owner='0', dxfattribs={ 'color': 7, }) assert entity.dxf.layer == '0' assert entity.dxf.color == 7
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)