---
title: "setVoxelAtIndex(_:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlvoxelarray/setvoxelatindex(_:)"
---

# setVoxelAtIndex(_:)

Sets voxel characteristics at the specified index in the array.

## Declaration

```swift
func setVoxelAtIndex(_ index: MDLVoxelIndex)
```

## Parameters

- `index`: A voxel index to update in the array.

## Discussion

Discussion A MDLVoxelIndex value describes both a location in the voxel array and the characteristics of the volume at that location. To set characteristics at a location, pass a MDLVoxelIndex value whose first three components are the x, y, and z coordinates of that location and whose w coordinate specifies the shell level at that location. Shell level describes the relationship of that location’s volume to the object modeled by the voxel array: 0 for a voxel on the object’s surface, a positive value for voxels outside of the object’s volume, and a negative value for voxels inside the object’s volume. For voxels inside or outside the object, the magnitude of shell level indicates the number of voxels between the index and a voxel on the surface of the object.

## See Also

### Modifying Voxels

- [setVoxelsFor(_:divisions:interiorNBWidth:exteriorNBWidth:patchRadius:)](modelio/mdlvoxelarray/setvoxelsfor(_:divisions:interiornbwidth:exteriornbwidth:patchradius:).md)
- [setVoxelsFor(_:divisions:interiorShells:exteriorShells:patchRadius:)](modelio/mdlvoxelarray/setvoxelsfor(_:divisions:interiorshells:exteriorshells:patchradius:).md)
