Skip to main content

step_p21/
lib.rs

1//! step_p21 is a crate for reading and writing ASCII encoding of exchange
2//! structure, a.k.a. STEP file, and for mapping them into Rust structs
3//! generated by [step_p11](../step_p11/index.html) compiler.
4//!
5//! This crate also contains generated code as sub-modules for following
6//! schemas:
7//!
8//! - [ISO 10303-201 "Part 201: Application protocol: Explicit draughting"](https://www.iso.org/standard/20595.html)
9//! - [ISO 10303-203 "Part 203: Application protocol: Configuration controlled 3D design of mechanical parts and assemblies"](https://www.iso.org/standard/44305.html)
10//!
11//! They are compiled only when the `features` are enabled in cargo to keep
12//! compile faster:
13//!
14//! ```toml
15//! [dependencies]
16//! step-p21 = "0.5"
17//! ```
18//!
19//! These features are not default.
20//!
21//! ASCII encoding of exchange structure
22//! -------------------------------------
23//!
24//! ASCII encoding of exchange structure is defined in
25//! [ISO-10303-21 "Part 21: Implementation methods: Clear text encoding of the exchange structure"](https://www.iso.org/standard/63141.html).
26//! This ISO document contains an example in section Annex H "Example of a
27//! complete exchange structure":
28//!
29//! ```text
30//! ISO-10303-21; /* start exchange structure */
31//!
32//! HEADER; /* start header section */
33//!
34//!   FILE_DESCRIPTION(
35//!     ('THIS FILE CONTAINS A SMALL SAMPLE STEP MODEL'),
36//!     '3;1'
37//!   );
38//!
39//!   FILE_NAME(
40//!     'EXAMPLE STEP FILE #1',
41//!     '2013-02-11T15:30:00',
42//!     ('JOHN DOE', 'ACME INC.', 'METROPOLIS USA'),
43//!     ('ACME INC. A SUBSIDIARY OF GIANT INDUSTRIES', 'METROPOLIS USA'),
44//!     'CIM/STEP VERSION2',
45//!     'SUPER CIM SYSTEM RELEASE 4.0',
46//!     'APPROVED BY JOE BLOGGS'
47//!   );
48//!
49//!   FILE_SCHEMA(('EXAMPLE_GEOMETRY'));
50//!
51//! ENDSEC; /* end header section */
52//!
53//! DATA; /* start data section */
54//!
55//!   /* The following 13 entities represent a triangular edge loop */
56//!
57//!   /* cartesian point entity */
58//!   #1 = CPT(0.0, 0.0, 0.0);
59//!   #2 = CPT(0.0, 1.0, 0.0);
60//!   #3 = CPT(1.0, 0.0, 0.0);
61//!
62//!   /* vertex entity */
63//!   #11 = VX(#1);
64//!   #12 = VX(#2);
65//!   #13 = VX(#3);
66//!
67//!   /* edge entity */
68//!   #16 = ED(#11, #12);
69//!   #17 = ED(#11, #13);
70//!   #18 = ED(#13, #12);
71//!
72//!   /* edge logical structure entity */
73//!   #21 = ED_STRC(#17, .F.);
74//!   #22 = ED_STRC(#18, .F.);
75//!   #23 = ED_STRC(#16, .T.);
76//!
77//!   /* edge loop entity */
78//!   #24 = ED_LOOP((#21, #22, #23));
79//!
80//! ENDSEC; /* end data section */
81//!
82//! END-ISO-10303-21; /* end exchange structure */
83//! ```
84//!
85//! Spaces, indent, and comments are modified for better understanding.
86//! This tells us what consists of exchange structure:
87//!
88//! - It starts with `ISO-10303-21;` and ends with `END-ISO-10303-21;`.
89//! - It contains `HEADER` and `DATA` sections.
90//! - `HEADER` section has three components `FILE_DESCRIPTION`, `FILE_NAME`, and
91//!   `FILE_SCHEMA`.
92//!   - See [header] module document for detail.
93//! - Each data is in form `TYPE_NAME(parameter1, ...)`.
94//!   - This is called "Record".
95//!   - Each records is bounded by a number.
96//!   - Parameter can be
97//!     - Floating number, e.g. `0.0`
98//!     - String, e.g. `'EXAMPLE STRING'`
99//!     - List, e.g. `(1.0, 2.0)`
100//!     - Enum value, e.g. `.T.` (means true), `.F.` (means false)
101//!     - Reference, e.g. `#1`
102//! - Actual data, triangular geometry in this example, is stored in `DATA`
103//!   section.
104//!
105//! See the module document of [parser] for detail.
106//!
107//! XML interoperation
108//! -------------------
109//! STEP implementation using XML(eXtensible Markup Language) is defined in
110//! [ISO-10303-28](https://www.iso.org/standard/40646.html).
111//!
112//! Not supported yet. See [tracking issue](https://github.com/ricosjp/ruststep/issues/215).
113
114#![deny(rustdoc::broken_intra_doc_links)]
115
116pub mod ast;
117pub mod error;
118pub mod header;
119pub mod parser;
120pub mod primitive;
121pub mod tables;
122
123// To work generated code by step_p21-derive only with step_p21
124pub use derive_more;
125pub use itertools;
126pub use serde;
127
128pub use step_p21_derive::*;