403x
004195
2019-11-07

Question

How can I retroactively modify a member via the COM interface?


Answer:

To modify an existing element, you have to get the interface to the corresponding element, in this case on an example of a member:

    Dim iModel As RSTAB8.model
    Set iModel = GetObject(, "RSTAB8.Model")
    iModel.GetApplication.LockLicense
    
    Dim iModData As IModelData
    Set iModData = iModel.GetModelData
    
    Dim iMem As RSTAB8.IMember
    Set iMem = iModData.GetMember(1, AtNo)

Use this code to get the interface to Member 1, which should already be created. Then, you can use the .GetData() method of the interface to get the member data.

If you want to modify data (such as the member rotation in this case), you can transfer them to the program afterwards within a Prepare-/FinishModification block using the .SetData() method:


    Dim mem As RSTAB8.Member
    mem = iMem.GetData
    
    mem.Rotation.Angle = 0.5
    mem.Rotation.Type = RSTAB8.Angle
   
    iModData.PrepareModification
    iMem.SetData mem
    iModData.FinishModification