|
23 | 23 | * * |
24 | 24 | ********************************************************************************/ |
25 | 25 |
|
26 | | -// #include <set> |
27 | | -// #include <algorithm> |
28 | | -// #include <numeric> |
29 | | -// |
30 | | -// #include <Standard_Version.hxx> |
31 | | -// |
32 | | -// #include <gp_Pnt.hxx> |
33 | | -// #include <gp_Vec.hxx> |
34 | | -// #include <gp_Dir.hxx> |
35 | | -// #include <gp_Pnt2d.hxx> |
36 | | -// #include <gp_GTrsf.hxx> |
37 | | -// #include <gp_GTrsf2d.hxx> |
38 | | -// #include <gp_Trsf.hxx> |
39 | | -// #include <gp_Trsf2d.hxx> |
40 | | -// #include <gp_Ax3.hxx> |
41 | | -// #include <gp_Pln.hxx> |
42 | | -// |
43 | | -// #include <Geom_Line.hxx> |
44 | | -// #include <Geom_Circle.hxx> |
45 | | -// |
46 | | -// #include <Geom_Plane.hxx> |
47 | | -// #include <Geom_OffsetCurve.hxx> |
48 | | -// #include <Geom_OffsetSurface.hxx> |
49 | | -// #include <Geom_CylindricalSurface.hxx> |
50 | | -// #include <Geom_SurfaceOfLinearExtrusion.hxx> |
51 | | -// |
52 | | -// #include <GeomAPI_IntCS.hxx> |
53 | | -// #include <GeomAPI_IntSS.hxx> |
54 | | -// |
55 | | -// #include <BRepBndLib.hxx> |
56 | | -// #include <BRepOffsetAPI_Sewing.hxx> |
57 | | -// #include <BRepBuilderAPI_MakeFace.hxx> |
58 | | -// #include <BRepBuilderAPI_MakeEdge.hxx> |
59 | | -// #include <BRepBuilderAPI_MakeWire.hxx> |
60 | | -// #include <BRepBuilderAPI_MakePolygon.hxx> |
61 | | -// #include <BRepBuilderAPI_MakeVertex.hxx> |
62 | | -// |
63 | | -// #include <TopoDS.hxx> |
64 | | -// #include <TopoDS_Wire.hxx> |
65 | | -// #include <TopoDS_Face.hxx> |
66 | | -// #include <TopoDS_CompSolid.hxx> |
67 | | -// |
68 | | -// #include <TopExp.hxx> |
69 | | -// #include <TopExp_Explorer.hxx> |
70 | | -// |
71 | | -// #include <BRepPrimAPI_MakePrism.hxx> |
72 | | -// #include <BRepBuilderAPI_MakeShell.hxx> |
73 | | -// #include <BRepBuilderAPI_MakeSolid.hxx> |
74 | | -// #include <BRepPrimAPI_MakeHalfSpace.hxx> |
75 | | -// #include <BRepAlgoAPI_Cut.hxx> |
76 | | -// #include <BRepAlgoAPI_Fuse.hxx> |
77 | | -// #include <BRepAlgoAPI_Common.hxx> |
78 | | -// #include <BRepAlgoAPI_BooleanOperation.hxx> |
79 | | -// #if OCC_VERSION_HEX >= 0x70200 |
80 | | -// #include <BRepAlgoAPI_Splitter.hxx> |
81 | | -// #endif |
82 | | -// |
83 | | -// #include <BRepAlgo_NormalProjection.hxx> |
84 | | -// |
85 | | -// #include <ShapeFix_Shape.hxx> |
86 | | -// #include <ShapeFix_ShapeTolerance.hxx> |
87 | | -// #include <ShapeFix_Solid.hxx> |
88 | | -// #include <ShapeFix_Shell.hxx> |
89 | | -// |
90 | | -// #include <ShapeAnalysis_Curve.hxx> |
91 | | -// #include <ShapeAnalysis_Surface.hxx> |
92 | | -// |
93 | | -// |
94 | | -// #include <BRepFilletAPI_MakeFillet2d.hxx> |
95 | | -// |
96 | | -// #include <TopLoc_Location.hxx> |
97 | | -// |
98 | | -// #include <GProp_GProps.hxx> |
99 | | -// #include <BRepGProp.hxx> |
100 | | -// |
101 | | -// #include <BRepBuilderAPI_Transform.hxx> |
102 | | -// #include <BRepBuilderAPI_GTransform.hxx> |
103 | | -// |
104 | | -// #include <BRepGProp_Face.hxx> |
105 | | -// #include <BRepCheck.hxx> |
106 | | -// #include <BRepCheck_Analyzer.hxx> |
107 | | -// |
108 | | -// #include <BRepMesh_IncrementalMesh.hxx> |
109 | | -// #include <BRepTools.hxx> |
110 | | -// #include <BRepTools_WireExplorer.hxx> |
111 | | -// |
112 | | -// #include <Poly_Triangulation.hxx> |
113 | | -// #include <Poly_Array1OfTriangle.hxx> |
114 | | -// |
115 | | -// #include <TopTools_IndexedMapOfShape.hxx> |
116 | | -// #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> |
117 | | -// |
118 | | -// #include <BOPAlgo_PaveFiller.hxx> |
119 | | -// |
120 | | -// #include <GCPnts_AbscissaPoint.hxx> |
121 | | -// |
122 | | -// #include <BRepClass3d_SolidClassifier.hxx> |
123 | | -// |
124 | | -// #include <GeomAPI_ExtremaCurveCurve.hxx> |
125 | | -// |
126 | | -// #include <Extrema_ExtCS.hxx> |
127 | | -// |
128 | | -// #include <ShapeAnalysis_Edge.hxx> |
129 | | -// |
130 | | -// #if OCC_VERSION_HEX >= 0x70200 |
131 | | -// #include <BOPAlgo_Alerts.hxx> |
132 | | -// #endif |
133 | | -// |
134 | | -// #include "../../../ifcparse/macros.h" |
135 | | -// #include "../../../ifcparse/IfcSIPrefix.h" |
136 | | -// |
137 | | -// #include "../../../ifcparse/IfcFile.h" |
138 | | -// |
139 | | - |
140 | 26 | #include "OpenCascadeKernel.h" |
141 | 27 |
|
142 | | -// #include "IfcGeomTree.h" |
143 | | - |
144 | 28 | #include "boolean_utils.h" |
145 | | - |
146 | | -// #include "wire_utils.h" |
147 | | - |
148 | 29 | #include "base_utils.h" |
149 | 30 |
|
150 | | -// #include "layerset.h" |
151 | | -// |
152 | | -// #include <memory> |
153 | | -// #include <thread> |
154 | | -// |
155 | | -// #if OCC_VERSION_HEX < 0x60900 |
156 | | -// #ifdef _MSC_VER |
157 | | -// #pragma message("warning: You are linking against Open CASCADE version " OCC_VERSION_COMPLETE ". Version 6.9.0 introduces various improvements with relation to boolean operations. You are advised to upgrade.") |
158 | | -// #else |
159 | | -// #warning "You are linking against an older version of Open CASCADE. Version 6.9.0 introduces various improvements with relation to boolean operations. You are advised to upgrade." |
160 | | -// #endif |
161 | | -// #endif |
162 | | -// |
163 | | -// namespace { |
164 | | -// struct POSTFIX_SCHEMA(factory_t) { |
165 | | -// IfcGeom::Kernel* operator()(IfcParse::IfcFile* file) const { |
166 | | -// IfcGeom::POSTFIX_SCHEMA(Kernel)* k = new IfcGeom::POSTFIX_SCHEMA(Kernel); |
167 | | -// if (file) { |
168 | | -// |
169 | | -// } |
170 | | -// return k; |
171 | | -// } |
172 | | -// }; |
173 | | -// } |
174 | | -// |
175 | | -// void MAKE_INIT_FN(KernelImplementation_)(IfcGeom::impl::KernelFactoryImplementation* mapping) { |
176 | | -// static const std::string schema_name = STRINGIFY(IfcSchema); |
177 | | -// POSTFIX_SCHEMA(factory_t) factory; |
178 | | -// mapping->bind(schema_name, factory); |
179 | | -// } |
180 | | -// |
181 | | -// #define Kernel POSTFIX_SCHEMA(Kernel) |
182 | | -// |
183 | | -// void IfcGeom::Kernel::set_offset(const std::array<double, 3> &p_offset) { |
184 | | -// offset = gp_Vec(p_offset[0], p_offset[1], p_offset[2]); |
185 | | -// |
186 | | -// offset_and_rotation = util::combine_offset_and_rotation(offset, rotation); |
187 | | -// } |
188 | | -// |
189 | | -// void IfcGeom::Kernel::set_rotation(const std::array<double, 4> &p_rotation) { |
190 | | -// rotation = gp_Quaternion(p_rotation[0], p_rotation[1], p_rotation[2], p_rotation[3]); |
191 | | -// |
192 | | -// offset_and_rotation = util::combine_offset_and_rotation(offset, rotation); |
193 | | -// } |
194 | | -// |
| 31 | +#include <BRepPrimAPI_MakeRevol.hxx> |
195 | 32 |
|
196 | 33 | namespace { |
197 | 34 | struct opening_sorter { |
@@ -391,7 +228,13 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const IfcUtil::IfcBaseEntity* |
391 | 228 | return true; |
392 | 229 | } |
393 | 230 |
|
394 | | -#include <BRepPrimAPI_MakeRevol.hxx> |
| 231 | +bool IfcGeom::OpenCascadeKernel::unify_shapes(const IfcGeom::ConversionResults& input, IfcGeom::ConversionResults& output) { |
| 232 | + std::transform(input.begin(), input.end(), std::back_inserter(output), [this](auto v) { |
| 233 | + auto& s = std::static_pointer_cast<OpenCascadeShape>(v.Shape())->shape(); |
| 234 | + return IfcGeom::ConversionResult(v.ItemId(), new OpenCascadeShape(util::unify(s, settings_.get<ifcopenshell::geometry::settings::Precision>().get())), v.StylePtr()); |
| 235 | + }); |
| 236 | + return true; |
| 237 | +} |
395 | 238 |
|
396 | 239 | bool IfcGeom::OpenCascadeKernel::convert_impl(const taxonomy::revolve::ptr r, IfcGeom::ConversionResults& results) { |
397 | 240 |
|
|
0 commit comments