Quick sketch

A sketch draws a profile from lines, arcs, circles and splines. An element can be placed by coordinates, but usually it is placed by its relation to what is already drawn: a line ends where it meets an edge, runs parallel to another line or at an angle to it, or touches a circle. planex2d computes the intersections and touch points, so none of them has to be worked out by hand. A full circle is one exact edge, with no vertices on it.

Profile tools draw common shapes in one call: rectangles, slots, keyholes, polygons, fillets and chamfers. Construction elements and points help to place the geometry without becoming part of the part. Every element gets an id, so later calls can refer to it, and trimming, offsets, mirroring and patterns finish the drawing. The result is wires, faces and shapes on any plane in 3D, ready for Boolean operations and export.

This section uses px.QuickSketch, which places every element once and keeps it as drawn, so it stays fast even for thousands of elements. px.Sketch has the same drawing calls and adds constraints and dimensions, so the design follows when a value changes. See Constraint sketches for details.

In this section

Drawing

References

Editing

Placement

Design

Everything at a glance

Sketches

px.QuickSketch() places every element once, without a solver; px.Sketch() takes the same calls and adds constraints and dimensions; px.Move((h, v)) starts a QuickSketch at a point.

Draw

Line, Arc, Spline, Circle, Rectangle, RectangleC, Slot, ArcSlot, Keyhole, Polygon, Hexagon, Close, Finish

Move the pen

Move((h, v)), Move(id), Move(dh, dv), Move(l), Turn(angle), Direction((dh, dv))

Lines

Line(l), Line(dh, dv), Line(to), Line(from, to); helpers until=, parallel=, distance=, perpendicular=, angle=, congruent=, tangent=, through=, reverse=

Arcs

Arc(r, sweep), Arc(to), Arc(to, r), Arc(from, to, r); helpers sweep=, center=, concentric=, congruent=, tangent=, through=, until=, reverse=

Circles

Circle(r), Circle(h, v, r), Circle(r, center=, concentric=, congruent=, through=, tangent=, reverse=). A full circle is one exact edge with no vertices.

Rectangles

Rectangle(l, w) from the pen, Rectangle(p0, p1) from two corners, Rectangle(p0, p1, p2) from a side and a point on the opposite side, RectangleC(l, w) around the pen or a center

Ready-made shapes

Slot(l, w), ArcSlot(r, sweep, w), Keyhole(l, w, r), Polygon(r, n), Hexagon(af); see Slots, keyholes and polygons.

Targets

Ids, px.H, px.V, edges, wires, faces, OpenCASCADE shapes, or (target, point), where the point decides that target’s choice; until=px.first / px.last.

Ids

Automatic ids such as Line.1, Arc.2, Point.3 and Chain.1 for every element, point and chain, or your own with id=. "id.start", "id.end", "id.mid" and "id.center" refer to an element’s points, Chain.-1 counts from the end, and selections accept globs such as "w.**.corner".

Construction

construction=True, Vertex(id, point), points, Location(id), Edge(id), Construction()

Offsets

Offset(source, d, both_sides=), or (d, point) for one side; the two sides are .left and .right. In a constraint sketch, "<id>.d" is its distance.

Edit

Trim(a, b, reverse=), Split(a, b), Fillet(at, r), Chamfer(at, d, d2=, angle=) (see Fillets and chamfers), SymmetryLine(a, b), Mirror(axis), Mirrored(ids, axis), LinearPattern(ids, dir, count, spacing), CircularPattern(ids, center, count), Remove(id)

Motions

Translate, Rotate, Scale, Mirror and their copies Translated, Rotated, Scaled, Mirrored, on the whole sketch or, for Mirror, on chosen elements; see Moving, rotating, mirroring, scaling.

3D geometry

Project(shape), Intersect3d(shape); see Projecting 3D geometry.

Properties

name, col, maxh, minh, hpref, layer and partition on every drawing call; id_wire= on Close and Finish.

Plane

px.QuickSketch(face) on a face of a solid, with the global origin and x axis projected onto it; also a px.Plane, netgen axes or another planex2d object as the first argument, copy=True to take over its geometry. px.Plane(face, origin=, axis=) projects another origin or axis; SetOrigin(point), Copy(). See The plane in 3D.

Results

Wire(), Wires(), Face(), Shape(), Edge(id) (a wire), ToOCCShape(), Plot()