Skip to main content

ANYfileio

Reading and writing structural finite-element interchange files: SESAM formatted FEM (.fem) and SIF (.sif), CalculiX input decks (.inp) and results (.frd, .dat), with a tkinter inspector and a command-line interface.

Install the NumPy-only base with python -m pip install ANYfileio. It provides records, documents, built-in formats, the inspector and CLI, plus CAD-neutral records, backend discovery, and preview artifacts. Version 0.2.0 intentionally does not publish the semantic mesh/material owners or a native CAD provider. Those development-only operations remain source-compatible and fail with typed, truthful diagnostics when their separately managed owners are unavailable.

The repository is ANYfileIO, but anyio on PyPI is the well-known async compatibility library — a transitive dependency of httpx and starlette — and a top-level import package by that name would shadow it. The distribution is therefore ANYfileio and the import package is anyfileio.

Quick start

import anyfileio as io

# Layer 2: what the file means, without interpreting it further.
document = io.read_sesam_fem_document("model.FEM")
len(document.nodes), len(document.elements), document.record_counts["GELMNT1"]

# Layer 3 is source-development-only in 0.2.0; see Development below.
semantics = io.read_sesam_semantics("model.FEM")
semantics.mesh.quads                    # an ANYmesher mesh, file node IDs kept
semantics.materials[1].build()          # an ANYmaterial material
semantics.supports[0].dofs              # ('ux', 'uy', 'uz')

# Results from a run elsewhere.
results = io.parse_frd("case.frd")
results.displacements[42]

# Or just read whatever this is.
io.read("case.dat")

Layers

Each format is read in three layers, and each is useful on its own:

Layer Answers Needs
Records what does the file say? numpy
Document what does it mean? numpy
Semantics what mesh and materials is that? source-development owners (not a 0.2.0 PyPI extra)

Most real questions about a file from another tool stop at the first or second layer — is it well formed, what element types are in it, what does it reference that is missing. Those answers must not require a mesh library, a material library or a solver, and with this layering they do not.

It also means a file can be round-tripped without being understood. Records this package cannot interpret are preserved and rewritten, so canonicalizing a file does not silently delete the parts it did not recognize — the failure mode that makes people distrust converters.

Command line

anyfileio inspect model.FEM

formats, inspect, validate, roundtrip, convert and summary. --json for machine-readable output, --lenient to collect diagnostics instead of failing on the first error. validate exits non-zero on an invalid file, so it works as a check in a build.

anyfileio-gui opens the inspector: the record tree with source line numbers, diagnostics coloured by severity, an element-type histogram, and buttons to save a report or write a canonical copy.

An existing Tk application can open that same inspector without starting a second event loop:

from anyfileio.gui import open_inspector

window, inspector = open_inspector(root, selected_path)

Diagnostics are data

Strict reading raises on the first error. Lenient reading collects FemDiagnostic values — a code, a severity, the record name, the source line range and context — alongside whatever parsed successfully.

Source line numbers are carried from the record layer upwards for one reason: a diagnostic that cannot point at the text that caused it is not actionable on a file of a hundred thousand records.

Severity matters as much as the code. An element referencing a missing node is an error; an element referencing an undefined material is a warning, because the document is still readable and the caller may not care.

What is refused, and why

Semantic SESAM export from an arbitrary model is not implemented, and not because it would be hard. A .fem file is an interchange format: whoever receives one treats it as authoritative. Writing one from a model this package never parsed would produce a file whose fidelity nobody has established, and it would look exactly like a file whose fidelity had been. Round-tripping a parsed document is supported and guarded; synthesis is not offered at all rather than offered with a caveat in a docstring.

The CalculiX deck writer refuses in the same spirit rather than approximating silently: an orthotropic beam (the equivalent rectangular section cannot carry an independent torsional rigidity), an orthotropic shell with no resolved material orientation (a deck without one would quietly align the material with the global axes), and an element set mixing thicknesses (one *SHELL SECTION covers a set, so writing it would mean picking one and losing the other). What it does approximate — a beam section written as an equivalent square — is listed in DeckReport.assumptions, and every report carries execution_mode="not_executed", because a deck that has not been run says nothing about agreement.

Position in the family

The source-development semantic layer of ANYfileio sits above ANYmesher and ANYmaterial and below ANYsolver. The NumPy-only base does not import either semantic package. Semantics hands back a neutral mesh and neutral records; turning those into solver elements is the solver's job. See docs/ARCHITECTURE.md for the layering and MIGRATION.md for what was extracted from where.

Units

SI throughout. A SESAM file declares its own units in its header; those are honoured on read and converted once, at that boundary, so nothing downstream has to know the file was not already SI.

Development

python -m pip install --no-deps -e C:\Github\ANYgeometry
python -m pip install --no-deps -e C:\Github\ANYmaterial
python -m pip install --no-deps -e C:\Github\ANYmesh
python -m pip install -e "C:\Github\ANYfileIO[dev]"
python -m pytest

The 0.2.0 PyPI distribution is the NumPy-only base. Compatible ANYgeometry, ANYmesher, and ANYmaterial checkouts are explicit source-CI and development inputs only; their source tests are not installed-wheel, resolver, or release evidence. Native OCCT-backed CAD operations are likewise deferred. CAD-neutral records and preview artifacts remain part of the released base.

To open the inspector straight from a checkout — including an IDE's Run button — run run_gui.py at the repository root, optionally with a file to open. It bootstraps only this repository's src tree; optional semantic sibling checkouts are never injected into the inspector process.

python run_gui.py model.FEM

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anyfileio-0.2.0.tar.gz (171.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anyfileio-0.2.0-py3-none-any.whl (106.8 kB view details)

Uploaded Python 3

File details

Details for the file anyfileio-0.2.0.tar.gz.

File metadata

  • Download URL: anyfileio-0.2.0.tar.gz
  • Upload date:
  • Size: 171.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for anyfileio-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4a9bd8d813603c9279c46caf2cad8ea81437d8f55ff69a6e1daf81f0c3b8da50
MD5 804273f916c0a3010e6ec7f07b3e7e5a
BLAKE2b-256 22220453a51f689516d45b1c57cd9d4c341021dfab38c166b83ee88031706a01

See more details on using hashes here.

File details

Details for the file anyfileio-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: anyfileio-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 106.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for anyfileio-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b69a7fec345692e6091b3d45e3b1ab9a7966864b8dd33073288f906694ab0fa6
MD5 039801b0715a458e3bc4ae2e8c0e6a9e
BLAKE2b-256 1009d391de82b4ba624437bcb6c578d38eb3f9afb7b6693dc258748e90d33348

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page