---
title: "voxels(within:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlvoxelarray/voxels(within:)"
---

# voxels(within:)

Returns a data object containing all voxels within the specified volume.

## Declaration

```swift
func voxels(within extent: MDLVoxelIndexExtent) -> Data?
```

## Parameters

- `extent`: The minimum and maximum corners of the volume for which to retrieve voxel data.

## Return Value

Return Value A data object containing MDLVoxelIndex values.

## Discussion

Discussion The returned NSData object contains an array of MDLVoxelIndex values describing the locations of voxels within the specified volume as well as their volumetric relationship to the object modeled by the voxel array.

## See Also

### Examining Voxels

- [count](modelio/mdlvoxelarray/count.md)
- [voxelIndexExtent](modelio/mdlvoxelarray/voxelindexextent.md)
- [voxelExists(atIndex:allowAnyX:allowAnyY:allowAnyZ:allowAnyShell:)](modelio/mdlvoxelarray/voxelexists(atindex:allowanyx:allowanyy:allowanyz:allowanyshell:).md)
- [voxelIndices()](modelio/mdlvoxelarray/voxelindices().md)
