# `GSComponent setPieceValue:forKey:`

*Instance Method*

Sets an explicit interpolation value for a smart-component axis.

## Declaration

```swift
func setPieceValue(_ value: CGFloat, forKey key: String)
```

```objc
- (void) setPieceValue:(CGFloat) value forKey:(NSString *) key;
```

```python
setPieceValue_forKey_(value: float, key: str)
```

## Parameters

- `key` — The axis ID.

## See Also

### Smart Components

- [`GSComponent.pieceSettings`](/Core/GlyphsCore/GSComponent/pieceSettings) — Explicit interpolation values for smart-component axes.
- [`GSComponent setPieceSettingsFast:`](/Core/GlyphsCore/GSComponent/setPieceSettingsFast:) — Replaces the smart-component settings without copying, undo, or change notifications.
- [`GSComponent removePieceValueForKey:`](/Core/GlyphsCore/GSComponent/removePieceValueForKey:) — Removes an explicit interpolation value for a smart-component axis.
- [`GSComponent pieceValueForKey:`](/Core/GlyphsCore/GSComponent/pieceValueForKey:) — The explicit interpolation value for a smart-component axis.
- [`GSComponent valueForAxis:`](/Core/GlyphsCore/GSComponent/valueForAxis:) — The effective interpolation value for a smart-component axis.

