Solid Edge Framework Type Library
Item Method
Variant (input) index.
Description
The items in a collection.
Syntax
Visual Basic
Public Function Item( _
   ByVal Index As Variant _
) As Object
Parameters
Index
Variant (input) index.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeframework.Application
    Dim objDoc As SolidEdgepart.PartDocument
    Dim objVars As SolidEdgeframework.Variables
    Dim objVar1 As SolidEdgeframework.variable
    Dim objVar2 As SolidEdgeframework.variable
    Dim objVar3 As SolidEdgeframework.variable
    Dim objVarList As SolidEdgeframework.VariableList
    Dim strVar1 As String
    Dim strFormula1 As String
    Dim strVar2 As String
    Dim strFormula2 As String
    ' Report errors
    Const PI = 3.14159265358979
    ' Create/get the application with specific settings
    On Error Resume Next
    Set objApp = GetObject(, "SolidEdge.Application")
    If Err Then
        Err.Clear
        Set objApp = CreateObject("SolidEdge.Application")
        Set objDoc = objApp.Documents.Add("SolidEdge.PartDocument")
        objApp.Visible = True
    Else
        Set objDoc = objApp.ActiveDocument
    End If
    ' Open the TestCase file
    Set objDoc = objApp.Documents.Open(Filename:="T:\vbtests\TestCases\Variables.par")
    ' Add a new Variable to the already existing Variables
    Set objVars = objDoc.Variables
    ' Set the Variable name and Formula
    strVar1 = "MyVar1"
    strFormula1 = "2*Height"
    Set objVar1 = objVars.Add(pName:=strVar1, pFormula:=strFormula1, UnitsType:=igUnitDistance)
    ' Query for the existing User created Variables
    Set objVarList = objVars.Query(pFindCriterium:="MyVar1")
    ' Add a new Variable
    ' Set the Variable name and Formula
    strVar2 = "MyVar2"
    strFormula2 = "4*Height"
    Set objVar2 = objVars.Add(pName:=strVar2, pFormula:=strFormula2, UnitsType:=igUnitDistance)
    ' Add another Variable to the List
    Call objVarList.Add(variable:=objVar2)
    ' Get a Variable object from the List
    Set objVar3 = objVarList.Item(2)
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objVars = Nothing
    Set objVar1 = Nothing
    Set objVar2 = Nothing
    Set objVar3 = Nothing
    Set objVarList = Nothing
End Sub
See Also

VariableList Collection  | VariableList Members