From 4cb59009b4bd239c4ec5bb70ecb905e0dbe25409 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 14 Aug 2021 09:12:11 +0200 Subject: [PATCH] #1649 allow profile def in create shape() --- src/ifcgeom/IfcRegister.cpp | 6 +++++- src/ifcwrap/IfcGeomWrapper.i | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/IfcRegister.cpp b/src/ifcgeom/IfcRegister.cpp index 658fa05192..b9358d0580 100644 --- a/src/ifcgeom/IfcRegister.cpp +++ b/src/ifcgeom/IfcRegister.cpp @@ -30,7 +30,11 @@ bool IfcGeom::Kernel::convert_shapes(const IfcBaseClass* l, IfcRepresentationSha if (shape_type(l) != ST_SHAPELIST) { TopoDS_Shape shp; if (convert_shape(l, shp)) { - r.push_back(IfcGeom::IfcRepresentationShapeItem(l->data().id(), shp, get_style(l->as()))); + const IfcGeom::SurfaceStyle* style = nullptr; + if (l->as()) { + style = get_style(l->as()); + } + r.push_back(IfcGeom::IfcRepresentationShapeItem(l->data().id(), shp, style)); return true; } return false; diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 69b737fff4..639ab6a423 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -446,7 +446,11 @@ struct ShapeRTTI : public boost::static_visitor } } else { if (!representation) { - if (instance->declaration().is(Schema::IfcRepresentationItem::Class()) || instance->declaration().is(Schema::IfcRepresentation::Class())) { + if (instance->declaration().is(Schema::IfcRepresentationItem::Class()) || + instance->declaration().is(Schema::IfcRepresentation::Class()) || + // https://github.com/IfcOpenShell/IfcOpenShell/issues/1649 + instance->declaration().is(Schema::IfcProfileDef::Class()) + ) { IfcGeom::IfcRepresentationShapeItems shapes = kernel.convert(instance); IfcGeom::ElementSettings element_settings(settings, kernel.getValue(IfcGeom::Kernel::GV_LENGTH_UNIT), instance->declaration().name());