def test_fast_translation(): point = Point.new(dxfattribs={ 'location': (2, 3, 4), 'extrusion': (0, 1, 0), 'thickness': 2 }) point.translate(1, 2, 3) assert point.dxf.location == (3, 5, 7)
def test_point_to_code(): from ezdxf.entities.point import Point entity = Point.new(handle='ABBA', owner='0', dxfattribs={ 'color': '7', 'location': (1, 2, 3), }) new_entity = translate_to_code_and_execute(entity) for name in ('color', 'location'): assert new_entity.get_dxf_attrib(name) == entity.get_dxf_attrib(name)
def test_fast_translation(): point = Point.new( dxfattribs={ "location": (2, 3, 4), "extrusion": (0, 1, 0), "thickness": 2, } ) point.translate(1, 2, 3) assert point.dxf.location == (3, 5, 7)
def test_point_to_code(): from ezdxf.entities.point import Point entity = Point.new( handle="ABBA", owner="0", dxfattribs={ "color": "7", "location": (1, 2, 3), }, ) new_entity = translate_to_code_and_execute(entity) for name in ("color", "location"): assert new_entity.get_dxf_attrib(name) == entity.get_dxf_attrib(name)
def test_transform(): point = Point.new(dxfattribs={ 'location': (2, 3, 4), 'extrusion': (0, 1, 0), 'thickness': 2 }) # 1. rotation - 2. scaling - 3. translation m = Matrix44.chain(Matrix44.scale(2, 3, 1), Matrix44.translate(1, 1, 1)) point.transform(m) assert point.dxf.location == (5, 10, 5) assert point.dxf.extrusion == (0, 1, 0) assert point.dxf.thickness == 6 angle = math.pi / 4 point.transform(Matrix44.z_rotate(math.pi / 4)) assert point.dxf.extrusion.isclose((-math.cos(angle), math.sin(angle), 0)) assert math.isclose(point.dxf.thickness, 6)