spinfireapi Python Package Overview
This section documents the spinfireapi Python package that ships with SpinFire’s scripting engine, along with the sample script that demonstrates its use. The package exposes a set of utility modules that wrap the underlying SpinFire.Scripting.API.Utilities .NET layer (accessed via clr/pythonnet) so that SpinFire scripts can be written in plain Python.
Note
New to scripting? Start with Getting Started with spinfireapi, which walks you through running your first script.
Why It Exists
SpinFire Insight’s scripting feature lets technically minded users write Python scripts that automate repetitive tasks and capture information from models in a repeatable way, such as measuring geometry, querying assembly properties, or exporting images and section profiles. spinfireapi is the layer that makes this possible: it turns SpinFire’s .NET scripting utilities into ordinary Python functions, so script authors don’t need to deal with the .NET API directly.
How It Fits Together
A script imports spinfirescript (not the individual sub-modules), which re-exports every function below and pulls in spinfirecontext for the active ScriptManager. Note that spinfirescript and spinfirecontext are separate top-level modules that sit alongside the spinfireapi package, not inside it (see Files). See spinfirescript.py — Script Module and spinfirecontext.py — Context Module for the detail on each.
Modules
The spinfireapi package contains six modules. The Packages page lists them alongside spinfirescript, spinfirecontext and the sample script.
application.py — Application Module — opening and closing SpinFire files
selection.py — Selection Module — interactive selection of points, edges and surfaces
geometry.py — Geometry Module — creating/deleting user geometry: lines, polylines, shells
graphics.py — Graphics Module — screenshots, image export, file import and save, coordinate systems, item visibility, standard views
sectionplanes.py — Section Planes Module — section plane toggling, moving, rotating and cut-profile export
assemblyitems.py — Assembly Items Module — tree/assembly item queries and transforms (select, rename, move, rotate, scale, color, render mode, bounding box)
Note
Where file functions live: application.py only opens and closes files (OpenFile, OpenFiles, CloseFile). Importing and saving (ImportFile, SaveFile, SaveCurrentFile) are in graphics.py. Since everything is reachable as sfs.FunctionName, this only matters when you’re looking something up in the docs.
__init__.py marks spinfireapi as a package and contains only a docstring — it isn’t separately documented.
To look up a function by name across all modules, use the Function Index (A–Z). For every enum and class defined across these modules, see Classes. For how each doc page maps to the actual .py file, see Files.
Sample Scripts
The built-in worked example, Sample Script — Calculate Cylindrical Radius, shows how these modules are combined in a real script (surface selection, NumPy-based geometry math, and console output). It sits under Script Samples, alongside fifteen more example scripts that cover every module.