My immutable answer: API!
Something in the likes of - see below.
This supposes that:
1) you've pre-created your beam property. specify the id in the code. Or use a prop object and select/create a new one.
2) your list N1 - N2 is in a text file in column format, separated by space(s). if not adapt the code
3) how do you orient your beams? nodeID? vector? cf part 2 of code
Be sure to fill in where specified.
Hope this helps,
AP
Sub Main
Dim App As femap.model
Set App = feFemap()
Dim s As String, sAr As Variant
Dim nodes() As Long
Dim el As femap.Elem
Set el = App.feElem
'*** 1) READ FILE
s = GetFilePath("","",,"Select file",0)
If s = "" Then End
'NB: only dim2 is dynamically redim-able in VB
ReDim nodes(1,0)
Open s For Input As #1
While Not EOF(1)
Line Input #1, s
If s ="" Then GoTo SKIPLINE 'skip empty lines
s = Trim(s) 'leading/trailing spaces
While InStr(s," ")<>0 'multiple spaces
s = Replace(s," "," ")
Wend
sAr = Split(s)
'dyamic array which stores N1 - N2
If nodes(0,0)<>0 Then ReDim Preserve nodes(1,UBound(nodes,2)+1)
nodes(0,UBound(nodes,2)) = CLng(sAr(0))
nodes(1,UBound(nodes,2)) = CLng(sAr(1))
SKIPLINE:
Wend
Close #1
'*** 2) CREATE ELEMS
el.type = FET_L_BEAM : el.topology = FTO_LINE2
el.propID = 'FILL IN!! specify propID - could also select it with a prop object...
el.orientID = 'FILL IN!! trick: orient with node or vector...? 0 if vector, nodeID otherwise
Dim v1 As Variant, v2 As Variant 'if orienting with vector
For i = 0 To UBound(nodes,2)
el.Node(0) = nodes(0,i) : el.Node(1) = nodes(1,i)
'if orienting with vector:
App.feCoordOnNode(nodes(0,i),v1)
App.feCoordOnNode(nodes(1,i),v2)
For j = 0 To 2
v1(j) = v2(j)-v1(j) 'vector n1=>n2
Next
'orthogonal vector, should work for orient
If v1(0)<>0 Or v1(1)<> 0 Then
v2(0) = -v1(1) : v2(1) = v1(0) : v2(2) = 0
Else
v2(0) = 1 : v2(1) = 0 : v2(2) = 0
End If
el.orient(0) = v2(0) : el.orient(1) = v2(1) : el.orient(2) = v2(2)
'end part "if orienting with vector"
el.Put(el.NextEmptyID)
Next
End Sub