🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to export a geometry mesh from CADFEKO using a LUA script

User: "Ricardo Sendrea"
Altair Community Member
Updated by unknown

Hello,

I'd like to use FEKO to create the mesh of my geometry. Then, through the CADFEKO Scripting API, export the mesh in a custom format. I am familiar with how to do this through POSTFEKO, but I do not want to run the FEKO solver. I would like to simply run the mesher and export the mesh. I need all the X, Y, and Z values of the mesh points, and the connectivity matrix. Can someone help me with this?

Thanks,

Ricardo

Find more posts tagged with

Sort by:
1 - 3 of 31
    User: "Mel"
    Altair Employee
    Updated by Mel

    Have you tried script recording?

    For example, recording the export of a Nastran mesh gives:

    -- CADFEKO v2021.2.1-10137 (x64) app = cf.GetApplication() project = app.Project  --- Mesh export --- project.Exporter.Mesh.ExportFileFormat = cf.Enums.ExportFileFormatEnum.NASTRAN  project.Exporter.Mesh.ExportMeshType = cf.Enums.ExportMeshTypeEnum.SimulationMesh  project.Exporter.Mesh.ExportOnlyBoundingFacesEnabled = false  project.Exporter.Mesh.ScaleToMetreEnabled = true  Union1 = project.Geometry["Union1"] geometryTargets = { Union1 }  meshTargets = {  }  project.Exporter.Mesh:ExportParts("C:/Temp/mesh_Export_nastran.nas",geometryTargets,meshTargets)

    The Nastran mesh file contents:

    $ NASTRAN file exported by CADFEKO version 2021.2.1-10137 (x64) $ $ Filename: C:/Temp/mesh_Export_nastran.nas $ Date:     Tue Oct 12 2021 $ $ Number of segments:             0 $           triangles:        33808 $           cuboids:              0 $           tetrahedra:           0 GRID*                  1                 2.331719118E-04 0.000000000E+00       1 *      1 0.000000000E+00 GRID*                  2                 2.331719118E-04 2.331719118E-04       2 *      2 0.000000000E+00 GRID*                  3                 1.888222675E-04 1.319775054E-04       3 *      3-1.368038441E-04 GRID*                  4                 1.634252528E-04 2.862700521E-04       4 *      4-1.663169480E-04
    User: "Ricardo Sendrea"
    Altair Community Member
    OP
    Updated by unknown

    Have you tried script recording?

    For example, recording the export of a Nastran mesh gives:

    -- CADFEKO v2021.2.1-10137 (x64) app = cf.GetApplication() project = app.Project  --- Mesh export --- project.Exporter.Mesh.ExportFileFormat = cf.Enums.ExportFileFormatEnum.NASTRAN  project.Exporter.Mesh.ExportMeshType = cf.Enums.ExportMeshTypeEnum.SimulationMesh  project.Exporter.Mesh.ExportOnlyBoundingFacesEnabled = false  project.Exporter.Mesh.ScaleToMetreEnabled = true  Union1 = project.Geometry["Union1"] geometryTargets = { Union1 }  meshTargets = {  }  project.Exporter.Mesh:ExportParts("C:/Temp/mesh_Export_nastran.nas",geometryTargets,meshTargets)

    The Nastran mesh file contents:

    $ NASTRAN file exported by CADFEKO version 2021.2.1-10137 (x64) $ $ Filename: C:/Temp/mesh_Export_nastran.nas $ Date:     Tue Oct 12 2021 $ $ Number of segments:             0 $           triangles:        33808 $           cuboids:              0 $           tetrahedra:           0 GRID*                  1                 2.331719118E-04 0.000000000E+00       1 *      1 0.000000000E+00 GRID*                  2                 2.331719118E-04 2.331719118E-04       2 *      2 0.000000000E+00 GRID*                  3                 1.888222675E-04 1.319775054E-04       3 *      3-1.368038441E-04 GRID*                  4                 1.634252528E-04 2.862700521E-04       4 *      4-1.663169480E-04

    Hi,

     

    I tried this approach, but I would have liked to be able to export that same mesh information in a custom '.txt' format. In any case, I appreciate the insight, as I am able to use this approach in my project.

     

    Thanks!

    User: "Mel"
    Altair Employee
    Updated by Mel

    Another option is to export the mesh to the *.out file and use the "check-geometry" mode of the solver which runs very quickly. 

    Check the box below.

    image

    Then check the box "Only check the geomery" below:

    image

    When you run Feko, it will only check the geometry but nothing will be solved. The geometry will be written to the ASCII out file:

                             DATA OF THE METALLIC TRIANGLES   no.       label     x1 in m     y1 in m     z1 in m       edges            medium     x2 in m     y2 in m     z2 in m           medium     x3 in m     y3 in m     z3 in m                        nx          ny          nz          area in m*m         1 Cuboid   8.4049E-01  5.0000E-01  1.0000E+00            1         2         3            Free s   1.0000E+00  4.0000E-01  1.0000E+00           Free s   1.0000E+00  6.0000E-01  1.0000E+00                    0.0000E+00  0.0000E+00  1.0000E+00      1.5951E-02         2 Cuboid   8.2683E-01  6.9206E-01  1.0000E+00            4         5         6            Free s   1.0000E+00  6.0000E-01  1.0000E+00           Free s   1.0000E+00  8.0000E-01  1.0000E+00                    0.0000E+00  0.0000E+00  1.0000E+00      1.7317E-02         3 Cuboid   1.4440E-01  1.2741E-01  1.0000E+00            7         8         9            Free s   1.7399E-01  3.0388E-01  1.0000E+00           Free s   0.0000E+00  2.0000E-01  1.0000E+00

    and

      DATA OF THE METALLIC EDGES (with MoM)                                              triangle no.   points of tr.     information on symmetry     no.  type      length/m        media     KORP   KORM   POIP   POIM      yz     xz     xy  status         1   1    1.8827E-01  Free s     -1      1     19      2      1       0      0      0  unknown           2   1    1.8827E-01  Free s     -1      1     26      3      1       0      0      0  unknown           3   1    2.0000E-01  Free s     -1      1    370      1      1       0      0      0  unknown           4   1    1.9612E-01  Free s     -1      2     19      3      2       0      0      0  unknown  

    Data for segments:

     DATA OF THE SEGMENTS   no.       label     x1 in m     y1 in m     z1 in m      nodes            medium     x2 in m     y2 in m     z2 in m    length in m  radius in m                      x3 in m     y3 in m     z3 in m         1 Line1.   2.0000E+00  0.0000E+00  0.0000E+00           1                                          Free s   2.0000E+00  2.0000E-01  0.0000E+00   2.0000E-01   1.0000E-03                    2.0000E+00  1.0000E-01  0.0000E+00         2 Line1.   2.0000E+00  2.0000E-01  0.0000E+00          -1         2                                Free s   2.0000E+00  4.0000E-01  0.0000E+00   2.0000E-01   1.0000E-03                    2.0000E+00  3.0000E-01  0.0000E+00

    See the Altair_Feko_User_Guide.pdf for more information.