XbimExchange
XbimExchange copied to clipboard
COBieLiteUK: Conversion from IFC, IfcSystems ignored
Hello,
Below code in Exchange > IfcToCOBieLiteUK > COBieLiteUKHelper.cs seems todo nothing: On Line 483, ret contains the correct list of systems, but ret is not used.
private void GetSystems()
{
_systemAssignment = new Dictionary<IIfcSystem, IItemSet<IIfcObjectDefinition>>();
if (SystemMode.HasFlag(SystemExtractionMode.System))
{
var SystemAssignmentSet =
_model.Instances.OfType<IIfcRelAssignsToGroup>().Where(r => r.RelatingGroup is IIfcSystem)
.Distinct(new IfcRelAssignsToGroupRelatedGroupObjCompare()); //make sure we do not have duplicate keys, or ToDictionary will throw ex. could lose RelatedObjects though.
var ret = SystemAssignmentSet.ToDictionary(k => (IIfcSystem)k.RelatingGroup, v => v.RelatedObjects);
_systemLookup = new Dictionary<IIfcObjectDefinition, List<IIfcSystem>>();
ReportProgress.NextStage(SystemAssignment.Count, 35);
foreach (var systemAssignment in SystemAssignment)
{
foreach (var objectDefinition in systemAssignment.Value)
{
if (_systemLookup.ContainsKey(objectDefinition))
_systemLookup[objectDefinition].Add(systemAssignment.Key);
else
_systemLookup.Add(objectDefinition, new List<IIfcSystem>(new[] { systemAssignment.Key }));
}
ReportProgress.IncrementAndUpdate();
}
}
Consider to copy ret into SystemAssignment: foreach(var item in ret) _systemAssignment.Add(item.Key, item.Value);
@MichaelBuehler how did you fix this?