/// <summary> /// Calculates the reference. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="extrusionCreationData"> /// The IFCExtrusionCreationData. /// </param> /// <param name="element"> /// The element to calculate the value. /// </param> /// <param name="elementType"> /// The element type. /// </param> /// <returns> /// True if the operation succeed, false otherwise. /// </returns> public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType) { if (elementType == null) { m_ReferenceName = element.Name; } else { if (ExporterCacheManager.ExportOptionsCache.NamingOptions.UseFamilyAndTypeNameForReference || String.IsNullOrEmpty(elementType.Name)) { if (!String.IsNullOrEmpty(elementType.Name)) { m_ReferenceName = String.Format("{0}:{1}", ExporterIFCUtils.GetFamilyName(elementType), element.Name); } else { m_ReferenceName = ExporterIFCUtils.GetFamilyName(elementType); } } else { m_ReferenceName = elementType.Name; } } return(true); }
/// <summary> /// Generates the IFC name based on the Revit display name. /// </summary> /// <param name="element">The element.</param> /// <returns> The string containing the name.</returns> static private string GetRevitDisplayName(Element element) { if (element == null) { return(""); } string fullName = (element.Category != null) ? element.Category.Name : ""; string typeName = element.Name; string familyName = ""; ElementType elementType = null; if (element is ElementType) { elementType = element as ElementType; } else { elementType = element.Document.GetElement(element.GetTypeId()) as ElementType; } if (elementType != null) { familyName = ExporterIFCUtils.GetFamilyName(elementType); } if (familyName != "") { if (fullName != "") { fullName = fullName + " : " + familyName; } else { fullName = familyName; } } if (typeName != "") { if (fullName != "") { fullName = fullName + " : " + typeName; } else { fullName = typeName; } } return(fullName); }
/// <summary> /// Generates the IFC name for the current element. /// </summary> /// <param name="element">The element.</param> /// <returns> The string containing the name.</returns> static private string GetIFCBaseName(Element element) { if (element == null) { return(""); } bool isType = (element is ElementType); string elementName = element.Name; if (elementName == "???") { elementName = ""; } string familyName = ""; ElementType elementType = (isType ? element : element.Document.GetElement(element.GetTypeId())) as ElementType; if (elementType != null) { familyName = ExporterIFCUtils.GetFamilyName(elementType); if (familyName == "???") { familyName = ""; } } string fullName = familyName; if (elementName != "") { if (fullName != "") { fullName = fullName + ":" + elementName; } else { fullName = elementName; } } if (isType) { return(fullName); } if (fullName != "") { return(fullName + ":" + CreateIFCElementId(element)); } return(CreateIFCElementId(element)); }