2 A First Look at a File
A complete file of 170 records, and how to read any one of them. Instance names, entity types, parameters; strings, references, lists; the two symbols that mean “nothing”; and the one kind of record that breaks the pattern.
The running example begins with the simplest thing worth exporting: a rectangular block, 60 by 20 by 10 millimetres, sitting with one corner at the origin (Figure 2.1).
block.step, drawn from its records: twelve edges and eight vertices.
Open CASCADE writes it as 170 records. Here is the whole file with the middle cut out; the complete listing is in Appendix A.
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('Open CASCADE Model'),'2;1');
FILE_NAME('block.step','2026-09-17T16:14:23',('J. Chultarsky'),('Physna'),
'Open CASCADE STEP processor 7.9','Open CASCADE 7.9','Unknown');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
#1 = APPLICATION_PROTOCOL_DEFINITION('international standard',
'automotive_design',2000,#2);
#2 = APPLICATION_CONTEXT(
'core data for automotive mechanical design processes');
#3 = SHAPE_DEFINITION_REPRESENTATION(#4,#10);
#4 = PRODUCT_DEFINITION_SHAPE('','',#5);
#5 = PRODUCT_DEFINITION('design','',#6,#9);
#6 = PRODUCT_DEFINITION_FORMATION('','',#7);
#7 = PRODUCT('BLOCK','block 60x20x10','',(#8));
#8 = PRODUCT_CONTEXT('',#2,'mechanical');
#9 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');
#10 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#11,#15),#165);
#11 = AXIS2_PLACEMENT_3D('',#12,#13,#14);
#12 = CARTESIAN_POINT('',(0.,0.,0.));
#13 = DIRECTION('',(0.,0.,1.));
#14 = DIRECTION('',(1.,0.,-0.));
#15 = MANIFOLD_SOLID_BREP('',#16);
#16 = CLOSED_SHELL('',(#17,#57,#97,#119,#141,#153));
#17 = ADVANCED_FACE('',(#18),#52,.F.);
#18 = FACE_BOUND('',#19,.F.);
#19 = EDGE_LOOP('',(#20,#30,#38,#46));
#20 = ORIENTED_EDGE('',*,*,#21,.F.);
#21 = EDGE_CURVE('',#22,#24,#26,.T.);
#22 = VERTEX_POINT('',#23);
#23 = CARTESIAN_POINT('',(0.,0.,0.));
/* ... 141 records of faces, edges, vertices and points ... */
#165 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3)
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#169))
GLOBAL_UNIT_ASSIGNED_CONTEXT((#166,#167,#168))
REPRESENTATION_CONTEXT('Context #1','3D Context with UNIT and UNCERTAINTY') );
#166 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#167 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#168 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#169 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#166,
'distance_accuracy_value','confusion accuracy');
#170 = PRODUCT_RELATED_PRODUCT_CATEGORY('part',$,(#7));
ENDSEC;
END-ISO-10303-21;Referred to above: 141 records from block.step
#24 = VERTEX_POINT('',#25);
#25 = CARTESIAN_POINT('',(0.,0.,10.));
#26 = LINE('',#27,#28);
#27 = CARTESIAN_POINT('',(0.,0.,0.));
#28 = VECTOR('',#29,1.);
#29 = DIRECTION('',(0.,0.,1.));
#30 = ORIENTED_EDGE('',*,*,#31,.T.);
#31 = EDGE_CURVE('',#22,#32,#34,.T.);
#32 = VERTEX_POINT('',#33);
#33 = CARTESIAN_POINT('',(0.,20.,0.));
#34 = LINE('',#35,#36);
#35 = CARTESIAN_POINT('',(0.,0.,0.));
#36 = VECTOR('',#37,1.);
#37 = DIRECTION('',(0.,1.,0.));
#38 = ORIENTED_EDGE('',*,*,#39,.T.);
#39 = EDGE_CURVE('',#32,#40,#42,.T.);
#40 = VERTEX_POINT('',#41);
#41 = CARTESIAN_POINT('',(0.,20.,10.));
#42 = LINE('',#43,#44);
#43 = CARTESIAN_POINT('',(0.,20.,0.));
#44 = VECTOR('',#45,1.);
#45 = DIRECTION('',(0.,0.,1.));
#46 = ORIENTED_EDGE('',*,*,#47,.F.);
#47 = EDGE_CURVE('',#24,#40,#48,.T.);
#48 = LINE('',#49,#50);
#49 = CARTESIAN_POINT('',(0.,0.,10.));
#50 = VECTOR('',#51,1.);
#51 = DIRECTION('',(0.,1.,0.));
#52 = PLANE('',#53);
#53 = AXIS2_PLACEMENT_3D('',#54,#55,#56);
#54 = CARTESIAN_POINT('',(0.,0.,0.));
#55 = DIRECTION('',(1.,0.,0.));
#56 = DIRECTION('',(0.,0.,1.));
#57 = ADVANCED_FACE('',(#58),#92,.T.);
#58 = FACE_BOUND('',#59,.T.);
#59 = EDGE_LOOP('',(#60,#70,#78,#86));
#60 = ORIENTED_EDGE('',*,*,#61,.F.);
#61 = EDGE_CURVE('',#62,#64,#66,.T.);
#62 = VERTEX_POINT('',#63);
#63 = CARTESIAN_POINT('',(60.,0.,0.));
#64 = VERTEX_POINT('',#65);
#65 = CARTESIAN_POINT('',(60.,0.,10.));
#66 = LINE('',#67,#68);
#67 = CARTESIAN_POINT('',(60.,0.,0.));
#68 = VECTOR('',#69,1.);
#69 = DIRECTION('',(0.,0.,1.));
#70 = ORIENTED_EDGE('',*,*,#71,.T.);
#71 = EDGE_CURVE('',#62,#72,#74,.T.);
#72 = VERTEX_POINT('',#73);
#73 = CARTESIAN_POINT('',(60.,20.,0.));
#74 = LINE('',#75,#76);
#75 = CARTESIAN_POINT('',(60.,0.,0.));
#76 = VECTOR('',#77,1.);
#77 = DIRECTION('',(0.,1.,0.));
#78 = ORIENTED_EDGE('',*,*,#79,.T.);
#79 = EDGE_CURVE('',#72,#80,#82,.T.);
#80 = VERTEX_POINT('',#81);
#81 = CARTESIAN_POINT('',(60.,20.,10.));
#82 = LINE('',#83,#84);
#83 = CARTESIAN_POINT('',(60.,20.,0.));
#84 = VECTOR('',#85,1.);
#85 = DIRECTION('',(0.,0.,1.));
#86 = ORIENTED_EDGE('',*,*,#87,.F.);
#87 = EDGE_CURVE('',#64,#80,#88,.T.);
#88 = LINE('',#89,#90);
#89 = CARTESIAN_POINT('',(60.,0.,10.));
#90 = VECTOR('',#91,1.);
#91 = DIRECTION('',(0.,1.,0.));
#92 = PLANE('',#93);
#93 = AXIS2_PLACEMENT_3D('',#94,#95,#96);
#94 = CARTESIAN_POINT('',(60.,0.,0.));
#95 = DIRECTION('',(1.,0.,0.));
#96 = DIRECTION('',(0.,0.,1.));
#97 = ADVANCED_FACE('',(#98),#114,.F.);
#98 = FACE_BOUND('',#99,.F.);
#99 = EDGE_LOOP('',(#100,#106,#107,#113));
#100 = ORIENTED_EDGE('',*,*,#101,.F.);
#101 = EDGE_CURVE('',#22,#62,#102,.T.);
#102 = LINE('',#103,#104);
#103 = CARTESIAN_POINT('',(0.,0.,0.));
#104 = VECTOR('',#105,1.);
#105 = DIRECTION('',(1.,0.,0.));
#106 = ORIENTED_EDGE('',*,*,#21,.T.);
#107 = ORIENTED_EDGE('',*,*,#108,.T.);
#108 = EDGE_CURVE('',#24,#64,#109,.T.);
#109 = LINE('',#110,#111);
#110 = CARTESIAN_POINT('',(0.,0.,10.));
#111 = VECTOR('',#112,1.);
#112 = DIRECTION('',(1.,0.,0.));
#113 = ORIENTED_EDGE('',*,*,#61,.F.);
#114 = PLANE('',#115);
#115 = AXIS2_PLACEMENT_3D('',#116,#117,#118);
#116 = CARTESIAN_POINT('',(0.,0.,0.));
#117 = DIRECTION('',(0.,1.,0.));
#118 = DIRECTION('',(0.,0.,1.));
#119 = ADVANCED_FACE('',(#120),#136,.T.);
#120 = FACE_BOUND('',#121,.T.);
#121 = EDGE_LOOP('',(#122,#128,#129,#135));
#122 = ORIENTED_EDGE('',*,*,#123,.F.);
#123 = EDGE_CURVE('',#32,#72,#124,.T.);
#124 = LINE('',#125,#126);
#125 = CARTESIAN_POINT('',(0.,20.,0.));
#126 = VECTOR('',#127,1.);
#127 = DIRECTION('',(1.,0.,0.));
#128 = ORIENTED_EDGE('',*,*,#39,.T.);
#129 = ORIENTED_EDGE('',*,*,#130,.T.);
#130 = EDGE_CURVE('',#40,#80,#131,.T.);
#131 = LINE('',#132,#133);
#132 = CARTESIAN_POINT('',(0.,20.,10.));
#133 = VECTOR('',#134,1.);
#134 = DIRECTION('',(1.,0.,0.));
#135 = ORIENTED_EDGE('',*,*,#79,.F.);
#136 = PLANE('',#137);
#137 = AXIS2_PLACEMENT_3D('',#138,#139,#140);
#138 = CARTESIAN_POINT('',(0.,20.,0.));
#139 = DIRECTION('',(0.,1.,0.));
#140 = DIRECTION('',(0.,0.,1.));
#141 = ADVANCED_FACE('',(#142),#148,.F.);
#142 = FACE_BOUND('',#143,.F.);
#143 = EDGE_LOOP('',(#144,#145,#146,#147));
#144 = ORIENTED_EDGE('',*,*,#31,.F.);
#145 = ORIENTED_EDGE('',*,*,#101,.T.);
#146 = ORIENTED_EDGE('',*,*,#71,.T.);
#147 = ORIENTED_EDGE('',*,*,#123,.F.);
#148 = PLANE('',#149);
#149 = AXIS2_PLACEMENT_3D('',#150,#151,#152);
#150 = CARTESIAN_POINT('',(0.,0.,0.));
#151 = DIRECTION('',(0.,0.,1.));
#152 = DIRECTION('',(1.,0.,0.));
#153 = ADVANCED_FACE('',(#154),#160,.T.);
#154 = FACE_BOUND('',#155,.T.);
#155 = EDGE_LOOP('',(#156,#157,#158,#159));
#156 = ORIENTED_EDGE('',*,*,#47,.F.);
#157 = ORIENTED_EDGE('',*,*,#108,.T.);
#158 = ORIENTED_EDGE('',*,*,#87,.T.);
#159 = ORIENTED_EDGE('',*,*,#130,.F.);
#160 = PLANE('',#161);
#161 = AXIS2_PLACEMENT_3D('',#162,#163,#164);
#162 = CARTESIAN_POINT('',(0.,0.,10.));
#163 = DIRECTION('',(0.,0.,1.));
#164 = DIRECTION('',(1.,0.,0.));Everything that follows in this book is a closer look at some piece of this. For now the aim is to be able to read any single line.
2.1 The skeleton
A Part 21 file written to edition 2, which is nearly all of them, has a fixed outer structure and two sections:
ISO-10303-21;
HEADER;
/* three fixed records describing the file itself */
ENDSEC;
DATA;
/* any number of numbered records: the actual content */
ENDSEC;
END-ISO-10303-21;The HEADER says what the file is: who wrote it, when, and — crucially — which schema its records follow. It has its own chapter. The DATA section is the payload: a set of records, each with a number, that reference one another to form a graph. There is nothing else in an edition 2 file; the sections edition 3 added are in Chapter 18. Line breaks and tabs are ignored everywhere, even inside a string, so a long record or a long string may be split across lines without changing what it means. The space character is the only whitespace that separates tokens, and inside a string it is data. The exporter above wraps long records at 72 columns because an old convention says so, and many do not.
Comments are allowed anywhere whitespace is, delimited /* ... */. Real files almost never contain them; the ones above were added for the listing.
2.2 Reading a record
Take one line:
#7 = PRODUCT('BLOCK','block 60x20x10','',(#8));Referred to above: 2 records from block.step
#2 = APPLICATION_CONTEXT(
'core data for automotive mechanical design processes');
#8 = PRODUCT_CONTEXT('',#2,'mechanical');Read it as a row from a database dump.
#7is the record’s instance name — its ID. It is unique within this file and means nothing outside it. Other records refer to this one by writing#7. There is no significance to the number itself; exporters assign them in whatever order they happen to write things, and a file that renumbered every record would be the same file.PRODUCTis the entity type — the table name. Somewhere in the schema is a definition ofproductlisting its attributes in order.- Everything inside the parentheses is the parameter list: the column values, in schema order. Here there are four.
;ends the record.
So #7 says: there is a PRODUCT whose four attribute values are the string 'BLOCK', the string 'block 60x20x10', an empty string, and a list containing a reference to record #8. What those four columns mean — identifier, name, description, list of contexts — is in the schema, and Chapter 4 shows how to look it up. For now, the shape.
A note on terminology, since two words are used for the same slots. In the file, the values in the parentheses are parameters. In the schema, the slots they fill are attributes. PRODUCT has four attributes; record #7 supplies four parameters. Same slots, seen from the two ends.
2.3 The kinds of value
Every parameter is one of a small number of things. The block file contains all of them but the binary.
Strings are single-quoted: 'BLOCK', 'design', ''. An apostrophe inside a string is doubled: 'Julian''s bracket'. A file declaring '2;1' or '3;1' must spell anything above ASCII with an escape sequence — \X2\00C5\X0\ for Å. Edition 3 made UTF-8 the encoding of the whole file, so a file declaring '4;1' may write Å directly. Many exporters write raw UTF-8 while still declaring '2;1', and most readers accept it. Nearly every entity in a mechanical file begins with a name attribute, and nearly every exporter leaves it empty, which is why '' opens so many records.
References are instance names used as values: the #8 in (#8), the #16 in MANIFOLD_. A reference is a pointer to another record in the same file. They can point forward to records not yet seen — #3 refers to #10, seven lines later — and the file is a set of records, not a sequence, so this is normal.
Lists are parenthesised, comma-separated: (#11,#15), (0.,0.,0.), (#17,#57,#97,#119,#141,#153). A list with one element is still a list: (#8). Lists nest: ((#11,#12),(#13,#14)) is a list of two lists. Whether a given list is a SET or a LIST or an ARRAY — ordered, unordered, bounded — is the schema’s business; the file writes them all the same way.
Reals always contain a decimal point: 0., 1., -0., 1.E-07. The trailing-dot form 10. is standard and ubiquitous. 1.E-07 is one ten-millionth. -0. is negative zero, which the exporter wrote because that is what came out of its floating-point arithmetic; it is harmless and you will see a lot of it.
Integers have no decimal point: the 3 in GEOMETRIC_, the 2000 in #1. A parameter that is a real is never written as an integer, so 3 and 3. are different tokens for different attribute types.
Enumerations are upper-case names between dots: .T., .F., .MILLI., .METRE., .RADIAN.. The two most common are the Booleans, .T. and .F.. EXPRESS counts BOOLEAN as a simple type, but Part 21 encodes it as an enumeration value and fixes the spelling at the single character T or F, so .TRUE. is not a legal spelling of one. Enumeration values come from a fixed list in the schema — .MILLI. is one of the sixteen SI prefixes the schema defines.
Binary values are hexadecimal in double quotes, with one extra leading digit: "0F3A". That first digit is not data — it counts the zero bits added on the left so the bits divide evenly into groups of four, so "0F3A" is the twelve bits F3A. They do not occur in this file, and are rare in mechanical files generally; you meet them in PMI for encoded text and in a few presentation entities.
Wrapped values are a type name with one value in parentheses: the LENGTH_ in #169. Part 21 requires the wrapper whenever an attribute’s schema type is a choice and the value chosen is a number, a string or an enumeration rather than a reference, so that a reader knows which choice was taken. Chapter 4 gives the rule.
Two symbols remain, and they are the ones that trip people up.
2.4 $ and *
$ means no value. The attribute is optional in the schema and this record does not supply it. In SI_ the first attribute is the prefix — .MILLI. in the millimetre record on the line above — and a plain radian has none. In PRODUCT_ the description is absent.
* holds the place of an attribute that the entity inherited as a stored value but that its own type recomputes. An attribute that is derived from the start takes no slot at all and is simply not written; it is only a redeclared one that leaves a gap to fill. In NAMED_ the attribute is dimensions, and an SI unit knows its own dimensions from its name. In ORIENTED_ the second and third attributes — the edge’s start and end vertices — are derived from the edge it refers to and the orientation flag.
$ and '' are different. '' is a string with no characters in it; $ is the absence of a string. PRODUCT_ has an empty description; PRODUCT_ would have no description. The schema treats these differently, exporters are inconsistent about which they write for a blank field, and a tool that cares about descriptions has to handle both. Most tools do not care.
2.5 References point from specific to general
Look again at the first nine data records and note the direction of every reference.
#3 = SHAPE_DEFINITION_REPRESENTATION(#4,#10);
#4 = PRODUCT_DEFINITION_SHAPE('','',#5);
#5 = PRODUCT_DEFINITION('design','',#6,#9);
#6 = PRODUCT_DEFINITION_FORMATION('','',#7);
#7 = PRODUCT('BLOCK','block 60x20x10','',(#8));
#8 = PRODUCT_CONTEXT('',#2,'mechanical');
#9 = PRODUCT_DEFINITION_CONTEXT('part definition',#2,'design');Referred to above: 161 records from block.step
#2 = APPLICATION_CONTEXT(
'core data for automotive mechanical design processes');
#10 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#11,#15),#165);
#11 = AXIS2_PLACEMENT_3D('',#12,#13,#14);
#12 = CARTESIAN_POINT('',(0.,0.,0.));
#13 = DIRECTION('',(0.,0.,1.));
#14 = DIRECTION('',(1.,0.,-0.));
#15 = MANIFOLD_SOLID_BREP('',#16);
#16 = CLOSED_SHELL('',(#17,#57,#97,#119,#141,#153));
#17 = ADVANCED_FACE('',(#18),#52,.F.);
#18 = FACE_BOUND('',#19,.F.);
#19 = EDGE_LOOP('',(#20,#30,#38,#46));
#20 = ORIENTED_EDGE('',*,*,#21,.F.);
#21 = EDGE_CURVE('',#22,#24,#26,.T.);
#22 = VERTEX_POINT('',#23);
#23 = CARTESIAN_POINT('',(0.,0.,0.));
#24 = VERTEX_POINT('',#25);
#25 = CARTESIAN_POINT('',(0.,0.,10.));
#26 = LINE('',#27,#28);
#27 = CARTESIAN_POINT('',(0.,0.,0.));
#28 = VECTOR('',#29,1.);
#29 = DIRECTION('',(0.,0.,1.));
#30 = ORIENTED_EDGE('',*,*,#31,.T.);
#31 = EDGE_CURVE('',#22,#32,#34,.T.);
#32 = VERTEX_POINT('',#33);
#33 = CARTESIAN_POINT('',(0.,20.,0.));
#34 = LINE('',#35,#36);
#35 = CARTESIAN_POINT('',(0.,0.,0.));
#36 = VECTOR('',#37,1.);
#37 = DIRECTION('',(0.,1.,0.));
#38 = ORIENTED_EDGE('',*,*,#39,.T.);
#39 = EDGE_CURVE('',#32,#40,#42,.T.);
#40 = VERTEX_POINT('',#41);
#41 = CARTESIAN_POINT('',(0.,20.,10.));
#42 = LINE('',#43,#44);
#43 = CARTESIAN_POINT('',(0.,20.,0.));
#44 = VECTOR('',#45,1.);
#45 = DIRECTION('',(0.,0.,1.));
#46 = ORIENTED_EDGE('',*,*,#47,.F.);
#47 = EDGE_CURVE('',#24,#40,#48,.T.);
#48 = LINE('',#49,#50);
#49 = CARTESIAN_POINT('',(0.,0.,10.));
#50 = VECTOR('',#51,1.);
#51 = DIRECTION('',(0.,1.,0.));
#52 = PLANE('',#53);
#53 = AXIS2_PLACEMENT_3D('',#54,#55,#56);
#54 = CARTESIAN_POINT('',(0.,0.,0.));
#55 = DIRECTION('',(1.,0.,0.));
#56 = DIRECTION('',(0.,0.,1.));
#57 = ADVANCED_FACE('',(#58),#92,.T.);
#58 = FACE_BOUND('',#59,.T.);
#59 = EDGE_LOOP('',(#60,#70,#78,#86));
#60 = ORIENTED_EDGE('',*,*,#61,.F.);
#61 = EDGE_CURVE('',#62,#64,#66,.T.);
#62 = VERTEX_POINT('',#63);
#63 = CARTESIAN_POINT('',(60.,0.,0.));
#64 = VERTEX_POINT('',#65);
#65 = CARTESIAN_POINT('',(60.,0.,10.));
#66 = LINE('',#67,#68);
#67 = CARTESIAN_POINT('',(60.,0.,0.));
#68 = VECTOR('',#69,1.);
#69 = DIRECTION('',(0.,0.,1.));
#70 = ORIENTED_EDGE('',*,*,#71,.T.);
#71 = EDGE_CURVE('',#62,#72,#74,.T.);
#72 = VERTEX_POINT('',#73);
#73 = CARTESIAN_POINT('',(60.,20.,0.));
#74 = LINE('',#75,#76);
#75 = CARTESIAN_POINT('',(60.,0.,0.));
#76 = VECTOR('',#77,1.);
#77 = DIRECTION('',(0.,1.,0.));
#78 = ORIENTED_EDGE('',*,*,#79,.T.);
#79 = EDGE_CURVE('',#72,#80,#82,.T.);
#80 = VERTEX_POINT('',#81);
#81 = CARTESIAN_POINT('',(60.,20.,10.));
#82 = LINE('',#83,#84);
#83 = CARTESIAN_POINT('',(60.,20.,0.));
#84 = VECTOR('',#85,1.);
#85 = DIRECTION('',(0.,0.,1.));
#86 = ORIENTED_EDGE('',*,*,#87,.F.);
#87 = EDGE_CURVE('',#64,#80,#88,.T.);
#88 = LINE('',#89,#90);
#89 = CARTESIAN_POINT('',(60.,0.,10.));
#90 = VECTOR('',#91,1.);
#91 = DIRECTION('',(0.,1.,0.));
#92 = PLANE('',#93);
#93 = AXIS2_PLACEMENT_3D('',#94,#95,#96);
#94 = CARTESIAN_POINT('',(60.,0.,0.));
#95 = DIRECTION('',(1.,0.,0.));
#96 = DIRECTION('',(0.,0.,1.));
#97 = ADVANCED_FACE('',(#98),#114,.F.);
#98 = FACE_BOUND('',#99,.F.);
#99 = EDGE_LOOP('',(#100,#106,#107,#113));
#100 = ORIENTED_EDGE('',*,*,#101,.F.);
#101 = EDGE_CURVE('',#22,#62,#102,.T.);
#102 = LINE('',#103,#104);
#103 = CARTESIAN_POINT('',(0.,0.,0.));
#104 = VECTOR('',#105,1.);
#105 = DIRECTION('',(1.,0.,0.));
#106 = ORIENTED_EDGE('',*,*,#21,.T.);
#107 = ORIENTED_EDGE('',*,*,#108,.T.);
#108 = EDGE_CURVE('',#24,#64,#109,.T.);
#109 = LINE('',#110,#111);
#110 = CARTESIAN_POINT('',(0.,0.,10.));
#111 = VECTOR('',#112,1.);
#112 = DIRECTION('',(1.,0.,0.));
#113 = ORIENTED_EDGE('',*,*,#61,.F.);
#114 = PLANE('',#115);
#115 = AXIS2_PLACEMENT_3D('',#116,#117,#118);
#116 = CARTESIAN_POINT('',(0.,0.,0.));
#117 = DIRECTION('',(0.,1.,0.));
#118 = DIRECTION('',(0.,0.,1.));
#119 = ADVANCED_FACE('',(#120),#136,.T.);
#120 = FACE_BOUND('',#121,.T.);
#121 = EDGE_LOOP('',(#122,#128,#129,#135));
#122 = ORIENTED_EDGE('',*,*,#123,.F.);
#123 = EDGE_CURVE('',#32,#72,#124,.T.);
#124 = LINE('',#125,#126);
#125 = CARTESIAN_POINT('',(0.,20.,0.));
#126 = VECTOR('',#127,1.);
#127 = DIRECTION('',(1.,0.,0.));
#128 = ORIENTED_EDGE('',*,*,#39,.T.);
#129 = ORIENTED_EDGE('',*,*,#130,.T.);
#130 = EDGE_CURVE('',#40,#80,#131,.T.);
#131 = LINE('',#132,#133);
#132 = CARTESIAN_POINT('',(0.,20.,10.));
#133 = VECTOR('',#134,1.);
#134 = DIRECTION('',(1.,0.,0.));
#135 = ORIENTED_EDGE('',*,*,#79,.F.);
#136 = PLANE('',#137);
#137 = AXIS2_PLACEMENT_3D('',#138,#139,#140);
#138 = CARTESIAN_POINT('',(0.,20.,0.));
#139 = DIRECTION('',(0.,1.,0.));
#140 = DIRECTION('',(0.,0.,1.));
#141 = ADVANCED_FACE('',(#142),#148,.F.);
#142 = FACE_BOUND('',#143,.F.);
#143 = EDGE_LOOP('',(#144,#145,#146,#147));
#144 = ORIENTED_EDGE('',*,*,#31,.F.);
#145 = ORIENTED_EDGE('',*,*,#101,.T.);
#146 = ORIENTED_EDGE('',*,*,#71,.T.);
#147 = ORIENTED_EDGE('',*,*,#123,.F.);
#148 = PLANE('',#149);
#149 = AXIS2_PLACEMENT_3D('',#150,#151,#152);
#150 = CARTESIAN_POINT('',(0.,0.,0.));
#151 = DIRECTION('',(0.,0.,1.));
#152 = DIRECTION('',(1.,0.,0.));
#153 = ADVANCED_FACE('',(#154),#160,.T.);
#154 = FACE_BOUND('',#155,.T.);
#155 = EDGE_LOOP('',(#156,#157,#158,#159));
#156 = ORIENTED_EDGE('',*,*,#47,.F.);
#157 = ORIENTED_EDGE('',*,*,#108,.T.);
#158 = ORIENTED_EDGE('',*,*,#87,.T.);
#159 = ORIENTED_EDGE('',*,*,#130,.F.);
#160 = PLANE('',#161);
#161 = AXIS2_PLACEMENT_3D('',#162,#163,#164);
#162 = CARTESIAN_POINT('',(0.,0.,10.));
#163 = DIRECTION('',(0.,0.,1.));
#164 = DIRECTION('',(1.,0.,0.));
#165 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3)
GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#169)) GLOBAL_UNIT_ASSIGNED_CONTEXT
((#166,#167,#168)) REPRESENTATION_CONTEXT('Context #1',
'3D Context with UNIT and UNCERTAINTY') );
#166 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#167 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#168 = ( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#169 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-07),#166,
'distance_accuracy_value','confusion accuracy');#6 points at #7; #5 points at #6; #4 points at #5. The version knows which product it is a version of. The product has no idea that any versions exist. References in a STEP file run this way: from the more specific or dependent thing toward the more general or independent one, a shell to the faces it is made of as much as a version to its product. A face points at its surface; the surface does not list its faces. An edge points at its vertices; the vertex does not know which edges meet there.
The consequence is that almost every interesting question — “what does this product look like?”, “which faces use this surface?”, “which assemblies contain this part?” — starts at the general end and has to walk against the arrows. Nothing in the file helps with that; it is the reader’s job to build the reverse index. This is the single most important structural fact about the format, and the reason a STEP file cannot be usefully processed one line at a time.
2.6 Complex records
Every record so far has had one entity type. Four records near the end have several:
#166 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );The pattern: after #166 = comes an opening parenthesis, then a sequence of type-name-with-parameters groups, with no commas between them, then a closing parenthesis. This is a complex entity instance, and it describes one object that is several entity types at once. #166 is a LENGTH_ and a NAMED_ and an SI_. Each group carries the attributes that its own type declares: LENGTH_ declares none, NAMED_ declares one, dimensions, which SI_ redeclares as derived — hence the * — and SI_ declares two of its own, prefix and name.
Why an object would need to be three types at once, why the groups are in alphabetical order, and why the file does not simply say SI_ and let you infer the rest, are questions about the schema, and they are answered in Chapter 4. The point here is to recognise the form when you see it. Two rules of thumb: a complex record is always about something that has both a general classification and a specific one — a unit that is both “a named unit” and “a length unit”; and the records that most often take this form are units, representation contexts, and the relationship records that position parts in assemblies.
2.7 What the block file contains
Standing back from the syntax, the 170 records fall into five groups, and the same five groups appear in every single-part STEP file in roughly the same proportions.
| Records | Group | What it says |
|---|---|---|
#1–#2 |
Application context | “This is mechanical design data under AP214.” |
#3–#9 |
Product identity | “There is a part called BLOCK, one version, design view, and it has a shape.” |
#10–#16 |
Shape representation and solid | “The shape is this B-rep solid, in this coordinate system.” |
#17–#164 |
Topology and geometry | Six faces, twelve edges, eight vertices, and their planes, lines and points. |
#165–#170 |
Context, units, category | “Millimetres, radians; points closer than \(10^{-7}\) mm coincide; it’s a part.” |
The proportions are the thing to notice. Nine records establish what the part is; a hundred and fifty describe its shape; six say how to measure it. In a real part with a few hundred faces the geometry becomes 99% of the file, and the product-identity records — the ones that carry the part number, the version and the assembly structure — become a few dozen lines scattered through a hundred thousand.
A record is #id = TYPE(parameters);. Parameters are strings, references, lists, reals, integers, enumerations or binaries; $ is an absent optional value and * a derived one. References point from the dependent thing to the one it depends on, so finding what is attached to a product means walking against the arrows. A record beginning #id = ( is one object with several types.