def draw_rect(points: List[Vec3], color: Color, out: Backend): from ezdxf.addons.drawing import Properties props = Properties() props.color = color for a, b in zip(points, points[1:]): out.draw_line(a, b, props)
def override_properties(self, entity: DXFGraphic, properties: Properties) -> None: if not self.override_enabled: return if properties.layer == 'T1': properties.layer = 'Tx' properties.color = '#000000' if entity.dxf.text == 'T2': properties.is_visible = False
def override_properties(self, entity: DXFGraphic, properties: Properties) -> None: if not self.override_enabled: return if properties.layer == "T1": properties.layer = "Tx" properties.color = "#000000" if entity.dxf.text == "T2": properties.is_visible = False
def test_backend_default_draw_path(): backend = BasicBackend() path = Path.from_vertices([(0, 0), (1, 0), (2, 0)]) backend.draw_path(path, Properties()) result = backend.collector assert len(result) == 2 assert result[0][0] == 'line'
def test_draw_scaled_path(self, backend): p1 = Path((1, 2)) p1.line_to((2, 3)) backend.draw_path(p1, Properties()) f = backend.factor expected_p2 = p1.transform(Matrix44.scale(f, f, f)) p2 = backend.collector[0][1] for v1, v2 in zip(p2.control_vertices(), expected_p2.control_vertices()): assert v1.isclose(v2)
def test_draw_scaled_point(self, backend): backend.draw_point(Vec3(1, 2, 3), Properties()) assert backend.collector[0][1] == Vec3(2, 4, 6)