@ifc-lite/codegen 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +23 -5
- package/dist/cli.js.map +1 -1
- package/dist/crc32.d.ts +16 -0
- package/dist/crc32.d.ts.map +1 -0
- package/dist/crc32.js +69 -0
- package/dist/crc32.js.map +1 -0
- package/dist/generator.d.ts +20 -4
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +175 -19
- package/dist/generator.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/rust-generator.d.ts +20 -0
- package/dist/rust-generator.d.ts.map +1 -0
- package/dist/rust-generator.js +640 -0
- package/dist/rust-generator.js.map +1 -0
- package/dist/serialization-generator.d.ts +11 -0
- package/dist/serialization-generator.d.ts.map +1 -0
- package/dist/serialization-generator.js +333 -0
- package/dist/serialization-generator.js.map +1 -0
- package/dist/type-ids-generator.d.ts +11 -0
- package/dist/type-ids-generator.d.ts.map +1 -0
- package/dist/type-ids-generator.js +153 -0
- package/dist/type-ids-generator.js.map +1 -0
- package/generated/ifc4x3/entities.ts +9 -13
- package/generated/ifc4x3/enums.ts +0 -4
- package/generated/ifc4x3/index.ts +4 -2
- package/generated/ifc4x3/schema-registry.ts +326 -2718
- package/generated/ifc4x3/selects.ts +0 -4
- package/generated/ifc4x3/serializers.ts +322 -0
- package/generated/ifc4x3/test-compile.ts +49 -0
- package/generated/ifc4x3/type-ids.ts +1882 -0
- package/generated/ifc4x3/types.ts +0 -4
- package/package.json +1 -1
- package/src/cli.ts +49 -18
- package/src/crc32.ts +77 -0
- package/src/generator.ts +213 -21
- package/src/index.ts +28 -2
- package/src/rust-generator.ts +715 -0
- package/src/serialization-generator.ts +343 -0
- package/src/type-ids-generator.ts +166 -0
- package/tsconfig.json +1 -0
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { crc32 } from './crc32.js';
|
|
5
|
+
import { getInheritanceChain } from './express-parser.js';
|
|
6
|
+
/**
|
|
7
|
+
* Generate all Rust code from EXPRESS schema
|
|
8
|
+
*/
|
|
9
|
+
export function generateRust(schema) {
|
|
10
|
+
return {
|
|
11
|
+
typeIds: generateTypeIdConstants(schema),
|
|
12
|
+
schema: generateIfcTypeEnum(schema),
|
|
13
|
+
geometryCategories: generateGeometryCategories(schema),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Generate CRC32 type ID constants
|
|
18
|
+
*/
|
|
19
|
+
function generateTypeIdConstants(schema) {
|
|
20
|
+
let code = `// This Source Code Form is subject to the terms of the Mozilla Public
|
|
21
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
22
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
23
|
+
|
|
24
|
+
//! Auto-generated IFC Type ID Constants
|
|
25
|
+
//!
|
|
26
|
+
//! CRC32 hashes for fast type identification.
|
|
27
|
+
//! Generated from EXPRESS schema: ${schema.name}
|
|
28
|
+
//!
|
|
29
|
+
//! DO NOT EDIT - This file is auto-generated by @ifc-lite/codegen
|
|
30
|
+
|
|
31
|
+
#![allow(dead_code)]
|
|
32
|
+
|
|
33
|
+
`;
|
|
34
|
+
// Group by category for readability
|
|
35
|
+
const categories = categorizeEntities(schema);
|
|
36
|
+
for (const [category, entities] of Object.entries(categories)) {
|
|
37
|
+
code += `// ${category}\n`;
|
|
38
|
+
for (const entity of entities) {
|
|
39
|
+
const id = crc32(entity.name);
|
|
40
|
+
code += `pub const ${entity.name.toUpperCase()}: u32 = ${id};\n`;
|
|
41
|
+
}
|
|
42
|
+
code += '\n';
|
|
43
|
+
}
|
|
44
|
+
return code;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate the main IfcType enum
|
|
48
|
+
*/
|
|
49
|
+
function generateIfcTypeEnum(schema) {
|
|
50
|
+
let code = `// This Source Code Form is subject to the terms of the Mozilla Public
|
|
51
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
52
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
53
|
+
|
|
54
|
+
//! Auto-generated IFC Type Enum
|
|
55
|
+
//!
|
|
56
|
+
//! Generated from EXPRESS schema: ${schema.name}
|
|
57
|
+
//!
|
|
58
|
+
//! DO NOT EDIT - This file is auto-generated by @ifc-lite/codegen
|
|
59
|
+
|
|
60
|
+
use std::fmt;
|
|
61
|
+
|
|
62
|
+
/// IFC Entity Types
|
|
63
|
+
///
|
|
64
|
+
/// All ${schema.entities.length} entity types from the ${schema.name} schema.
|
|
65
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
66
|
+
pub enum IfcType {
|
|
67
|
+
`;
|
|
68
|
+
// Group entities by category
|
|
69
|
+
const categories = categorizeEntities(schema);
|
|
70
|
+
for (const [category, entities] of Object.entries(categories)) {
|
|
71
|
+
code += ` // ${category}\n`;
|
|
72
|
+
for (const entity of entities) {
|
|
73
|
+
if (entity.isAbstract) {
|
|
74
|
+
code += ` /// Abstract entity\n`;
|
|
75
|
+
}
|
|
76
|
+
code += ` ${entity.name},\n`;
|
|
77
|
+
}
|
|
78
|
+
code += '\n';
|
|
79
|
+
}
|
|
80
|
+
// Add Unknown variant for unrecognized types
|
|
81
|
+
code += ` /// Unknown/unrecognized IFC type (stores CRC32 hash)
|
|
82
|
+
Unknown(u32),
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
impl IfcType {
|
|
86
|
+
/// Parse IFC type from string (case-insensitive)
|
|
87
|
+
pub fn from_str(s: &str) -> Self {
|
|
88
|
+
let upper = s.to_uppercase();
|
|
89
|
+
match upper.as_str() {
|
|
90
|
+
`;
|
|
91
|
+
// Generate match arms for all entities
|
|
92
|
+
for (const entity of schema.entities) {
|
|
93
|
+
code += ` "${entity.name.toUpperCase()}" => Self::${entity.name},\n`;
|
|
94
|
+
}
|
|
95
|
+
code += ` _ => Self::Unknown(crc32_hash(&upper)),
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/// Parse from CRC32 type ID
|
|
100
|
+
pub fn from_id(id: u32) -> Self {
|
|
101
|
+
match id {
|
|
102
|
+
`;
|
|
103
|
+
// Generate match arms for CRC32 IDs
|
|
104
|
+
for (const entity of schema.entities) {
|
|
105
|
+
const id = crc32(entity.name);
|
|
106
|
+
code += ` ${id} => Self::${entity.name},\n`;
|
|
107
|
+
}
|
|
108
|
+
code += ` _ => Self::Unknown(id),
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// Get CRC32 type ID
|
|
113
|
+
pub fn id(&self) -> u32 {
|
|
114
|
+
match self {
|
|
115
|
+
`;
|
|
116
|
+
for (const entity of schema.entities) {
|
|
117
|
+
const id = crc32(entity.name);
|
|
118
|
+
code += ` Self::${entity.name} => ${id},\n`;
|
|
119
|
+
}
|
|
120
|
+
code += ` Self::Unknown(id) => *id,
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/// Get string representation (uppercase)
|
|
125
|
+
pub fn as_str(&self) -> &'static str {
|
|
126
|
+
match self {
|
|
127
|
+
`;
|
|
128
|
+
for (const entity of schema.entities) {
|
|
129
|
+
code += ` Self::${entity.name} => "${entity.name.toUpperCase()}",\n`;
|
|
130
|
+
}
|
|
131
|
+
code += ` Self::Unknown(_) => "UNKNOWN",
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/// Get display name (PascalCase)
|
|
136
|
+
pub fn name(&self) -> &'static str {
|
|
137
|
+
match self {
|
|
138
|
+
`;
|
|
139
|
+
for (const entity of schema.entities) {
|
|
140
|
+
code += ` Self::${entity.name} => "${entity.name}",\n`;
|
|
141
|
+
}
|
|
142
|
+
code += ` Self::Unknown(_) => "Unknown",
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/// Get parent type (if any)
|
|
147
|
+
pub fn parent(&self) -> Option<Self> {
|
|
148
|
+
match self {
|
|
149
|
+
`;
|
|
150
|
+
for (const entity of schema.entities) {
|
|
151
|
+
if (entity.supertype) {
|
|
152
|
+
code += ` Self::${entity.name} => Some(Self::${entity.supertype}),\n`;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
code += ` _ => None,
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// Check if this type is a subtype of another
|
|
160
|
+
pub fn is_subtype_of(&self, parent: Self) -> bool {
|
|
161
|
+
let mut current = Some(*self);
|
|
162
|
+
while let Some(t) = current {
|
|
163
|
+
if t == parent {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
current = t.parent();
|
|
167
|
+
}
|
|
168
|
+
false
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// Check if this is an abstract type
|
|
172
|
+
pub fn is_abstract(&self) -> bool {
|
|
173
|
+
match self {
|
|
174
|
+
`;
|
|
175
|
+
const abstractTypes = schema.entities.filter((e) => e.isAbstract);
|
|
176
|
+
for (const entity of abstractTypes) {
|
|
177
|
+
code += ` Self::${entity.name} => true,\n`;
|
|
178
|
+
}
|
|
179
|
+
code += ` _ => false,
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
impl fmt::Display for IfcType {
|
|
185
|
+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
186
|
+
write!(f, "{}", self.name())
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/// CRC32 hash function for unknown types
|
|
191
|
+
fn crc32_hash(s: &str) -> u32 {
|
|
192
|
+
const TABLE: [u32; 256] = [
|
|
193
|
+
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
|
194
|
+
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
|
195
|
+
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
|
196
|
+
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
|
197
|
+
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
|
198
|
+
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
|
199
|
+
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
|
200
|
+
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
|
201
|
+
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
|
202
|
+
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
|
203
|
+
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
|
204
|
+
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
|
205
|
+
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
|
206
|
+
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
|
207
|
+
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
|
208
|
+
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
|
209
|
+
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
|
210
|
+
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
|
211
|
+
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cd9, 0x5005713c, 0x270241aa,
|
|
212
|
+
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
|
213
|
+
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
|
214
|
+
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
|
215
|
+
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
|
216
|
+
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
|
217
|
+
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
|
218
|
+
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
|
219
|
+
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
|
220
|
+
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
|
221
|
+
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
|
222
|
+
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
|
223
|
+
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
|
224
|
+
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
|
225
|
+
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
|
226
|
+
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
|
227
|
+
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
|
228
|
+
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
|
229
|
+
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
|
230
|
+
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
|
231
|
+
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
|
232
|
+
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
|
233
|
+
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd706b3,
|
|
234
|
+
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
|
235
|
+
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
|
|
236
|
+
];
|
|
237
|
+
|
|
238
|
+
let mut crc = 0xffffffffu32;
|
|
239
|
+
for byte in s.bytes() {
|
|
240
|
+
crc = TABLE[((crc ^ byte as u32) & 0xff) as usize] ^ (crc >> 8);
|
|
241
|
+
}
|
|
242
|
+
crc ^ 0xffffffff
|
|
243
|
+
}
|
|
244
|
+
`;
|
|
245
|
+
return code;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Generate geometry category classification
|
|
249
|
+
*/
|
|
250
|
+
function generateGeometryCategories(schema) {
|
|
251
|
+
let code = `// This Source Code Form is subject to the terms of the Mozilla Public
|
|
252
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
253
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
254
|
+
|
|
255
|
+
//! Auto-generated Geometry Category Classification
|
|
256
|
+
//!
|
|
257
|
+
//! Generated from EXPRESS schema: ${schema.name}
|
|
258
|
+
//!
|
|
259
|
+
//! DO NOT EDIT - This file is auto-generated by @ifc-lite/codegen
|
|
260
|
+
|
|
261
|
+
use super::IfcType;
|
|
262
|
+
|
|
263
|
+
/// Geometry representation categories
|
|
264
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
265
|
+
pub enum GeometryCategory {
|
|
266
|
+
/// Swept solids (extrusions, revolutions)
|
|
267
|
+
SweptSolid,
|
|
268
|
+
/// Boolean/CSG operations
|
|
269
|
+
Boolean,
|
|
270
|
+
/// Explicit mesh representations
|
|
271
|
+
ExplicitMesh,
|
|
272
|
+
/// Mapped/instanced geometry
|
|
273
|
+
MappedItem,
|
|
274
|
+
/// Surface models
|
|
275
|
+
Surface,
|
|
276
|
+
/// Curve geometry
|
|
277
|
+
Curve,
|
|
278
|
+
/// Other geometry types
|
|
279
|
+
Other,
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/// Profile definition categories
|
|
283
|
+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
284
|
+
pub enum ProfileCategory {
|
|
285
|
+
/// Parametric profiles (rectangle, circle, I-shape, etc.)
|
|
286
|
+
Parametric,
|
|
287
|
+
/// Arbitrary closed profiles
|
|
288
|
+
Arbitrary,
|
|
289
|
+
/// Composite profiles
|
|
290
|
+
Composite,
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
impl IfcType {
|
|
294
|
+
/// Get geometry category for this type
|
|
295
|
+
pub fn geometry_category(&self) -> Option<GeometryCategory> {
|
|
296
|
+
match self {
|
|
297
|
+
// Swept solids
|
|
298
|
+
`;
|
|
299
|
+
// Swept solids
|
|
300
|
+
const sweptSolids = [
|
|
301
|
+
'IfcExtrudedAreaSolid',
|
|
302
|
+
'IfcExtrudedAreaSolidTapered',
|
|
303
|
+
'IfcRevolvedAreaSolid',
|
|
304
|
+
'IfcRevolvedAreaSolidTapered',
|
|
305
|
+
'IfcSurfaceCurveSweptAreaSolid',
|
|
306
|
+
'IfcFixedReferenceSweptAreaSolid',
|
|
307
|
+
'IfcSweptDiskSolid',
|
|
308
|
+
'IfcSweptDiskSolidPolygonal',
|
|
309
|
+
];
|
|
310
|
+
for (const name of sweptSolids) {
|
|
311
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
312
|
+
code += ` Self::${name} => Some(GeometryCategory::SweptSolid),\n`;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
code += `
|
|
316
|
+
// Boolean/CSG
|
|
317
|
+
`;
|
|
318
|
+
// Boolean types
|
|
319
|
+
const booleanTypes = [
|
|
320
|
+
'IfcBooleanResult',
|
|
321
|
+
'IfcBooleanClippingResult',
|
|
322
|
+
'IfcCsgSolid',
|
|
323
|
+
'IfcCsgPrimitive3D',
|
|
324
|
+
'IfcBlock',
|
|
325
|
+
'IfcSphere',
|
|
326
|
+
'IfcRightCircularCone',
|
|
327
|
+
'IfcRightCircularCylinder',
|
|
328
|
+
'IfcRectangularPyramid',
|
|
329
|
+
];
|
|
330
|
+
for (const name of booleanTypes) {
|
|
331
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
332
|
+
code += ` Self::${name} => Some(GeometryCategory::Boolean),\n`;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
code += `
|
|
336
|
+
// Explicit mesh
|
|
337
|
+
`;
|
|
338
|
+
// Explicit mesh types
|
|
339
|
+
const meshTypes = [
|
|
340
|
+
'IfcFacetedBrep',
|
|
341
|
+
'IfcFacetedBrepWithVoids',
|
|
342
|
+
'IfcAdvancedBrep',
|
|
343
|
+
'IfcAdvancedBrepWithVoids',
|
|
344
|
+
'IfcManifoldSolidBrep',
|
|
345
|
+
'IfcTriangulatedFaceSet',
|
|
346
|
+
'IfcPolygonalFaceSet',
|
|
347
|
+
'IfcTriangulatedIrregularNetwork',
|
|
348
|
+
'IfcTessellatedFaceSet',
|
|
349
|
+
'IfcIndexedPolygonalFace',
|
|
350
|
+
'IfcShellBasedSurfaceModel',
|
|
351
|
+
'IfcFaceBasedSurfaceModel',
|
|
352
|
+
];
|
|
353
|
+
for (const name of meshTypes) {
|
|
354
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
355
|
+
code += ` Self::${name} => Some(GeometryCategory::ExplicitMesh),\n`;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
code += `
|
|
359
|
+
// Mapped items
|
|
360
|
+
`;
|
|
361
|
+
if (schema.entities.find((e) => e.name === 'IfcMappedItem')) {
|
|
362
|
+
code += ` Self::IfcMappedItem => Some(GeometryCategory::MappedItem),\n`;
|
|
363
|
+
}
|
|
364
|
+
code += `
|
|
365
|
+
// Surfaces
|
|
366
|
+
`;
|
|
367
|
+
const surfaceTypes = [
|
|
368
|
+
'IfcBSplineSurface',
|
|
369
|
+
'IfcBSplineSurfaceWithKnots',
|
|
370
|
+
'IfcRationalBSplineSurfaceWithKnots',
|
|
371
|
+
'IfcCylindricalSurface',
|
|
372
|
+
'IfcSphericalSurface',
|
|
373
|
+
'IfcToroidalSurface',
|
|
374
|
+
'IfcPlane',
|
|
375
|
+
'IfcCurveBoundedPlane',
|
|
376
|
+
'IfcCurveBoundedSurface',
|
|
377
|
+
'IfcRectangularTrimmedSurface',
|
|
378
|
+
'IfcSurfaceOfLinearExtrusion',
|
|
379
|
+
'IfcSurfaceOfRevolution',
|
|
380
|
+
];
|
|
381
|
+
for (const name of surfaceTypes) {
|
|
382
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
383
|
+
code += ` Self::${name} => Some(GeometryCategory::Surface),\n`;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
code += `
|
|
387
|
+
// Curves
|
|
388
|
+
`;
|
|
389
|
+
const curveTypes = [
|
|
390
|
+
'IfcBSplineCurve',
|
|
391
|
+
'IfcBSplineCurveWithKnots',
|
|
392
|
+
'IfcRationalBSplineCurveWithKnots',
|
|
393
|
+
'IfcCompositeCurve',
|
|
394
|
+
'IfcPolyline',
|
|
395
|
+
'IfcTrimmedCurve',
|
|
396
|
+
'IfcCircle',
|
|
397
|
+
'IfcEllipse',
|
|
398
|
+
'IfcLine',
|
|
399
|
+
'IfcIndexedPolyCurve',
|
|
400
|
+
];
|
|
401
|
+
for (const name of curveTypes) {
|
|
402
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
403
|
+
code += ` Self::${name} => Some(GeometryCategory::Curve),\n`;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
code += `
|
|
407
|
+
_ => None,
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/// Get profile category for this type
|
|
412
|
+
pub fn profile_category(&self) -> Option<ProfileCategory> {
|
|
413
|
+
match self {
|
|
414
|
+
// Parametric profiles
|
|
415
|
+
`;
|
|
416
|
+
const parametricProfiles = [
|
|
417
|
+
'IfcRectangleProfileDef',
|
|
418
|
+
'IfcRectangleHollowProfileDef',
|
|
419
|
+
'IfcRoundedRectangleProfileDef',
|
|
420
|
+
'IfcCircleProfileDef',
|
|
421
|
+
'IfcCircleHollowProfileDef',
|
|
422
|
+
'IfcEllipseProfileDef',
|
|
423
|
+
'IfcIShapeProfileDef',
|
|
424
|
+
'IfcAsymmetricIShapeProfileDef',
|
|
425
|
+
'IfcLShapeProfileDef',
|
|
426
|
+
'IfcTShapeProfileDef',
|
|
427
|
+
'IfcUShapeProfileDef',
|
|
428
|
+
'IfcCShapeProfileDef',
|
|
429
|
+
'IfcZShapeProfileDef',
|
|
430
|
+
'IfcTrapeziumProfileDef',
|
|
431
|
+
];
|
|
432
|
+
for (const name of parametricProfiles) {
|
|
433
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
434
|
+
code += ` Self::${name} => Some(ProfileCategory::Parametric),\n`;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
code += `
|
|
438
|
+
// Arbitrary profiles
|
|
439
|
+
`;
|
|
440
|
+
const arbitraryProfiles = [
|
|
441
|
+
'IfcArbitraryClosedProfileDef',
|
|
442
|
+
'IfcArbitraryProfileDefWithVoids',
|
|
443
|
+
'IfcArbitraryOpenProfileDef',
|
|
444
|
+
'IfcCenterLineProfileDef',
|
|
445
|
+
];
|
|
446
|
+
for (const name of arbitraryProfiles) {
|
|
447
|
+
if (schema.entities.find((e) => e.name === name)) {
|
|
448
|
+
code += ` Self::${name} => Some(ProfileCategory::Arbitrary),\n`;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
code += `
|
|
452
|
+
// Composite profiles
|
|
453
|
+
`;
|
|
454
|
+
if (schema.entities.find((e) => e.name === 'IfcCompositeProfileDef')) {
|
|
455
|
+
code += ` Self::IfcCompositeProfileDef => Some(ProfileCategory::Composite),\n`;
|
|
456
|
+
}
|
|
457
|
+
if (schema.entities.find((e) => e.name === 'IfcDerivedProfileDef')) {
|
|
458
|
+
code += ` Self::IfcDerivedProfileDef => Some(ProfileCategory::Composite),\n`;
|
|
459
|
+
}
|
|
460
|
+
if (schema.entities.find((e) => e.name === 'IfcMirroredProfileDef')) {
|
|
461
|
+
code += ` Self::IfcMirroredProfileDef => Some(ProfileCategory::Composite),\n`;
|
|
462
|
+
}
|
|
463
|
+
code += `
|
|
464
|
+
_ => None,
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/// Check if this type is a spatial structure element
|
|
469
|
+
pub fn is_spatial(&self) -> bool {
|
|
470
|
+
matches!(
|
|
471
|
+
self,
|
|
472
|
+
`;
|
|
473
|
+
const spatialEntities = [
|
|
474
|
+
'IfcProject',
|
|
475
|
+
'IfcSite',
|
|
476
|
+
'IfcBuilding',
|
|
477
|
+
'IfcBuildingStorey',
|
|
478
|
+
'IfcSpace',
|
|
479
|
+
'IfcFacility',
|
|
480
|
+
'IfcFacilityPart',
|
|
481
|
+
];
|
|
482
|
+
const validSpatial = spatialEntities.filter((n) => schema.entities.find((e) => e.name === n));
|
|
483
|
+
if (validSpatial.length > 0) {
|
|
484
|
+
code += ` ${validSpatial.map((n) => `Self::${n}`).join('\n | ')}\n`;
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
code += ` Self::Unknown(_) // No spatial types found\n`;
|
|
488
|
+
}
|
|
489
|
+
code += ` )
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/// Check if this type can have geometry
|
|
493
|
+
pub fn can_have_geometry(&self) -> bool {
|
|
494
|
+
// Products can have geometry through representations
|
|
495
|
+
self.is_product() && !self.is_spatial()
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/// Check if this type is a product (can have placement/representation)
|
|
499
|
+
pub fn is_product(&self) -> bool {
|
|
500
|
+
// Check if it's a subtype of IfcProduct
|
|
501
|
+
self.is_subtype_of(Self::IfcProduct) || *self == Self::IfcProduct
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/// Check if this type is a relationship
|
|
505
|
+
pub fn is_relationship(&self) -> bool {
|
|
506
|
+
// Check if name starts with IfcRel
|
|
507
|
+
self.name().starts_with("IfcRel")
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/// Check if this is a building element
|
|
511
|
+
pub fn is_building_element(&self) -> bool {
|
|
512
|
+
let name = self.name();
|
|
513
|
+
matches!(
|
|
514
|
+
*self,
|
|
515
|
+
Self::IfcWall | Self::IfcWallStandardCase | Self::IfcSlab |
|
|
516
|
+
Self::IfcBeam | Self::IfcColumn | Self::IfcRoof |
|
|
517
|
+
Self::IfcStair | Self::IfcRamp | Self::IfcRailing |
|
|
518
|
+
Self::IfcPlate | Self::IfcMember | Self::IfcFooting |
|
|
519
|
+
Self::IfcPile | Self::IfcCovering | Self::IfcCurtainWall |
|
|
520
|
+
Self::IfcDoor | Self::IfcWindow | Self::IfcChimney |
|
|
521
|
+
Self::IfcShadingDevice | Self::IfcBuildingElementProxy |
|
|
522
|
+
Self::IfcBuildingElementPart
|
|
523
|
+
) || name.contains("Reinforc")
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
`;
|
|
527
|
+
return code;
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Categorize entities for organized output
|
|
531
|
+
*/
|
|
532
|
+
function categorizeEntities(schema) {
|
|
533
|
+
const categories = {
|
|
534
|
+
'Spatial Structure': [],
|
|
535
|
+
'Building Elements': [],
|
|
536
|
+
Openings: [],
|
|
537
|
+
MEP: [],
|
|
538
|
+
'Geometry Representations': [],
|
|
539
|
+
'Geometry Primitives': [],
|
|
540
|
+
Profiles: [],
|
|
541
|
+
Curves: [],
|
|
542
|
+
Surfaces: [],
|
|
543
|
+
Relationships: [],
|
|
544
|
+
Properties: [],
|
|
545
|
+
Materials: [],
|
|
546
|
+
'Presentation & Style': [],
|
|
547
|
+
'Core & Common': [],
|
|
548
|
+
Other: [],
|
|
549
|
+
};
|
|
550
|
+
for (const entity of schema.entities) {
|
|
551
|
+
const name = entity.name;
|
|
552
|
+
const chain = getInheritanceChain(entity, schema);
|
|
553
|
+
if (name.includes('Site') ||
|
|
554
|
+
name.includes('Building') ||
|
|
555
|
+
name.includes('Storey') ||
|
|
556
|
+
name.includes('Space') ||
|
|
557
|
+
name.includes('Project') ||
|
|
558
|
+
chain.includes('IfcSpatialStructureElement')) {
|
|
559
|
+
categories['Spatial Structure'].push(entity);
|
|
560
|
+
}
|
|
561
|
+
else if (chain.includes('IfcBuildingElement') ||
|
|
562
|
+
name.includes('Wall') ||
|
|
563
|
+
name.includes('Slab') ||
|
|
564
|
+
name.includes('Beam') ||
|
|
565
|
+
name.includes('Column')) {
|
|
566
|
+
categories['Building Elements'].push(entity);
|
|
567
|
+
}
|
|
568
|
+
else if (name.includes('Door') ||
|
|
569
|
+
name.includes('Window') ||
|
|
570
|
+
name.includes('Opening')) {
|
|
571
|
+
categories['Openings'].push(entity);
|
|
572
|
+
}
|
|
573
|
+
else if (name.includes('Pipe') ||
|
|
574
|
+
name.includes('Duct') ||
|
|
575
|
+
name.includes('Cable') ||
|
|
576
|
+
chain.includes('IfcDistributionElement')) {
|
|
577
|
+
categories['MEP'].push(entity);
|
|
578
|
+
}
|
|
579
|
+
else if (name.includes('Representation') ||
|
|
580
|
+
name.includes('Shape') ||
|
|
581
|
+
name.includes('GeometricSet')) {
|
|
582
|
+
categories['Geometry Representations'].push(entity);
|
|
583
|
+
}
|
|
584
|
+
else if (name.includes('Solid') ||
|
|
585
|
+
name.includes('Brep') ||
|
|
586
|
+
name.includes('Boolean') ||
|
|
587
|
+
name.includes('Csg') ||
|
|
588
|
+
name.includes('FaceSet')) {
|
|
589
|
+
categories['Geometry Primitives'].push(entity);
|
|
590
|
+
}
|
|
591
|
+
else if (name.includes('Profile')) {
|
|
592
|
+
categories['Profiles'].push(entity);
|
|
593
|
+
}
|
|
594
|
+
else if (name.includes('Curve') ||
|
|
595
|
+
name.includes('Polyline') ||
|
|
596
|
+
name.includes('Circle') ||
|
|
597
|
+
name.includes('Ellipse') ||
|
|
598
|
+
name.includes('Line') ||
|
|
599
|
+
name.includes('Spline')) {
|
|
600
|
+
categories['Curves'].push(entity);
|
|
601
|
+
}
|
|
602
|
+
else if (name.includes('Surface') || name.includes('Plane')) {
|
|
603
|
+
categories['Surfaces'].push(entity);
|
|
604
|
+
}
|
|
605
|
+
else if (name.startsWith('IfcRel')) {
|
|
606
|
+
categories['Relationships'].push(entity);
|
|
607
|
+
}
|
|
608
|
+
else if (name.includes('Property') ||
|
|
609
|
+
name.includes('Quantity') ||
|
|
610
|
+
name.includes('Value')) {
|
|
611
|
+
categories['Properties'].push(entity);
|
|
612
|
+
}
|
|
613
|
+
else if (name.includes('Material')) {
|
|
614
|
+
categories['Materials'].push(entity);
|
|
615
|
+
}
|
|
616
|
+
else if (name.includes('Style') ||
|
|
617
|
+
name.includes('Colour') ||
|
|
618
|
+
name.includes('Presentation')) {
|
|
619
|
+
categories['Presentation & Style'].push(entity);
|
|
620
|
+
}
|
|
621
|
+
else if (name.includes('Root') ||
|
|
622
|
+
name.includes('Object') ||
|
|
623
|
+
name.includes('Product') ||
|
|
624
|
+
name.includes('Element') ||
|
|
625
|
+
name.includes('Resource')) {
|
|
626
|
+
categories['Core & Common'].push(entity);
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
categories['Other'].push(entity);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
// Remove empty categories
|
|
633
|
+
for (const key of Object.keys(categories)) {
|
|
634
|
+
if (categories[key].length === 0) {
|
|
635
|
+
delete categories[key];
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
return categories;
|
|
639
|
+
}
|
|
640
|
+
//# sourceMappingURL=rust-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust-generator.js","sourceRoot":"","sources":["../src/rust-generator.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAQ1D;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAqB;IAChD,OAAO;QACL,OAAO,EAAE,uBAAuB,CAAC,MAAM,CAAC;QACxC,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC;QACnC,kBAAkB,EAAE,0BAA0B,CAAC,MAAM,CAAC;KACvD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,MAAqB;IACpD,IAAI,IAAI,GAAG;;;;;;;qCAOwB,MAAM,CAAC,IAAI;;;;;;CAM/C,CAAC;IA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|
2
|
+
* Serialization Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeScript code for serializing IFC entities to STEP format.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExpressSchema } from './express-parser.js';
|
|
7
|
+
/**
|
|
8
|
+
* Generate serialization support code
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateSerializers(schema: ExpressSchema): string;
|
|
11
|
+
//# sourceMappingURL=serialization-generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialization-generator.d.ts","sourceRoot":"","sources":["../src/serialization-generator.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAyC,MAAM,qBAAqB,CAAC;AAGhG;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAsUjE"}
|