ruststep/
lib.rs

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