To OCC shapes
Faces, wires and sketches become OpenCASCADE shapes with exact lines, arcs, full circles and B-splines, shared vertices, names and colors. The export needs OpenCASCADE through netgen.occ (pip install netgen-mesher, which brings OpenCASCADE as netgen-occt). On the way out, the export can apply everything that Simplify does. See Defeaturing for details.

The rocket example is revolved, lofted and extruded from planex2d sketches.
The example is a plate 4 × 2 with a bore of radius 0.5, with its outline and bore named (Figure 1):
[1]:
import planex as px
plate = px.QuickSketch((-2, -1)).Rectangle(4, 2, name="outline").Face()
part = plate - px.QuickSketch().Circle(0.5, name="bore").Face()
shape = part.ToOCCShape()
print(len(shape.edges), "edges:", sorted({e.name for e in shape.edges}))
5 edges: ['bore', 'outline']
Faces and wires
A face, its wires, or a wire on its own can each be exported as OpenCASCADE objects. The example exports the plate as a face and as its wires, and a slot of width 1 along a spine of 3 as one wire:
[4]:
face = part.ToOCCFace()
wires = part.ToOCCWires()
slot = px.QuickSketch().Slot(3, 1).Wire().ToOCCWire()
print(type(face).__name__, len(wires.edges), len(slot.edges))
Face 5 4
Everything at a glance
Object |
|
Also |
|---|---|---|
Face |
The face |
|
Wire |
Its wires |
|
Sketch |
The face of everything drawn |
|
Compound |
Faces and wires glued together |