CModel.SetUseStress: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 13: Line 13:


== Usage Example ==
== Usage Example ==
{{APIComment|Declare a new repository connection class.}}
{{APIComment|'Declare a new repository connection object. See [[Repository Class|Repository]].}}
        Private WithEvents MyRepository As New Repository
  Dim MyRepository As New Repository
 
 
{{APIComment|Connect to the Synthesis repository.}}
{{APIComment|'Connect to the Synthesis repository.}}
        Dim Success As Boolean = False
  Dim Success As Boolean = False
        Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
  Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
 
{{APIComment|Get the list of Projects in the connected repository.}}
{{APIComment|'Get the list of projects in the connected repository.}}
        Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
  Dim ListOfModels() As [[NameIdPair Class|NameIdPair]]
        ListOfModels = MyRepository.GetAllModelsInfo()
  ListOfModels = MyRepository.GetAllModelsInfo()
 
 
{{APIComment|Select the ID of the model and retrieve it.}}
{{APIComment|'Select the ID of the model and retrieve it. In this example, the first model is used.}}
        Dim AModel as cModel
  Dim AModel as cModel
        AModel = MyRepository.GetModel(ListOfModels(0).ID)
  AModel = MyRepository.GetModel(ListOfModels(0).ID)
 
 
{{APIComment|Get the number of stresses.  In this example, the first model is used.}}
{{APIComment|'Get the number of stresses in the model.}}
        Dim MyNumStresses As Integer
  Dim MyNumStresses As Integer
        MyNumStresses = AModel.NumStresses
  MyNumStresses = AModel.NumStresses
 
 
{{APIComment|Create an array and fill Use Stress levels for each of the stresses.  Assume the MyNumStresses in this example is 2.}}
{{APIComment|'Create an array and specify the use stress values for each of the stresses.}}
        Dim UseStressArray(MyNumStresses - 1) As Double
  {{APIComment|'Assume the MyNumStresses in this example is 2.}}
        UseStressArray(0) = 500
  Dim UseStressArray(MyNumStresses - 1) As Double
        UseStressArray(1) = 750
  UseStressArray(0) = 500
 
  UseStressArray(1) = 750
{{APIComment|Set the UseStress for the model.}}
 
        AModel.SetUseStress(UseStressArray)
{{APIComment|'Set the UseStress for the model.}}
  AModel.SetUseStress(UseStressArray)

Revision as of 17:11, 6 May 2014


Updates the use stress level for one or multiple stresses.

Syntax

  • SetUseStress( Index As Integer, StressValueAs Double) Updates the use stress value for the stress with the specified index.
  • SetUseStress( StressValues() As Double) Updates the use stress values for all stresses.

Parameters

Index: The 0-based index of the stress for which the use stress level will be updated.
StressValue: The value to use for the new use stress level.
StressValues: An array of new use stress values that correspond to the array of stresses in the model (e.g., the first stress value will become the use stress level for the first stress).

Usage Example

 'Declare a new repository connection object. See Repository. 
 Dim MyRepository As New Repository
 
 'Connect to the Synthesis repository. 
 Dim Success As Boolean = False
 Success = MyRepository.ConnectToRepository("RepositoryFileNamePath")
 
 'Get the list of projects in the connected repository. 
 Dim ListOfModels() As NameIdPair
 ListOfModels = MyRepository.GetAllModelsInfo()
 
 'Select the ID of the model and retrieve it. In this example, the first model is used. 
 Dim AModel as cModel
 AModel = MyRepository.GetModel(ListOfModels(0).ID)
 
 'Get the number of stresses in the model. 
 Dim MyNumStresses As Integer
 MyNumStresses = AModel.NumStresses
 
 'Create an array and specify the use stress values for each of the stresses. 
 'Assume the MyNumStresses in this example is 2. 
 Dim UseStressArray(MyNumStresses - 1) As Double
 UseStressArray(0) = 500
 UseStressArray(1) = 750
 
 'Set the UseStress for the model. 
 AModel.SetUseStress(UseStressArray)