Skip to content

Commit 1e79eb5

Browse files
committed
Build comprehensive representation id. Fix IfcOpenShell#225
1 parent 6f7afd4 commit 1e79eb5

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

src/ifcgeomserver/IfcGeomServer.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,12 @@ class Entity : public Command {
240240
0, 0, 0, 1
241241
};
242242
swrite(s, std::string((char*)matrix_array, 16 * sizeof(float)));
243-
swrite<int32_t>(s, geom->geometry().id());
243+
244+
// The first bit of the string is always the instance name of the representation.
245+
const std::string& representation_id = geom->geometry().id();
246+
const int integer_representation_id = atoi(representation_id.c_str());
247+
swrite<int32_t>(s, (int32_t)integer_representation_id);
248+
244249
swrite(s, std::string((char*)geom->geometry().verts().data(), geom->geometry().verts().size() * sizeof(float)));
245250
swrite(s, std::string((char*)geom->geometry().normals().data(), geom->geometry().normals().size() * sizeof(float)));
246251
{

src/ifcwrap/IfcGeomWrapper.i

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
374374
IfcGeom::IfcRepresentationShapeItems shapes;
375375
if (kernel.convert_shapes(instance, shapes)) {
376376
IfcGeom::ElementSettings element_settings(settings, kernel.getValue(IfcGeom::Kernel::GV_LENGTH_UNIT), IfcSchema::Type::ToString(instance->type()));
377-
IfcGeom::Representation::BRep brep(element_settings, instance->entity->id(), shapes);
377+
IfcGeom::Representation::BRep brep(element_settings, boost::lexical_cast<std::string>(instance->entity->id()), shapes);
378378
try {
379379
if (settings.get(IfcGeom::IteratorSettings::USE_BREP_DATA)) {
380380
return new IfcGeom::Representation::Serialization(brep);

0 commit comments

Comments
 (0)