MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / convert

Method convert

src/ifcgeom/kernels/opencascade/face.cpp:263–599  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

261}
262
263bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& result, bool reversed_surface) {
264#ifdef IFOPSH_DEBUG
265 std::ostringstream oss;
266 face->print(oss);
267 auto osss = oss.str();
268 std::wcout << osss.c_str() << std::endl;
269#endif
270
271 face_definition fd;
272
273 // when the surface is planar we do not care about it
274 if (face->basis && face->basis->kind() != taxonomy::PLANE) {
275 fd.surface() = convert_surface(face->basis);
276 }
277
278 const int num_bounds = face->children.size();
279 int num_outer_bounds = 0;
280
281 for (auto& bound : face->children) {
282 if (bound->external.get_value_or(false)) {
283 num_outer_bounds++;
284 }
285 }
286
287 // The number of outer bounds should be one according to the schema. Also Open Cascade
288 // expects this, but it is not strictly checked. Regardless, if the number is greater,
289 // the face will still be processed as long as there are no holes. A compound of faces
290 // is returned in that case.
291 if (num_bounds > 1 && num_outer_bounds > 1 && num_bounds != num_outer_bounds) {
292 Logger::Message(Logger::LOG_ERROR, "Invalid configuration of boundaries for:", face->instance);
293 return false;
294 }
295
296 if (num_outer_bounds > 1) {
297 Logger::Message(Logger::LOG_WARNING, "Multiple outer boundaries for:", face->instance);
298 fd.all_outer() = true;
299 }
300
301 TopTools_DataMapOfShapeInteger wire_senses;
302
303 for (int process_interior = 0; process_interior <= 1; ++process_interior) {
304 for (auto& bound : face->children) {
305 bool same_sense = true; /* todo bound->Orientation(); */
306
307 const bool is_interior =
308 !bound->external.get_value_or(false) &&
309 (num_bounds > 1) &&
310 (num_outer_bounds < num_bounds);
311
312 // The exterior face boundary is processed first
313 if (is_interior == !process_interior) continue;
314
315 TopoDS_Wire wire;
316 if (faceset_helper_ && bound->is_polyhedron()) {
317 if (!faceset_helper_->wire(bound, wire)) {
318 Logger::Message(Logger::LOG_WARNING, "Face boundary loop not included", bound->instance);
319 continue;
320 }

Callers

nothing calls this directly

Calls 15

MessageClass · 0.85
convertFunction · 0.85
WarningFunction · 0.85
is_polyhedronFunction · 0.85
HandleFunction · 0.85
NoticeFunction · 0.85
surfaceMethod · 0.80
all_outerMethod · 0.80
is_polyhedronMethod · 0.80
wireMethod · 0.80
wiresMethod · 0.80
MoreMethod · 0.80

Tested by

no test coverage detected