Files
IfcOpenShell/src/ifcwrap/IfcPython.i
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

367 lines
10 KiB
OpenEdge ABL
Raw Normal View History

2011-05-08 11:04:32 +00:00
/********************************************************************************
2015-01-16 16:26:40 +00:00
* *
* This file is part of IfcOpenShell. *
* *
* IfcOpenShell is free software: you can redistribute it and/or modify *
2011-05-08 11:04:32 +00:00
* it under the terms of the Lesser GNU General Public License as published by *
2015-01-16 16:26:40 +00:00
* 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. *
* *
2011-05-08 11:04:32 +00:00
* You should have received a copy of the Lesser GNU General Public License *
2015-01-16 16:26:40 +00:00
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
2011-05-08 11:04:32 +00:00
********************************************************************************/
%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
%}
2021-11-08 10:58:55 +01:00
%include "stdint.i"
2020-10-26 14:10:13 +01:00
%include "std_array.i"
%include "std_vector.i"
2011-05-08 11:04:32 +00:00
%include "std_string.i"
%include "exception.i"
2024-05-23 13:06:57 +02:00
%include "std_shared_ptr.i"
2025-02-23 15:22:36 +01:00
%{
#include <array>
%}
%template(DoubleArray3) std::array<double, 3>;
%ignore IfcGeom::NumberNativeDouble;
2023-11-15 10:32:20 +01:00
%ignore ifcopenshell::geometry::Converter;
2024-12-29 15:53:21 +01:00
// 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;
2024-12-29 15:53:21 +01:00
2025-10-26 10:03:33 +01:00
%ignore IfcGeom::geometry_exception;
%ignore IfcGeom::too_many_faces_exception;
%ignore ifcopenshell::geometry::taxonomy::topology_error;
2024-12-29 15:53:21 +01:00
// settings, can this done more generally?
// GeometrySerializer.h
2024-12-29 15:53:21 +01:00
%ignore UseElementNames;
%ignore UseElementGuids;
%ignore UseElementStepIds;
%ignore UseElementTypes;
%ignore UseYUp;
%ignore WriteGltfEcef;
%ignore FloatingPointDigits;
%ignore BaseUri;
%ignore WktUseSection;
// ConversionSettings.h
2024-12-29 15:53:21 +01:00
%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;
2024-12-29 15:53:21 +01:00
%ignore ForceSpaceTransparency;
%ignore CircleSegments;
%ignore CgalSmoothAngleDegrees;
2024-12-29 15:53:21 +01:00
%ignore KeepBoundingBoxes;
%ignore SurfaceColour;
%ignore ComputeCurvature;
%ignore FunctionStepType;
%ignore FunctionStepParam;
2024-12-29 15:53:21 +01:00
%ignore ModelOffset;
%ignore ModelRotation;
%ignore TriangulationType;
%ignore CgalEmitOriginalEdges;
%ignore OcctNoCleanTriangulation;
%ignore CacheShapes;
%ignore DeferProcessingFirstElement;
%ignore MaxOffset;
%ignore MaxOffsetDeviation;
%ignore ApplyOffset;
2025-11-19 10:43:52 +01:00
%ignore SeparateZUpNode;
%ignore XmlSerializerFactory;
%ignore JsonSerializerFactory;
2024-12-29 15:53:21 +01:00
// Triangulated representation helper struct
%ignore EdgeKey;
2017-06-24 13:36:26 +02:00
// 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");
}
}
2011-05-08 11:04:32 +00:00
%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.
%{
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Iterator.h"
#include "../ifcgeom/taxonomy.h"
2025-01-02 11:10:56 -08:00
#include "../ifcgeom/function_item_evaluator.h"
2023-03-22 11:17:14 +01:00
#ifdef IFOPSH_WITH_OPENCASCADE
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
2021-07-11 15:03:21 +02:00
2023-03-22 11:17:14 +01:00
#include <BRepTools_ShapeSet.hxx>
#endif
2021-07-11 15:03:21 +02:00
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
2025-03-21 14:35:23 +01:00
#include "../serializers/ColladaSerializer.h"
2021-10-29 10:40:15 +02:00
#include "../serializers/HdfSerializer.h"
2025-08-26 12:53:35 +02:00
#include "../serializers/RocksDbSerializer.h"
2017-12-22 17:37:58 +01:00
#ifdef HAS_SCHEMA_2x3
2017-12-22 13:51:11 +01:00
#include "../ifcparse/Ifc2x3.h"
#endif
#ifdef HAS_SCHEMA_4
2017-12-22 13:51:11 +01:00
#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
2021-02-14 12:43:27 +01:00
#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"
2022-07-17 21:13:46 +02:00
#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"
2023-12-19 12:40:38 +01:00
#endif
#ifdef HAS_SCHEMA_4x3_add2
#include "../ifcparse/Ifc4x3_add2.h"
#endif
2017-06-05 17:26:58 +02:00
#include "../ifcparse/IfcBaseClass.h"
#include "../ifcparse/IfcFile.h"
2017-12-31 12:20:13 +01:00
#include "../ifcparse/IfcSchema.h"
2020-07-05 11:40:17 +02:00
#include "../ifcparse/utils.h"
2016-06-22 15:03:18 +02:00
2023-11-15 10:32:20 +01:00
#include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
2023-12-11 21:06:25 +01:00
#ifdef IFOPSH_WITH_CGAL
#include "../ifcgeom/kernels/cgal/CgalConversionResult.h"
#endif
2011-05-08 11:04:32 +00:00
%}
%{
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 %{
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Converter.h"
#include "../ifcgeom/taxonomy.h"
2025-01-02 11:10:56 -08:00
#include "../ifcgeom/function_item_evaluator.h"
2023-03-22 11:17:14 +01:00
#ifdef IFOPSH_WITH_OPENCASCADE
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Serialization/Serialization.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
2023-03-22 11:17:14 +01:00
#include <BRepTools_ShapeSet.hxx>
#endif
2023-03-21 20:15:01 +01:00
#include "../ifcgeom/Iterator.h"
#include "../ifcgeom/ConversionResult.h"
2025-09-26 14:24:49 +02:00
#include "../ifcgeom/hybrid_kernel.h"
2021-07-11 15:03:21 +02:00
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
2025-03-21 14:35:23 +01:00
#include "../serializers/ColladaSerializer.h"
2021-10-29 10:40:15 +02:00
#include "../serializers/HdfSerializer.h"
2022-02-26 14:52:58 +01:00
#include "../serializers/XmlSerializer.h"
#include "../serializers/GltfSerializer.h"
#include "../serializers/TtlWktSerializer.h"
2025-08-26 12:53:35 +02:00
#include "../serializers/RocksDbSerializer.h"
2025-11-17 14:06:39 +01:00
#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
2021-02-14 12:43:27 +01:00
#include "../ifcparse/Ifc4x3_rc2.h"
#endif
2022-07-17 21:13:46 +02:00
#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
2023-12-19 12:40:38 +01:00
#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"
2023-11-15 10:32:20 +01:00
#include "../ifcgeom/ConversionSettings.h"
#include "../ifcgeom/ConversionResult.h"
#include "../svgfill/src/svgfill.h"
%}
%include "IfcGeomWrapper.i"
%include "IfcParseWrapper.i"