22. fileread — Read geometry from file in a whole number of formats.

This module defines basic routines to read geometrical data from a file and the specialized importers to read files in a number of well known standardized formats.

The basic routines are very versatile as well as optimized (using the version in the pyFormex C-library) and allow to easily create new exporters for other formats.

22.1. Functions defined in module fileread

fileread.getParams(line)[source]

Strip the parameters from a comment line

fileread.readNodes(fil)[source]

Read a set of nodes from an open mesh file

fileread.readElems(fil, nplex)[source]

Read a set of elems of plexitude nplex from an open mesh file

fileread.readEsets(fil)[source]

Read the eset data of type generate

fileread.readMeshFile(fn)[source]

Read a nodes/elems model from file.

Returns a dict:

  • coords: a Coords with all nodes
  • elems: a list of Connectivities
  • esets: a list of element sets
fileread.extractMeshes(d)[source]

Extract the Meshes read from a .mesh file.

fileread.convertInp(fn)[source]

Convert an Abaqus .inp to a .mesh set of files

fileread.readInpFile(filename)[source]

Read the geometry from an Abaqus/Calculix .inp file

This is a replacement for the convertInp/readMeshFile combination. It uses the ccxinp plugin to provide a direct import of the Finite Element meshes from an Abaqus or Calculix input file. Currently still experimental and limited in functionality (aimed primarily at Calculix). But also many simple meshes from Abaqus can already be read.

Returns an dict.

fileread.read_off(fn)[source]

Read an OFF surface mesh.

The mesh should consist of only triangles! Returns a nodes,elems tuple.

fileread.read_gts(fn)[source]

Read a GTS surface mesh.

Return a coords,edges,faces tuple.

fileread.read_stl_bin(fn)[source]

Read a binary stl.

Parameters:fn (str) – Name of the file to read, holding binary STL data.
Returns:Coords (ntri,4,3) – A Coords with ntri triangles. Each triangle consists of 4 items: the first one is the normal, the other three are the coordinates of the vertices.
fileread.read_gambit_neutral(fn)[source]

Read a triangular surface mesh in Gambit neutral format.

The .neu file nodes are numbered from 1! Returns a nodes,elems tuple.

fileread.read_gambit_neutral_hex(fn)[source]

Read an hexahedral mesh in Gambit neutral format.

The .neu file nodes are numbered from 1! Returns a nodes,elems tuple.