def test_default_new(): entity = Mesh.new(handle='ABBA', owner='0', dxfattribs={ 'color': 7, 'version': 3, 'blend_crease': 1, 'subdivision_levels': 2, }) assert entity.dxf.layer == '0' assert entity.dxf.color == 7 assert entity.dxf.version == 3 assert entity.dxf.blend_crease == 1 assert entity.dxf.subdivision_levels == 2
def test_default_new(): entity = Mesh.new( handle="ABBA", owner="0", dxfattribs={ "color": 7, "version": 3, "blend_crease": 1, "subdivision_levels": 2, }, ) assert entity.dxf.layer == "0" assert entity.dxf.color == 7 assert entity.dxf.version == 3 assert entity.dxf.blend_crease == 1 assert entity.dxf.subdivision_levels == 2
def test_mesh_to_code(): from ezdxf.entities.mesh import Mesh from ezdxf.render.forms import cube entity = Mesh.new(handle='ABBA', owner='0', dxfattribs={ 'color': '7', }) c = cube() entity.vertices = c.vertices entity.edges = c.edges entity.faces = c.faces assert len(entity.vertices) == 8 new_entity = translate_to_code_and_execute(entity) assert list(entity.vertices) == list(new_entity.vertices) assert list(entity.faces) == list(new_entity.faces)
def test_mesh_to_code(): from ezdxf.entities.mesh import Mesh from ezdxf.render.forms import cube entity = Mesh.new( handle="ABBA", owner="0", dxfattribs={ "color": "7", }, ) c = cube() entity.vertices = c.vertices entity.faces = c.faces assert len(entity.vertices) == 8 new_entity = translate_to_code_and_execute(entity) assert list(entity.vertices) == list(new_entity.vertices) assert list(entity.faces) == list(new_entity.faces)
def mesh(doc): return Mesh.from_text(MESH2, doc)
def test_write_dxf(): entity = Mesh.from_text(MESH) result = TagCollector.dxftags(entity) expected = basic_tags_from_text(MESH) assert result == expected
def test_default_init(): entity = Mesh() assert entity.dxftype() == 'MESH' assert entity.dxf.handle is None assert entity.dxf.owner is None
def entity(): return Mesh.from_text(MESH)
def test_mesh_transform_interface(): mesh = Mesh() mesh.vertices.append(Vec3(1, 2, 3)) mesh.transform(Matrix44.translate(1, 1, 1)) assert mesh.vertices[0] == (2, 3, 4)
def mesh(): return Mesh.from_text(MESH)