AGI STK Objects 11 Send comments on this topic.
IAgCvAssetListCollection Collection





Description

Asset List

Object Model

Public Methods

Public Method Add Adds a new element to the collection.
Public Method CanAssignAsset Returns true is you can assign an asset.
Public Method GetAssetFromPath Retrieves an element, given an object path.
Public Method IsAssetAssigned Returns true if an asset is already assigned.
Public Method Remove Removes an element from the collection given a ObjectPath.
Public Method RemoveAll Removes all elements from the collection.
Public Method RemoveAt Removes an element from the collection using specified index.

Public Properties

Public Property AvailableAssets Available objects to assign as coverage assets.
Public Property Count Returns the number of elements in a collection.
Public Property Item Given an index, returns an element in the collection.

Example

Define a coverage definition assets
[C#] Copy Code
IAgCvAssetListCollection assetCollection = coverageDefinition.AssetList; 
string assetName = "Satellite/sat1"
string subAssetName = "Facility/North"
 
// Remove asset collection if necessary 
assetCollection.RemoveAll(); 
 
IAgCvAssetListElement satAsset1 = null
 
// AvailableAssets returns a one dimensional array of assets 
if (Array.IndexOf(assetCollection.AvailableAssets, assetName) != -1

    // Add assets to coverageDefintion 
    if (assetCollection.CanAssignAsset(assetName)) 
    { 
        satAsset1 = assetCollection.Add(assetName); 
 
        // Configure asset element 
        satAsset1.Required = true
        satAsset1.Grouping = AgECvAssetGrouping.eGrouped; 
    } 
 
    // Add subassets to assets 
    if (satAsset1.ContainsSubAssets()) 
    { 
        IAgCvAssetListCollection subAssetCollection = satAsset1.SubAssetList; 
        if (subAssetCollection.CanAssignAsset(subAssetName)) 
        { 
            assetCollection.Add(subAssetName); 
        } 
    } 

 

Define a coverage definition assets
[Visual Basic .NET] Copy Code
Dim assetCollection As IAgCvAssetListCollection = coverageDefinition.AssetList
Dim assetName As String = "Satellite/sat1"
Dim subAssetName As String = "Facility/North"

' Remove asset collection if necessary
assetCollection.RemoveAll()

Dim satAsset1 As IAgCvAssetListElement = Nothing

' AvailableAssets returns a one dimensional array of assets
If Array.IndexOf(assetCollection.AvailableAssets, assetName) <> -1 Then
    ' Add assets to coverageDefintion
    If assetCollection.CanAssignAsset(assetName) Then
        satAsset1 = assetCollection.Add(assetName)

        ' Configure asset element
        satAsset1.Required = True
        satAsset1.Grouping = AgECvAssetGrouping.eGrouped
    End If

    ' Add subassets to assets
    If satAsset1.ContainsSubAssets() Then
        Dim subAssetCollection As IAgCvAssetListCollection = satAsset1.SubAssetList
        If subAssetCollection.CanAssignAsset(subAssetName) Then
            assetCollection.Add(subAssetName)
        End If
    End If
End If

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1