kicad2ems.gui.drawtab

The Draw page: arbitrary shapes drawn over the board, in plan and in 3D, for a
run to add to it (kicad2ems.core.shapes: the drawing as data, and what it does
to the board; core.shapeops: edits of many shapes, snapping, measuring;
core.view3d: the 3D view's numbers).

    Plan    the board's copper on the layer drawn on (the other layers faint),
            and the shapes. Tools: Select, Rectangle and Circle (two clicks),
            Polygon and Trace (a click per point; double-click, right-click or
            Enter ends, Esc drops), Port (a click), Measure (a click per
            point: two give the distance and its angle, a third the angle
            between the legs; Esc clears). Points snap to the board's pads,
            vias, track ends and edges and to the shapes' corners, midpoints
            and centres (a marker shows where; `objects`), else to the grid.
    Select  a click picks a shape, Shift or Ctrl + click adds it or takes it
            off; a drag from a shape moves the selection (X / Y while
            dragging: along that axis only; Esc puts it back), from a handle
            reshapes the one selected; a drag on nothing draws a box (left to
            right: what is wholly inside; right to left: what it touches;
            Shift: added). Ctrl + drag, or the middle button, pans; the wheel
            and the right button zoom.
    3D      the same shapes extruded: copper and cuts as slabs on their layer,
            metal, dielectric, air, ferrite (charcoal) and magnets as solids
            between their two heights (a magnet in two halves, its poles: N
            red, S blue, so the one on top says which way it is magnetised),
            over the board's substrate and copper. A click picks a shape
            (Shift or Ctrl: adds or takes it off; on nothing: none), a drag
            moves the selection on its level (X / Y / Z while dragging: along
            that axis), a drag on the gizmo's arrows along that one, Shift +
            drag on a solid's top or bottom face stretches it, on its side
            lifts it; Shift + drag on nothing draws a box (as the plan's); a
            drag on nothing orbits, Ctrl + drag pans. The camera's presets
            (Top 7, Front 1, Side 3: orthographic; Iso 5: perspective; Fit
            F), a clip plane (Clip), what is drawn (Show: the board's layers,
            each material), the working level's grid. (gui.draw3d)
    Shapes  the list in the order they are applied (a cut takes out what is
            drawn before it), each shown or hidden (hidden: not drawn or
            picked, still applied) and locked or not (locked: not moved,
            turned or deleted); the selected one's properties (with several
            selected a change applies to them all: a ferrite's er, tan d,
            4 pi Ms and FMR linewidth, a magnet's remanence and which way it
            is magnetised, and for either the bias the drawn magnets give the
            ferrite (core.magnets: the internal field, how much of it is
            saturated, f0 and fm; worked out a moment after, never while
            dragging); a solid made a ferrite with a laminate's er 4.3 takes
            a ferrite's 15); Arrange (move by, rotate
            by any angle about a point, mirror, align, distribute) and Array
            (a row, a grid, a circle). The list has an icon a shape (its
            kind's glyph in its material's colour), the form its fields in
            groups (Shape, Size, Heights, Material, Bias, Points).
    Menus   Drawing (new, open, save; Use in runs, Region from shape, Ports
            to settings), Edit (undo, the clipboard, select all, none or
            alike: the same material, layer, net or kind; lock, hide, the
            order), Modify (rotate, to polygon; union, subtract, intersect:
            core.shapeops.combined; fillet and chamfer the corners),
            Templates (core.templates: a can, a DR, a circulator, an SMA, an
            absorber, a via fence; a dialog of its numbers, then a click
            places its shapes, drawn under the mouse till then), View (fit,
            the camera, orthographic, a ferrite's bias map in plan: H0 in
            colour over it, drawmagnets.bias_map, the plan and 3D side by
            side).

Copy, cut and paste go through the clipboard as kicad2ems-shapes text (into
another drawing, or another session). Use in runs saves the drawing and names
it in the settings (`shapes`); Region from shape and Ports to settings write
those settings (KiCad coordinates: y negated). The status bar has the cursor
(model and KiCad mm), the size being drawn and what it snapped to.

Keys while the page has the focus: S R C P T O M the tools, Delete, Esc,
Enter, Ctrl+Z / Ctrl+Y undo and redo (the settings keep theirs elsewhere),
Ctrl+A all, Ctrl+C / Ctrl+X / Ctrl+V the clipboard, Ctrl+D duplicate, F fit
the selection in both views, 7 1 3 5 the 3D camera, X / Y / Z while dragging,
the arrows a nudge of a grid step (Shift: ten; one undo step while they go
on).

    tab = DrawTab(win)          # win: the main window, or None (on its own)
    tab.set_board(layout)       # core.layout.board_layout's dict, or None
    tab.add(Shape(...)); tab.drawing; tab.save(path); tab.load(path)
    tab.bias_text()             # the selected ferrite's (or magnet's) bias
    tab.select(i, 'only' | 'toggle' | 'add'); tab.selected; tab.sel
    tab.move_by(dx, dy); tab.rotate_by(30, about); tab.mirror('x')
    tab.align('left'); tab.distribute('x'); tab.make_array('row', n=5, dx=1)
    tab.combine('union'); tab.round_corners(0.5, 'fillet'); tab.nudge(dx, dy)
    tab.select_alike('material'); tab.place_template('can', (x, y), values)
    tab.start_placing('circulator', values)  # the next click places it
class kicad2ems.gui.drawtab.DrawTab(win=None)[source]
align(how)[source]
The selection lined up (core.shapeops.ALIGN: left, right, hcentre,
top, bottom, vcentre); locked ones stay, as anchors.
bias_text(i=None)[source]
What the form says of shape i's bias (default: the one it shows):
a ferrite's internal field, saturated share, f0 and fm, a magnet's
direction and every ferrite's (gui.drawmagnets.readout, from
core.magnets.summary of the board with the drawn solids). Worked out
once while the drawn solids are the same.
box_select(x0, y0, x1, y1, crossing=False, add=False)[source]
The shapes wholly inside the box (crossing: touching it) selected
(add: as well as those already); hidden ones never.
combine(op)[source]
The selection's outlines combined (core.shapeops.combined: 'union',
'subtract' the others from the first selected, 'intersect') into
polygons where the first selected was (its place in the list, and
its material, layer or heights, net and name); the others removed.
One undo step. The new polygons, or None (not done: why in the
status bar).
copy()[source]
The selection to the clipboard (kicad2ems-shapes text).
distribute(axis)[source]
The selection's centres spaced evenly along 'x' or 'y'.
frame_selection()[source]
The selection (else the drawing, else the board) filling the plan
and the 3D view.
hit(x, y)[source]
The shape at (x, y) model mm (the last drawn on top; those of the
layer shown first; hidden ones never), or None.
make_array(kind, n=2, ny=1, dx=0.0, dy=0.0, centre=(0, 0), angle=360.0, turn=True)[source]
Copies of the selection: a row of n (each (dx, dy) on), a grid of
n by ny (dx, dy apart), or n round `centre` over `angle` degrees
(turn: each copy turned too). The copies are added after it and
selected with it.
mirror(axis)[source]
The selection mirrored about its centre: 'x' reverses x, 'y' y.
move_by(dx=0.0, dy=0.0, dz=0.0)[source]
The selection moved by (dx, dy) mm, its solids lifted dz.
nudge(dx, dy)[source]
The selection moved by (dx, dy) mm, as by the arrow keys: nudges
one after another (the same selection, within 1.5 s) are one undo
step.
paste(text=None)[source]
The clipboard's shapes (or those of `text`) added, selected: where
they were, or a grid step along if exactly there already.
place_template(key, at=(0.0, 0.0), values=None)[source]
Template `key`'s shapes (core.templates.make, on the layer drawn
on) added at `at` (model mm; a fence: along the selected traces),
selected: one undo step. The shapes, or [] (why in the status
bar).
ports_to_settings()[source]
The drawn ports appended to the extra ports setting (P<n>@x,y,layer:
numbered after the board's ports and those already there).
rotate()[source]
The selection turned 90 degrees anticlockwise about its centre.
rotate_by(angle, about=None)[source]
The selection turned `angle` degrees anticlockwise: about its
centre (about None), each about its own ('each'), or about the point
(x, y).
round_corners(r, how='fillet')[source]
The selected rectangles, polygons and traces with every corner
rounded to radius r mm (how 'fillet') or cut r mm along its legs
('chamfer'; core.shapeops.rounded); circles and ports stay.
save(path=None)[source]
The drawing written to `path` (None: asked for). The path, or None
(not saved).
property sel[source]
The shape the form shows: the last one selected, or None.
select(i, how='only')[source]
Shape i selected: alone ('only'; None: nothing), added ('add') or
added or taken off ('toggle').
select_alike(by)[source]
Every shape (not hidden) like the last picked by `by`
(core.shapeops.ALIKE: its material, layer, net or kind) selected.
set_board(layout)[source]
The board drawn on (core.layout.board_layout's dict, a run's
board.json's; None: none, a default two-layer stack).
set_hidden(flag=None)[source]
The selection hidden (True), shown (False) or, None, hidden
unless it all is.
set_locked(flag=None)[source]
The selection locked (True), unlocked (False) or, None, locked
unless it all is.
start_placing(key, values=None)[source]
Template `key` placed with the next click of the plan (its shapes
drawn under the mouse until then; Esc: not now). False: its values
make no shapes (why in the status bar).
template_dialog(key)[source]
The dialog of template `key`'s parameters; OK places it: with the
next click (its shapes follow the mouse until then), or along the
selected traces at once (a fence).
to_polygon()[source]
The selected rectangles, circles and traces as polygons of their
outlines' corners.
kicad2ems.gui.drawtab.shape_bounds(layout)[source]
(x0, y0, x1, y1) of a board dict's outline, or None.