996x
004133
2021-04-13

Setting Friction at Member Hinge via COM Interface

How is the friction set on a member hinge via the COM interface?


Answer:

Friction is a nonlinearity and can therefore only be modified via the interface to the member hinge.

For this, it is first necessary to create the member hinge, if not already available. Then, the IMemberHinge interface is brought to the member hinge and then to the nonlinearity (here IFriction). Then, you can use the methods GetData and SetData to modify the data (here Friction):

Sub SetMemberHingeFriction()

    Dim model As RFEM5.model
    Set model = GetObject(, "RFEM5.Model")
    model.GetApplication.LockLicense

    On Error GoTo e

    Dim data As IModelData
    Set data = model.GetModelData

    Dim hinge(0 To 0) As RFEM5.MemberHinge

    hinge(0).No = 1
    hinge(0).RotationalConstantX = 1
    hinge(0).RotationalConstantY = 2
    hinge(0).RotationalConstantZ = 3
    hinge(0).TranslationalConstantX = 4
    hinge(0).TranslationalConstantY = 5
    hinge(0).TranslationalConstantZ = 6
    hinge(0).Comment = "Member Hinge 1"
    
    hinge(0).TranslationalNonlinearityX = FrictionAType

    data.PrepareModification
    data.SetMemberHinges hinge
    data.FinishModification
    
    ' get interface for member hinge
    Dim imemhing As IMemberHinge
    Set imemhing = data.GetMemberHinge(1, AtNo)
    
    ' get interface for nonlinearity "friction"
    Dim iFric As IFriction
    Set iFric = imemhing.GetNonlinearity(AlongAxisX)
    
    ' get friction data
    Dim fric As Friction
    fric = iFric.GetData
    
    fric.Coefficient1 = 0.3
    
    ' set friction data
    data.PrepareModification
    iFric.SetData fric
    data.FinishModification
    
    
e:  If Err.Number <> 0 Then MsgBox Err.Description, , Err.Source

    Set data = Nothing
    model.GetApplication.UnlockLicense
    Set model = Nothing

End Sub

In the case of the friction Vy + Vz, the Coefficient2 is used to set the second coefficient. The spring constant in the Friction dialog box is controlled by the translational spring of the member hinge. In this particular case, this is TranslationalConstantX for the x‑direction (see Image 01).


Author

Mr. Günthel provides technical support for our customers.

Downloads


;