fill context attribute of the shape elements (similar to v0.7.0) #4832

This commit is contained in:
Andrej730
2024-07-16 13:55:25 +05:00
parent d8cf6ca4fc
commit dedbf7014a
2 changed files with 15 additions and 19 deletions
+14 -19
View File
@@ -233,14 +233,19 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
std::string context_string = "";
/*
// @todo
if (representation->RepresentationIdentifier()) {
context_string = *representation->RepresentationIdentifier();
} else if (representation->ContextOfItems()->ContextType()) {
context_string = *representation->ContextOfItems()->ContextType();
// IfcShapeRepresentation.
const IfcUtil::IfcBaseEntity *representation = representation_node->instance->as<IfcUtil::IfcBaseEntity>();
auto representation_identifier = representation->get("RepresentationIdentifier");
if (!representation_identifier->isNull()) {
context_string = *representation_identifier;
}
else {
IfcUtil::IfcBaseClass *context = (IfcUtil::IfcBaseClass *) *representation->get("ContextOfItems");
auto context_type = context->as<IfcUtil::IfcBaseEntity>()->get("ContextType");
if (!context_type->isNull()) {
context_string = *context_type;
}
}
*/
auto elem = new IfcGeom::BRepElement(
product->data().id(),
@@ -343,17 +348,8 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
const std::string guid = product->get_value<std::string>("GlobalId");
const std::string name = product->get_value<std::string>("Name", "");
/*
std::string context_string = "";
if (representation->hasRepresentationIdentifier()) {
context_string = representation->RepresentationIdentifier();
} else if (representation->ContextOfItems()->hasContextType()) {
context_string = representation->ContextOfItems()->ContextType();
}
*/
const std::string product_type = product->declaration().name();
const std::string context_string = brep->context();
return new IfcGeom::BRepElement(
product->data().id(),
@@ -361,8 +357,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
name,
product_type,
guid,
// @todo
"",
context_string,
place,
brep->geometry_pointer(),
product
+1
View File
@@ -92,6 +92,7 @@ namespace IfcGeom {
const std::string& name() const { return _name; }
const std::string& type() const { return _type; }
const std::string& guid() const { return _guid; }
// Return the representation's identifier (e.g. "Body") if present, or it's context type (e.g. "Model").
const std::string& context() const { return _context; }
const std::string& unique_id() const { return _unique_id; }
const Transformation& transformation() const { return _transformation; }