From 5bfad88a75f84ff6cea3c026242b7b5feec620e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Mart=C3=ADnez=20de=20la=20Rosa?= <36189169+christt105@users.noreply.github.com> Date: Mon, 5 Sep 2022 14:58:22 +0200 Subject: [PATCH] [IfcConvert] Added IfcRelConnectsElements to xml export (#2197) * [IfcConvert] Export tasks in the xml conversion The exportion in the XML format exports in a new tag, named "tasks", all the tasks from the file with a hierarchy. Each task contains the IfcTaskTime object if it has it. * [ifcConvert] Add related objects in tasks * [IfcConvert] Added IsSuccessorFrom and IsPredecessorTo in xml task export * Get IfcTasks from IfcWorkSchedule * [IfcConver] Changed OperatesOn hierarchy level in xml task export * Added task to property / quanty relationship * [IfcConvert] Added calendars to xml output file * [IfcConvert] Added Output objects in the XML file * [IfcConvert] Fix crash when IfcWorkCalendar does not contain IfcWorkTime * [IfcConvert] Added IfcWorkPlan to xml export * [IfcConvert] Added IfcRelConnectsElements to xml export * [IfcConvert] Added IfcRelConnectsElements to xml export * [IfcConvert] Improved related and relating xml export --- .../schema_dependent/XmlSerializer.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/serializers/schema_dependent/XmlSerializer.cpp b/src/serializers/schema_dependent/XmlSerializer.cpp index 816bf583f8..d3f2f66c99 100644 --- a/src/serializers/schema_dependent/XmlSerializer.cpp +++ b/src/serializers/schema_dependent/XmlSerializer.cpp @@ -507,7 +507,7 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() { } IfcSchema::IfcProject* project = *projects->begin(); - ptree root, header, units, decomposition, properties, quantities, types, layers, materials, work, calendars; + ptree root, header, units, decomposition, properties, quantities, types, layers, materials, work, calendars, connections; // Write the SPF header as XML nodes. BOOST_FOREACH(const std::string& s, file->header().file_description().description()) { @@ -665,6 +665,22 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() { } } #endif + + IfcSchema::IfcRelConnectsElements::list::ptr pconnections = file->instances_by_type(); + for (IfcSchema::IfcRelConnectsElements::list::it it = pconnections->begin(); it != pconnections->end(); ++it) { + IfcSchema::IfcRelConnectsElements* connection = *it; + + ptree* nconnection = format_entity_instance(connection, connections); + + ptree nrelatedElement; + ptree nrelatingElement; + + format_entity_instance(connection->RelatedElement(), nrelatedElement, true); + format_entity_instance(connection->RelatingElement(), nrelatingElement, true); + + nconnection->add_child("RelatedElement", nrelatedElement); + nconnection->add_child("RelatingElement", nrelatingElement); + } // Write all type objects as XML nodes. IfcSchema::IfcTypeObject::list::ptr type_objects = file->instances_by_type(); @@ -749,6 +765,7 @@ void MAKE_TYPE_NAME(XmlSerializer)::finalize() { root.add_child("ifc.header", header); root.add_child("ifc.units", units); + root.add_child("ifc.connections", connections); root.add_child("ifc.properties", properties); root.add_child("ifc.quantities", quantities); root.add_child("ifc.work", work);