mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
fill context attribute of the shape elements (similar to v0.7.0) #4832
This commit is contained in:
+14
-19
@@ -233,14 +233,19 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_represe
|
|||||||
|
|
||||||
std::string context_string = "";
|
std::string context_string = "";
|
||||||
|
|
||||||
/*
|
// IfcShapeRepresentation.
|
||||||
// @todo
|
const IfcUtil::IfcBaseEntity *representation = representation_node->instance->as<IfcUtil::IfcBaseEntity>();
|
||||||
if (representation->RepresentationIdentifier()) {
|
auto representation_identifier = representation->get("RepresentationIdentifier");
|
||||||
context_string = *representation->RepresentationIdentifier();
|
if (!representation_identifier->isNull()) {
|
||||||
} else if (representation->ContextOfItems()->ContextType()) {
|
context_string = *representation_identifier;
|
||||||
context_string = *representation->ContextOfItems()->ContextType();
|
}
|
||||||
|
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(
|
auto elem = new IfcGeom::BRepElement(
|
||||||
product->data().id(),
|
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 guid = product->get_value<std::string>("GlobalId");
|
||||||
const std::string name = product->get_value<std::string>("Name", "");
|
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 product_type = product->declaration().name();
|
||||||
|
const std::string context_string = brep->context();
|
||||||
|
|
||||||
return new IfcGeom::BRepElement(
|
return new IfcGeom::BRepElement(
|
||||||
product->data().id(),
|
product->data().id(),
|
||||||
@@ -361,8 +357,7 @@ IfcGeom::BRepElement* ifcopenshell::geometry::Converter::create_brep_for_process
|
|||||||
name,
|
name,
|
||||||
product_type,
|
product_type,
|
||||||
guid,
|
guid,
|
||||||
// @todo
|
context_string,
|
||||||
"",
|
|
||||||
place,
|
place,
|
||||||
brep->geometry_pointer(),
|
brep->geometry_pointer(),
|
||||||
product
|
product
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace IfcGeom {
|
|||||||
const std::string& name() const { return _name; }
|
const std::string& name() const { return _name; }
|
||||||
const std::string& type() const { return _type; }
|
const std::string& type() const { return _type; }
|
||||||
const std::string& guid() const { return _guid; }
|
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& context() const { return _context; }
|
||||||
const std::string& unique_id() const { return _unique_id; }
|
const std::string& unique_id() const { return _unique_id; }
|
||||||
const Transformation& transformation() const { return _transformation; }
|
const Transformation& transformation() const { return _transformation; }
|
||||||
|
|||||||
Reference in New Issue
Block a user