Inside the STEP File
Products, shapes and tolerances, one record at a time
Preface
This is a book about what is in a STEP file. Not how to parse one — that is a smaller problem than it looks, and there is a formal grammar for it — but what the records mean once you have them: why a single bracket takes three records to name, why a millimetre takes a record with three parts, why the placement of one part inside another takes five records and no numbers, and how a cylinder manages to be a closed solid with only three faces.
It is written for someone who is comfortable with data structures and databases, has opened a STEP file in a text editor, and found it opaque. No mechanical-engineering background is assumed. Where the format cannot be understood without some — boundary representation, NURBS, geometric dimensioning and tolerancing — the background is supplied in place, in boxed sections you can skip if you already have it.
How the book is organised
Part I is about the file and the product. It starts with a complete, real file of 170 records and works through it a record at a time: the syntax, the header, the schema that gives records their meaning, the product identity chain, units, and the path from a product to its shape. It ends with assemblies, which is where most of the interesting structure lives and where most tools get things wrong.
Part II is about geometry. It begins with what a boundary representation is and why topology and geometry are kept separate, then reads a block, a cylinder, a sphere and a spline part line by line. B-splines get a chapter of their own.
Part III covers everything else a file can carry: colours and layers, user properties and validation properties, product manufacturing information (PMI) in both its graphical and semantic forms, the differences between application protocols, and the third edition of the file format.
Each part builds on the last, but the chapters in Part III can be read in any order once Part I is done.
The running example
Most of the book follows one small assembly: a rectangular bracket, 60 by 20 by 10 millimetres with a 6 mm hole through it, and two identical pins, 6 mm in diameter and 30 mm long, standing on the bracket. It is deliberately trivial as a mechanical object. As a STEP file it exercises almost everything the format has: product structure, repeated components, placement transforms, planar and cylindrical faces, seam edges, inner loops, colours, and enough boilerplate to show you what to skim.
The files were produced with Open CASCADE Technology (OCCT), the open-source kernel behind FreeCAD and many commercial tools, rather than by hand; the one exception is the PMI in bracket-pmi.step, written by hand to the CAx Implementor Forum’s recommended practice and checked by reading it back with OCCT. This matters. A hand-written example shows you what the standard permits; a real export shows you what a widely used writer actually does, including the quirks. Where other CAD systems do something different, the text says so.
Every example file is included with the book’s source, in the examples/ directory of the repository, so you can open them beside the text. The drawings of the parts are generated from those same files, so they show what the files contain: dark lines are edges, dots are vertices, and thin grey lines are the outlines of curved faces, which no file records. A listing shows only the records under discussion, but nothing it refers to is out of reach: beneath each one, the HTML edition has a panel with every record the listing points to, directly or through others, and the PDF and EPUB print them too, or, when a listing reaches a whole solid, the records it points to directly.
What is left out
Three things, deliberately.
Parsing. Tokens, lexers and the grammar are covered only as far as needed to read a record. ISO 10303-21 contains the full grammar, and it is not what makes STEP hard.
The constraint language. EXPRESS, the schema language, includes rules and functions for validating data. Readers of files rarely need them, and they would double the length of the schema chapter.
Implementation. This book describes the format. How to store it, index it or write it back out is a different book.
Conventions
Entity types appear exactly as they do in files, in upper case and in a monospaced face: PRODUCT_. Attribute names are in lower case as they appear in the schema: product_. Instance names such as #22 refer to the record with that number in whichever file the surrounding text is discussing; they are file-local and mean nothing across files.
Boxed sections headed Engineering background supply the mechanical-engineering or geometry context for the section that follows. Sections headed In the wild describe what real exporters do that the standard does not say, or says differently. Where those sections name a CAD system, they report what has been observed in files rather than anything the vendor publishes or guarantees, and exporters change. Where the text says a string or a pattern is prescribed, it says whether the schema enforces it or the recommended practices merely ask for it; the two are not the same, and only the first is checkable. Each chapter closes with a short summary headed In brief.
About this book
This book was written as a companion to a series of one-to-one lessons on the STEP format. Every file excerpt in it is real unless the surrounding text says otherwise: the records were written by Open CASCADE Technology 7.9, exporting small parts built for the purpose, and have been edited only in the header’s file name, author and organisation fields, and in the identifier and description of each product. The excerpts for degree units, properties, validation properties, PMI, tessellation and edition-3 sections are written to the published patterns rather than exported, and are marked as such where they appear. The block file is reproduced complete in Appendix A — The Block File, Complete.
The standard itself is ISO 10303. Part numbers cited in the text (Part 21, Part 42, AP242) refer to its parts. Quotations from the standard are paraphrased, not reproduced.
The book is open source. Its text is written in Quarto Markdown and lives at https://github.com/jchultarsky/step-book, where corrections and contributions are welcome.