1016x
004888
2020-12-28

Question

How can I use the "Connect Lines or Members" function via the COM interface?


Answer:

The "Connect Lines/Members" option can be implemented with the "ConnectLines()" and "ConnectMembers()" functions. Both functions expect a string with the numbers of the lines or members:

Sub test_connect()

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

iMod.GetApplication.LockLicense

On Error GoTo e

Dim iModData As RFEM5.IModelData2
Set iModData = iMod.GetModelData()

iModData.PrepareModification
iModData.ConnectLines ("3,4")
iModData.ConnectMembers ("1,2")
iModData.FinishModification


e:

If Err.Number <> 0 Then MsgBox Err.description, vbCritical, Err.Source
iMod.GetApplication.UnlockLicense
Set iMod = Nothing

End Sub


In this example, Line 1 and Line 2 are connected and a node is created at the intersection point. The same applies to Member 1 and Member 2, where a new node is also created at the intersection point.