Beispiel #1
0
    renderer.clean()
    svg_output = renderer.render_svgs(panelize_quantity=args.panelize)

    logging.info('Removing redundant lines')
    processor = SvgProcessor(svg_output)
    redundant_lines = processor.remove_redundant_lines()
    processor.write(svg_output)

    # Export to png
    logging.info('Generating raster preview')
    raster_svg = os.path.join(laser_parts_directory, 'raster.svg')
    raster_png = os.path.join(laser_parts_directory, 'raster.png')
    processor.apply_raster_render_style()

    # Show which redundant lines were removed
    processor.add_highlight_lines(redundant_lines)

    processor.write(raster_svg)

    logging.info('Resize SVG canvas')
    subprocess.check_call([
        'inkscape',
        '--verb=FitCanvasToDrawing',
        '--verb=FileSave',
        '--verb=FileClose',
        raster_svg,
    ])
    logging.info('Export PNG')
    subprocess.check_call([
        'inkscape',
        '--export-width=320',
Beispiel #2
0
        redundant_lines, merged_lines = processor.remove_redundant_lines()

    processor.write(svg_output)

    logging.info('\n\n\nDone rendering to SVG: ' + svg_output)

    if args.render_raster:
        # Export to png
        logging.info('Generating raster preview')
        raster_svg = os.path.join(laser_parts_directory, 'raster.svg')
        raster_png = os.path.join(laser_parts_directory, 'raster.png')
        processor.apply_raster_render_style()

        if not args.skip_optimize:
            # Show which redundant lines were removed and lines merged
            processor.add_highlight_lines(redundant_lines, '#ff0000')
            processor.add_highlight_lines(merged_lines, '#0000ff')

        processor.write(raster_svg)

        logging.info('Resize SVG canvas')
        subprocess.check_call([
            'inkscape',
            '--verb=FitCanvasToDrawing',
            '--verb=FileSave',
            '--verb=FileClose',
            raster_svg,
        ])
        logging.info('Export PNG')
        subprocess.check_call([
            'inkscape',