Smooth Staircases
Merges the shapes on visible layers and turns the one-row steps of their outlines, as raster images produce them, into diagonal edges. Open it from Tools → Boolean Operations → Smooth Staircases. The tool needs the Tools option.
When to Use
- After importing a bitmap image whose pixels were combined into polygons, to replace the stepped outlines of slanted and curved edges with straight diagonals
- On any layout drawn on a row grid, such as the output of a scanline or pixel-based process, whose outlines should follow the intended edge instead of the rows
Bitmap import can smooth the staircases itself with its Smooth staircases option. Use this tool for drawings imported without it, for other settings, or for geometry from another source.
Options
| Option | Description | Default |
|---|---|---|
| Row height | Height of one row of pixels, in the display units: the distance a concave corner moves along its riser. With rows of unequal height, the tallest | |
| Smoothing | One-row steps only: inside corners with a taller riser stay sharp and pockets keep their floor. All steps and narrow pockets: every riser is smoothed and pockets up to three rows wide lose their closed row | One-row steps only |
| Rows | Horizontal or Vertical: the direction of the pixel rows, along which the steps run | Horizontal |
| Join shapes touching at a corner | Smooths across corners where two pixels touch diagonally, joining the shapes there | On |
| Fill Rule | How overlaps of the shapes being merged are interpreted: Non-zero winding rule or Even-odd rule | |
| Draw generated holes using… | Cut-lines in re-entrant polygons, Sliced simple polygons, or Extract holes as polygons | |
| Apply To | All Visible geometry or only the current Selection | All Visible |
The dialog remembers its settings from one use to the next.
How It Works
- The shapes of each layer are merged, as by Merge Overlapping
- In the merged outlines, a horizontal edge is a step and a vertical edge a riser (for vertical rows, the other way round)
- Every concave corner between a step and a riser moves by one row height along the riser, so a staircase of rows becomes a straight diagonal edge, whatever the width of its steps
- The result replaces the original shapes, with holes drawn as chosen
One-row steps only is the setting bitmap import uses. All steps and narrow pockets gives the outline of sampling the material on scanlines one row apart; unlike such sampling, two shapes one row apart stay apart.
Command Line
The SmoothStaircases command of --apply-tool and of ToolApply in command files runs the same tool:
SmoothStaircases(RISE,MAXSTEP,MAXRISER,POCKET,BRIDGE,AXIS,UNION)| Argument | Description |
|---|---|
RISE | Row height, in the current units |
MAXSTEP | Longest step that is smoothed, or none for any length |
MAXRISER | Tallest riser whose concave corners are smoothed, or none for any height. Set it to RISE to keep inside corners with a taller riser sharp |
POCKET | Widest pocket (a notch, slot or hole) whose floor rises by one row; 0 keeps every floor |
BRIDGE | true joins shapes where two pixels touch diagonally; false keeps them apart |
AXIS | Y for horizontal rows, as a raster image is scanned; X for vertical rows |
UNION | Auto merges the result again only where smoothing can make shapes touch; Always for vertices off the row grid; Never |
The two settings of the dialog are SmoothStaircases(R,none,R,0,true,Y,Auto) (one-row steps only) and SmoothStaircases(R,none,none,3R,true,Y,Auto) (all steps and narrow pockets), with R the row height. The command uses the fill rule and holes mode set before it:
linkcad -i mask.png --input-format Image -o mask.gds --output-format GDSII \ --RasterInScalingValue 0.5 --RasterInScalingValueY 0.5 --RasterInMergeType 2 \ --apply-tool "SetUnits(um);SetHolesMode(Split);SmoothStaircases(0.5,none,0.5,0,true,Y,Auto)" \ --quit --no-save-settingsFrom Python, the same operation is linkcad.edit.SmoothStaircasesTask; see linkcad.edit.
Technical Notes
- Shapes on different layers are never merged with each other
- Smoothing only moves corners along risers; it does not round or simplify edges that are not stepped