-
-
Notifications
You must be signed in to change notification settings - Fork 901
Expand file tree
/
Copy pathIfcPython.i
More file actions
366 lines (324 loc) · 10.2 KB
/
IfcPython.i
File metadata and controls
366 lines (324 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
/********************************************************************************
* *
* This file is part of IfcOpenShell. *
* *
* IfcOpenShell is free software: you can redistribute it and/or modify *
* it under the terms of the Lesser GNU General Public License as published by *
* the Free Software Foundation, either version 3.0 of the License, or *
* (at your option) any later version. *
* *
* IfcOpenShell is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* Lesser GNU General Public License for more details. *
* *
* You should have received a copy of the Lesser GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
%begin %{
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* https://github.com/swig/swig/issues/325 */
# include <basetsd.h>
# include <assert.h>
# include <ctype.h>
# include <errno.h>
# include <io.h>
# include <math.h>
# include <sal.h>
# include <stdarg.h>
# include <stddef.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/stat.h>
# include <time.h>
# include <wchar.h>
#endif
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4127 4244 4702 4510 4512 4610)
# if _MSC_VER > 1800
# pragma warning(disable : 4456 4459)
# endif
#endif
// TODO add '# pragma warning(pop)' to the very end of the file
%}
%include "stdint.i"
%include "std_array.i"
%include "std_vector.i"
%include "std_string.i"
%include "exception.i"
%include "std_shared_ptr.i"
%{
#include <array>
%}
%template(DoubleArray3) std::array<double, 3>;
%ignore IfcGeom::NumberNativeDouble;
%ignore ifcopenshell::geometry::Converter;
// Not relevant for python: new_IfcBaseClass() calls instantiate()
%ignore schema_definition::instantiate;
// Irrelevant abstract base that only has anonymous concrete implementations
%ignore instance_factory;
// Not relevant for python usage
%ignore IfcBaseInterface;
%ignore IfcBaseClass::data;
%ignore *::references_to_resolve;
// SVG serializer internal
%ignore geometry_data;
%ignore vertical_section;
%ignore horizontal_plan;
%ignore storey_sorter;
%ignore layerset_information;
// taxonomy
// - tuples
%ignore curves;
%ignore surfaces;
%ignore upgrades;
%ignore loop_to_face_upgrade_impl;
%ignore curve_to_edge_upgrade_impl;
%ignore curve_to_loop_upgrade_impl;
%ignore edge_to_loop_upgrade_impl;
%ignore curve_to_face_upgrade_impl;
%ignore loop_to_function_item_upgrade_impl;
%ignore IfcGeom::geometry_exception;
%ignore IfcGeom::too_many_faces_exception;
%ignore ifcopenshell::geometry::taxonomy::topology_error;
// settings, can this done more generally?
// GeometrySerializer.h
%ignore UseElementNames;
%ignore UseElementGuids;
%ignore UseElementStepIds;
%ignore UseElementTypes;
%ignore UseYUp;
%ignore WriteGltfEcef;
%ignore FloatingPointDigits;
%ignore BaseUri;
%ignore WktUseSection;
// ConversionSettings.h
%ignore MesherLinearDeflection;
%ignore MesherAngularDeflection;
%ignore ReorientShells;
%ignore LengthUnit;
%ignore PlaneUnit;
%ignore Precision;
%ignore LayersetFirst;
%ignore DisableBooleanResult;
%ignore NoWireIntersectionCheck;
%ignore NoWireIntersectionTolerance;
%ignore PrecisionFactor;
%ignore DebugBooleanOperations;
%ignore BooleanAttempt2d;
%ignore WeldVertices;
%ignore UseWorldCoords;
%ignore UnifyShapes;
%ignore UseMaterialNames;
%ignore ConvertBackUnits;
%ignore ContextIds;
%ignore ContextTypes;
%ignore ContextIdentifiers;
%ignore OutputDimensionality;
%ignore IteratorOutput;
%ignore DisableOpeningSubtractions;
%ignore ApplyDefaultMaterials;
%ignore DontEmitNormals;
%ignore GenerateUvs;
%ignore ApplyLayerSets;
%ignore UseElementHierarchy;
%ignore ValidateQuantities;
%ignore EdgeArrows;
%ignore SiteLocalPlacement;
%ignore BuildingLocalPlacement;
%ignore NoParallelMapping;
%ignore PermissiveShapeReuse;
%ignore ForceSpaceTransparency;
%ignore CircleSegments;
%ignore CgalSmoothAngleDegrees;
%ignore KeepBoundingBoxes;
%ignore SurfaceColour;
%ignore ComputeCurvature;
%ignore FunctionStepType;
%ignore FunctionStepParam;
%ignore ModelOffset;
%ignore ModelRotation;
%ignore TriangulationType;
%ignore CgalEmitOriginalEdges;
%ignore OcctNoCleanTriangulation;
%ignore CacheShapes;
%ignore DeferProcessingFirstElement;
%ignore MaxOffset;
%ignore MaxOffsetDeviation;
%ignore ApplyOffset;
%ignore SeparateZUpNode;
%ignore XmlSerializerFactory;
%ignore JsonSerializerFactory;
// Triangulated representation helper struct
%ignore EdgeKey;
// General python-specific rename rules for comparison operators.
// Mostly to silence warnings, but might be of use some time.
%rename("__eq__") operator ==;
%rename("__lt__") operator <;
%exception {
try {
$action
} catch(const IfcParse::IfcAttributeOutOfRangeException& e) {
SWIG_exception(SWIG_IndexError, e.what());
} catch(const IfcParse::IfcException& e) {
SWIG_exception(SWIG_RuntimeError, e.what());
} catch(const std::runtime_error& e) {
SWIG_exception(SWIG_RuntimeError, e.what());
} catch(...) {
SWIG_exception(SWIG_RuntimeError, "An unknown error occurred");
}
}
%include "../serializers/serializers_api.h"
// Include headers for the typemaps to function. This set of includes,
// can probably be reduced, but for now it's identical to the includes
// of the module definition below.
%{
#include "../ifcgeom/Iterator.h"
#include "../ifcgeom/taxonomy.h"
#include "../ifcgeom/function_item_evaluator.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
#include <BRepTools_ShapeSet.hxx>
#endif
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
#include "../serializers/ColladaSerializer.h"
#include "../serializers/HdfSerializer.h"
#include "../serializers/RocksDbSerializer.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc3
#include "../ifcparse/Ifc4x3_rc3.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc4
#include "../ifcparse/Ifc4x3_rc4.h"
#endif
#ifdef HAS_SCHEMA_4x3
#include "../ifcparse/Ifc4x3.h"
#endif
#ifdef HAS_SCHEMA_4x3_tc1
#include "../ifcparse/Ifc4x3_tc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add1
#include "../ifcparse/Ifc4x3_add1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add2
#include "../ifcparse/Ifc4x3_add2.h"
#endif
#include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/IfcSchema.h"
#include "../ifcparse/utils.h"
#include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
#ifdef IFOPSH_WITH_CGAL
#include "../ifcgeom/kernels/cgal/CgalConversionResult.h"
#endif
%}
%{
template<typename T>
struct is_std_vector : std::false_type {};
template<typename T, typename Alloc>
struct is_std_vector<std::vector<T, Alloc>> : std::true_type {};
template<typename T>
constexpr bool is_std_vector_v = is_std_vector<T>::value;
template<typename T>
struct is_std_vector_vector : std::false_type {};
template<typename T, typename Alloc, typename Alloc2>
struct is_std_vector_vector<std::vector<std::vector<T, Alloc>, Alloc2>> : std::true_type {};
template<typename T>
constexpr bool is_std_vector_vector_v = is_std_vector_vector<T>::value;
%}
// Create docstrings for generated python code.
%feature("autodoc", "1");
%include "utils/type_conversion.i"
%include "utils/typemaps_in.i"
%include "utils/typemaps_out.i"
%module ifcopenshell_wrapper %{
#include "../ifcgeom/Converter.h"
#include "../ifcgeom/taxonomy.h"
#include "../ifcgeom/function_item_evaluator.h"
#ifdef IFOPSH_WITH_OPENCASCADE
#include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
#include <BRepTools_ShapeSet.hxx>
#endif
#include "../ifcgeom/Iterator.h"
#include "../ifcgeom/ConversionResult.h"
#include "../ifcgeom/hybrid_kernel.h"
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
#include "../serializers/ColladaSerializer.h"
#include "../serializers/HdfSerializer.h"
#include "../serializers/XmlSerializer.h"
#include "../serializers/GltfSerializer.h"
#include "../serializers/TtlWktSerializer.h"
#include "../serializers/RocksDbSerializer.h"
#include "../serializers/JsonSerializer.h"
#ifdef HAS_SCHEMA_2x3
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
#include "../ifcparse/Ifc4.h"
#endif
#ifdef HAS_SCHEMA_4x1
#include "../ifcparse/Ifc4x1.h"
#endif
#ifdef HAS_SCHEMA_4x2
#include "../ifcparse/Ifc4x2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc1
#include "../ifcparse/Ifc4x3_rc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc2
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc3
#include "../ifcparse/Ifc4x3_rc3.h"
#endif
#ifdef HAS_SCHEMA_4x3_rc4
#include "../ifcparse/Ifc4x3_rc4.h"
#endif
#ifdef HAS_SCHEMA_4x3
#include "../ifcparse/Ifc4x3.h"
#endif
#ifdef HAS_SCHEMA_4x3_tc1
#include "../ifcparse/Ifc4x3_tc1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add1
#include "../ifcparse/Ifc4x3_add1.h"
#endif
#ifdef HAS_SCHEMA_4x3_add2
#include "../ifcparse/Ifc4x3_add2.h"
#endif
#include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcFile.h"
#include "../ifcparse/IfcSchema.h"
#include "../ifcparse/utils.h"
#include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
%}
%include "IfcGeomWrapper.i"
%include "IfcParseWrapper.i"