Search
Loading...
Skip to content

Create Cutout

Create cutout paths for cutting printers to produce die-cut stickers, iron-on decals, and custom-shaped prints programmatically.

8 mins
estimated time
Download
StackBlitz
GitHub

Cutouts define outline paths that cutting printers cut with a blade rather than print with ink. CE.SDK supports creating cutouts from SVG paths, generating them from block contours, and combining them with boolean operations.

This guide covers creating cutouts from SVG paths, configuring cutout types and offsets, combining cutouts with boolean operations, and customizing spot colors for printer compatibility.

Understanding Cutouts#

Cutouts are special blocks that contain SVG paths interpreted by cutting printers as cut lines. Printers recognize cutouts through specially named spot colors: CutContour for solid continuous cuts and PerfCutContour for dashed perforated cuts.

The spot color RGB values affect on-screen rendering but not printer behavior. By default, solid cutouts render as magenta and dashed cutouts render as green.

Creating Cutouts from SVG Paths#

Create cutouts using engine.block.createCutoutFromPath(path) with standard SVG path syntax. The path coordinates define the cutout dimensions.

// Create a circular cutout from SVG path (scaled up for visibility)
const circle = engine.block.createCutoutFromPath(
'M 0,75 a 75,75 0 1,1 150,0 a 75,75 0 1,1 -150,0 Z'
);
engine.block.appendChild(page, circle);
engine.block.setPositionX(circle, 200);
engine.block.setPositionY(circle, 225);

The method accepts standard SVG path commands: M (move), L (line), H (horizontal), V (vertical), C (cubic curve), Q (quadratic curve), A (arc), and Z (close path).

Configuring Cutout Type#

Set the cutout type using engine.block.setEnum() to control whether the printer creates a continuous or perforated cut line.

// Set cutout type to Dashed for perforated cut line
engine.block.setEnum(circle, 'cutout/type', 'Dashed');

Solid creates a continuous cutting line (default), while Dashed creates a perforated cutting line for tear-away edges.

Configuring Cutout Offset#

Adjust the distance between the cutout line and the source path using engine.block.setFloat().

// Set cutout offset distance from source path
engine.block.setFloat(circle, 'cutout/offset', 5.0);

Positive offset values expand the cutout outward from the path. Use offset to add bleed or margin around designs for cleaner cuts.

Creating Multiple Cutouts#

Create additional cutouts with different properties to demonstrate various shapes and configurations.

// Create a square cutout with solid type (scaled up for visibility)
const square = engine.block.createCutoutFromPath('M 0,0 H 150 V 150 H 0 Z');
engine.block.appendChild(page, square);
engine.block.setPositionX(square, 450);
engine.block.setPositionY(square, 225);
engine.block.setFloat(square, 'cutout/offset', 8.0);

Each cutout can have independent type and offset settings based on your production requirements.

Combining Cutouts with Boolean Operations#

Combine multiple cutouts into compound shapes using engine.block.createCutoutFromOperation(ids, operation). Available operations are Union, Difference, Intersection, and XOR.

// Combine cutouts using Union operation
const combined = engine.block.createCutoutFromOperation(
[circle, square],
'Union'
);
engine.block.appendChild(page, combined);
engine.block.setPositionX(combined, 200);
engine.block.setPositionY(combined, 225);
// Destroy original cutouts to avoid duplicate cuts
engine.block.destroy(circle);
engine.block.destroy(square);

The combined cutout inherits the type from the first cutout in the array and has an offset of 0. Destroy the original cutouts after combining to avoid duplicate cuts.

Customizing Spot Colors#

Modify the spot color RGB approximation using engine.editor.setSpotColorRGB() to change how cutouts render without affecting printer behavior.

// Customize spot color RGB for rendering (bright blue for visibility)
engine.editor.setSpotColorRGB('CutContour', 0.0, 0.4, 0.9);

Spot color names (CutContour, PerfCutContour) are what printers recognize. Adjust the names if your printer uses different conventions.

Exporting Cutouts#

Export the design with cutouts to PDF format to preserve spot color information for cutting printers.

// Export to PNG for preview
const pngBlob = await engine.block.export(page, { mimeType: 'image/png' });
const pngBuffer = Buffer.from(await pngBlob.arrayBuffer());
writeFileSync(`${outputDir}/cutout-result.png`, pngBuffer);
console.log('✓ Exported PNG preview to output/cutout-result.png');
// Export to PDF with spot colors for cutting printer
const pdfBlob = await engine.block.export(page, {
mimeType: 'application/pdf'
});
const pdfBuffer = Buffer.from(await pdfBlob.arrayBuffer());
writeFileSync(`${outputDir}/cutout-result.pdf`, pdfBuffer);
console.log('✓ Exported PDF with spot colors to output/cutout-result.pdf');

The PDF output contains spot colors that cutting printers read to identify cut paths.

Troubleshooting#

Cutout Not Visible#

Cutouts render using spot color RGB approximations. Verify the cutout is appended to the page hierarchy and positioned within the visible canvas area.

Printer Not Cutting#

Check that spot color names match your printer’s requirements. Some printers need specific names like CutContour or Thru-cut. Consult your printer documentation.

Combined Cutout Has Wrong Type#

Combined cutouts inherit the type from the first cutout in the array. Reorder the array or set the type explicitly after combination.

API Reference#

MethodCategoryPurpose
engine.block.createCutoutFromPath(path)CutoutCreate cutout from SVG path string
engine.block.createCutoutFromBlocks(ids, vThresh, sThresh, useShape)CutoutCreate cutout from block contours
engine.block.createCutoutFromOperation(ids, op)CutoutCombine cutouts with boolean operation
engine.block.setEnum(id, 'cutout/type', value)PropertySet cutout type (Solid/Dashed)
engine.block.setFloat(id, 'cutout/offset', value)PropertySet cutout offset distance
engine.block.setFloat(id, 'cutout/smoothing', value)PropertySet corner smoothing threshold
engine.block.appendChild(parent, child)HierarchyAdd cutout to scene
engine.block.setPositionX/Y(id, value)TransformPosition cutout on canvas
engine.block.destroy(id)LifecycleRemove cutout from scene
engine.block.export(id, options)ExportExport page with cutouts to PDF
engine.editor.setSpotColorRGB(name, r, g, b)EditorCustomize spot color rendering

Next Steps#