# `GSShape drawInPen:openPen:secondaryPen:extraHandles:`

*Instance Method*

Writes the shape to separate pens for closed paths, open paths, and auxiliary output.

## Declaration

```swift
func draw(inPen pen: any GSPenProtocol & NSObjectProtocol, openPen: (any GSPenProtocol & NSObjectProtocol)?, secondaryPen secondPen: (any GSPenProtocol & NSObjectProtocol)?, extraHandles: NSMutableArray?)
```

```objc
- (void) drawInPen:(NSObject<GSPenProtocol> *) pen openPen:(NSObject<GSPenProtocol> *) openPen secondaryPen:(NSObject<GSPenProtocol> *) secondPen extraHandles:(NSMutableArray *) extraHandles;
```

```python
drawInPen_openPen_secondaryPen_extraHandles_(pen: NSObject<GSPenProtocol>, openPen: NSObject<GSPenProtocol>, secondPen: NSObject<GSPenProtocol>, extraHandles: list)
```

## Parameters

- `openPen` — The destination for open paths, or `nil` to omit them.
- `secondPen` — The destination for auxiliary geometry, or `nil` to omit it.
- `extraHandles` — A mutable array for additional handles produced while preparing the shape.

## Discussion

Closed paths are written to `pen` and open paths are written to `openPen`. When `openPen` is `nil`, open paths produce no primary output. The secondary pen receives auxiliary geometry generated while resolving path decorations and masks. The extra handles array is available to drawing preparation callbacks.

## See Also

### Drawing

- [`GSShape drawInPen:`](/Core/GlyphsCore/GSShape/drawInPen:) — Writes the shape to a pen.
- [`GSShape drawSimpleInPen:`](/Core/GlyphsCore/GSShape/drawSimpleInPen:) — Writes the basic shape representation to a pen without resolving path decorations.
- [`GSShape drawSimpleInPen:fast:`](/Core/GlyphsCore/GSShape/drawSimpleInPen:fast:) — Writes the basic shape representation to a pen, optionally omitting segment object information.

