/// <summary> /// Create a new classification reference and associate it with the Element (ElemHnd) /// </summary> /// <param name="exporterIFC">The exporterIFC class.</param> /// <param name="file">The IFC file class.</param> /// <param name="elemHnd">The corresponding IFC entity handle.</param> /// <param name="classificationKeyString">The classification name.</param> /// <param name="classificationCode">The classification code.</param> /// <param name="classificationDescription">The classification description.</param> /// <param name="location">The location of the classification.</param> public static void InsertClassificationReference(ExporterIFC exporterIFC, IFCFile file, IFCAnyHandle elemHnd, string classificationKeyString, string classificationCode, string classificationDescription, string location) { IFCAnyHandle classificationReferenceAssociation = ExporterCacheManager.ClassificationReferenceCache.GetClassificationReferenceAssociation(classificationKeyString, classificationCode); if (IFCAnyHandleUtil.IsNullOrHasNoValue(classificationReferenceAssociation)) { IFCAnyHandle classificationReference = CreateClassificationReference(file, classificationKeyString, classificationCode, classificationDescription, location); HashSet <IFCAnyHandle> relatedObjects = new HashSet <IFCAnyHandle>(); relatedObjects.Add(elemHnd); string relName = classificationKeyString + " " + classificationCode; string relDescription = string.Empty; // This will create the same GUID across products for the same classification // key and code pair. But this should be consistent across products. string relGuid = GUIDUtil.GenerateIFCGuidFrom(Common.Enums.IFCEntityType.IfcRelAssociatesClassification, relName, classificationReference); IFCAnyHandle relAssociates = IFCInstanceExporter.CreateRelAssociatesClassification(file, relGuid, ExporterCacheManager.OwnerHistoryHandle, relName, relDescription, relatedObjects, classificationReference); ExporterCacheManager.ClassificationReferenceCache.AddClassificationReferenceAssociation(classificationKeyString, classificationCode, relAssociates); } else { IFCAnyHandleUtil.AssociatesAddRelated(classificationReferenceAssociation, elemHnd); } }
/// <summary> /// Create a new classification reference and associate it with the Element (ElemHnd) /// </summary> /// <param name="exporterIFC">The exporterIFC class.</param> /// <param name="file">The IFC file class.</param> /// <param name="elemHnd">The corresponding IFC entity handle.</param> /// <param name="classificationKeyString">The classification name.</param> /// <param name="classificationCode">The classification code.</param> /// <param name="classificationDescription">The classification description.</param> /// <param name="location">The location of the classification.</param> public static void InsertClassificationReference(ExporterIFC exporterIFC, IFCFile file, IFCAnyHandle elemHnd, string classificationKeyString, string classificationCode, string classificationDescription, string location) { IFCAnyHandle classificationReferenceAssociation = ExporterCacheManager.ClassificationReferenceCache.GetClassificationReferenceAssociation(classificationKeyString, classificationCode); if (IFCAnyHandleUtil.IsNullOrHasNoValue(classificationReferenceAssociation)) { IFCAnyHandle classificationReference = CreateClassificationReference(file, classificationKeyString, classificationCode, classificationDescription, location); HashSet <IFCAnyHandle> relatedObjects = new HashSet <IFCAnyHandle>(); relatedObjects.Add(elemHnd); IFCAnyHandle relAssociates = IFCInstanceExporter.CreateRelAssociatesClassification(file, GUIDUtil.CreateGUID(), ExporterCacheManager.OwnerHistoryHandle, classificationKeyString + " Classification", "", relatedObjects, classificationReference); ExporterCacheManager.ClassificationReferenceCache.AddClassificationReferenceAssociation(classificationKeyString, classificationCode, relAssociates); } else { IFCAnyHandleUtil.AssociatesAddRelated(classificationReferenceAssociation, elemHnd); } }