CModel.SetUseStress: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
*SetUseStress( StressValues() {{APIPrefix|As Double}})
*SetUseStress( StressValues() {{APIPrefix|As Double}})


== Parameters ==
Parameters
'''Index'''
:''Index'': The 0-based index of the stress for which the use stress level will be updated.
{{APIComment|The 0-based index of the Stress of which to update the Use Stress.}}
:''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).
'''StressValue'''
{{APIComment|The UseStress to update.}}
 
'''StressValues'''
{{APIComment|An array of UseStresses that correspond to the array of Stresses in the model.}}


== Usage Example ==
== Usage Example ==

Revision as of 17:54, 6 March 2014


Sets use stress value for a particular stress.

Syntax

  • SetUseStress( Index As Integer, StressValueAs Double)
  • SetUseStress( StressValues() As Double)

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 class.

       Private WithEvents 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.

       Dim AModel as cModel
       AModel = MyRepository.GetModel(ListOfModels(0).ID)

Get the number of stresses. In this example, the first model is used.

       Dim MyNumStresses As Integer
       MyNumStresses = AModel.NumStresses

Create an array and fill Use Stress levels 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)