global_processor, VectorData, read_multilayer_svg, LayerType, single_to_layer_id, ) from .cli import cli @cli.command(group="Input") @click.argument("file", type=click.Path(exists=True, dir_okay=False)) @click.option("-m", "--single-layer", is_flag=True, help="Single layer mode.") @click.option( "-l", "--layer", type=LayerType(accept_new=True), help="Target layer or 'new' (single layer mode only).", ) @click.option( "-q", "--quantization", type=LengthType(), default="0.1mm", help= "Maximum length of segments approximating curved elements (default: 0.1mm).", ) @click.option( "-s", "--no-simplify", is_flag=True, default=False,
def translate(lc: LineCollection, offset: Tuple[float, float]): """ Translate the geometries. X and Y offsets must be provided. These arguments understand supported units. """ lc.translate(offset[0], offset[1]) return lc # noinspection PyShadowingNames @cli.command(name="scale", group="Transforms") @click.argument("scale", nargs=2, type=LengthType()) @click.option( "-l", "--layer", type=LayerType(accept_multiple=True), default="all", help="Target layer(s).", ) @click.option( "-o", "--origin", "origin_coords", nargs=2, type=LengthType(), help="Use a specific origin.", ) @global_processor def scale_relative( vector_data: VectorData, scale: Tuple[float, float],
import click from vpype import ( LayerType, LineCollection, VectorData, global_processor, multiple_to_layer_ids, single_to_layer_id, ) from .cli import cli @cli.command(group="Layers") @click.argument("sources", type=LayerType(accept_multiple=True)) @click.argument("dest", type=LayerType(accept_new=True)) @global_processor def lcopy(vector_data, sources, dest): """Copy the content of one or more layer(s) to another layer. SOURCES can be a single layer ID, the string 'all' (to copy all non-empty layers, or a coma-separated, whitespace-free list of layer IDs. DEST can be a layer ID or the string 'new', in which case a new layer with the lowest available ID will be created. If a layer is both in the source and destination, its content is not duplicated. Examples: