Solid Edge Framework Type Library
GetFormula Method
Returns the name of the formula.
Description
Returns the name of the formula used by the referenced Variable object.
Syntax
Visual Basic
Public Function GetFormula( _
   ByVal wcpName As String _
) As String
Parameters
wcpName
Returns the name of the formula.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeframework.Application
    Dim objDoc As SolidEdgepart.PartDocument
    Dim objVariables As SolidEdgeframework.Variables
    Dim objVariable As SolidEdgeframework.variable
    Dim objVar1 As SolidEdgeframework.variable
    Dim objVar2 As SolidEdgeframework.variable
    Dim strFormula 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
    'Get Variables Collection
    Set objVariables = objDoc.Variables
    'Create a variable with Add method
    Set objVariable = objVariables.Add(pName:="Variable1", pFormula:="100.0")
    'Create a variable specifying UnitType
    Set objVar1 = objVariables.Add(pName:="Variable2", pFormula:="100 mm", UnitsType:=igUnitDistance)
    'Create a variable with Formula
    Set objVar2 = objVariables.Add(pName:="Variable3", pFormula:="Variable1 * Variable2", UnitsType:=igUnitArea)
    'Get the formula of Variable3
    strFormula = objVariables.GetFormula(wcpName:="Variable3")
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objVariables = Nothing
    Set objVariable = Nothing
    Set objVar1 = Nothing
    Set objVar2 = Nothing
End Sub
See Also

Variables Collection  | Variables Members