Creating nodes in femap from excel

I have a list of co-ordinates in excel. I need to create nodes in femap at these co-ordinates. Is there a way FEMAP can extract these co-ordinates from excel and create the nodes ?

Re: Creating nodes in femap from excel

Siemens Phenom Siemens Phenom
Siemens Phenom

While Excel is open, you can use "GetObject" to attach to the first running instance (a COM requirement).   The example script will attach to the open Excel and if your coordinates are in the format as shown in the below image, nodes will be created.  Note that "lastRow" is hard-coded and can be manually updated or otherwise written in a way that checks the number of Rows.


Don't forget to right-click in the FEMAP API pane and include the Microsoft Excel reference.


See this post about something similar, going from Excel to FEMAP.







Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim appExcel As Excel.Application
    Set appExcel = GetObject(,"Excel.Application")

    Dim wb As Excel.Workbook
    Dim ws As Excel.Worksheet

    Set wb = appExcel.ActiveWorkbook
    Set ws = wb.ActiveSheet

    Dim excelArray As Variant

    Row = 2
    lastRow = 11
    Col = 1

    excelArray = ws.Range( ws.Cells(Row,Col) , ws.Cells(lastRow,Col+3) ).Value2

    Dim n As femap.Node
    Set n = App.feNode

    For i = 1 To lastRow-1
        n.ID = excelArray(i, 1)
        n.x = excelArray(i, 2)
        n.y = excelArray(i, 3)
        n.z = excelArray(i, 4)
        n.Put( n.ID )
    Next i

    App.feViewRegenerate( 0 )

    Set appExcel = Nothing

End Sub