## Geometry2D.Neighbors2D

### Description

Returns an Array of indices (Integers) of the 2D neighborhood of a given 2D component within a given distance (see Geometry2D.Neighborhood2D) ->a given safe array of given 2D components within a given distance.

### Parameters

Parameter | Type | Description
--- | --- | ---
compIdx / compIdxArray | Variant | Index of the component or Array of component indices
Possible Values: | Description:
0 <= compIdx < Number of 2D Component | The compIdx must be valid
0 <= compIdxArray[i] < Nb of 2D Component | The compIdxArray[i] must be valid
siNeighborType | siNeighborType | Type of neighboring
Possible Values: | Description:
siAdjacent / siGrow / siPrevCompo / siNextCompo / siFirstCompo / siLastCompo | Select the adjacent or grown neighbors
distance | Integer | Distance to take into account

### Examples

#### VBScript Example

    set oCube = Application.ActiveProject.ActiveScene.Root.AddGeometry("Cube", "MeshSurface")
    set oGeometry = oCube.obj
    set o2DGeometry = oGeometry.Geometry2D
    'Get the array of indices from that item
    set oSubComponent = getvalue(oCube.FullName & ".poly[1]")
    aIndices = oSubComponent.SubElements
    a2DNeighbors = o2DGeometry.Neighbors2D( aIndices, siAdjacent , 1 )
    for j = LBound( a2DNeighbors, 1 ) to UBound( a2DNeighbors, 1 )
            LogMessage "Component [" & j & "] 2D neighbor : " & a2DNeighbors(j)
    next

### See Also

Geometry2D.Neighborhood2D Geometry2D.Neighbors0D Geometry2D.Neighbors1D Geometry2D SIVector3