/// <summary> /// Gets window style operation. /// </summary> /// <param name="familySymbol"> /// The element type of window. /// </param> /// <returns> /// The IFCWindowStyleOperation. /// </returns> public static Toolkit.IFCWindowStyleOperation GetIFCWindowStyleOperation(ElementType familySymbol) { string value; ParameterUtil.GetStringValueFromElement(familySymbol, BuiltInParameter.WINDOW_OPERATION_TYPE, out value); if (String.IsNullOrEmpty(value)) { return(Toolkit.IFCWindowStyleOperation.NotDefined); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "UserDefined")) { return(Toolkit.IFCWindowStyleOperation.UserDefined); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "SinglePanel")) { return(Toolkit.IFCWindowStyleOperation.Single_Panel); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "DoublePanelVertical")) { return(Toolkit.IFCWindowStyleOperation.Double_Panel_Vertical); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "DoublePanelHorizontal")) { return(Toolkit.IFCWindowStyleOperation.Double_Panel_Horizontal); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelVertical")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Vertical); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelBottom")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Bottom); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelTop")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Top); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelLeft")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Left); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelRight")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Right); } else if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(value, "TriplePanelHorizontal")) { return(Toolkit.IFCWindowStyleOperation.Triple_Panel_Horizontal); } return(Toolkit.IFCWindowStyleOperation.NotDefined); }
/// <summary> /// Gets override string value from element parameter. /// </summary> /// <param name="element"> /// The element. /// </param> /// <param name="paramName"> /// The parameter name. /// </param> /// <param name="originalValue"> /// The original value. /// </param> /// <returns> /// The string contains the string value. /// </returns> public static string GetOverrideStringValue(Element element, string paramName, string originalValue) { string strValue; // get the IFC Name Override if (element != null) { if (ParameterUtil.GetStringValueFromElement(element, paramName, out strValue)) { return(strValue); } } return(originalValue); }
/// <summary> /// Creates a Site GUID for a Site element. If "IfcSite GUID" is set to a valid IFC GUID in Project Information, that value will /// override the default GUID generation for the Site element. /// </summary> /// <param name="document">The document pointer.</param> /// <param name="element">The Site element.</param> /// <returns></returns> static public string CreateSiteGUID(Document document, Element element) { ProjectInfo projectInfo = document.ProjectInformation; if (projectInfo != null) { string paramValue = null; ParameterUtil.GetStringValueFromElement(projectInfo.Id, "IfcSiteGUID", out paramValue); if ((paramValue != null) && (IsValidIFCGUID(paramValue))) { return(paramValue); } } return(CreateGUID(element)); }
/// <summary> /// Creates a Project, Site, or Building GUID. If a shared parameter is set with a valid IFC GUID value, /// that value will override the default one. /// </summary> /// <param name="document">The document.</param> /// <param name="guidType">The GUID being created.</param> /// <returns>The IFC GUID value.</returns> /// <remarks>For Sites, the user should only use this routine if there is no Site element in the file. Otherwise, they /// should use CreateSiteGUID below, which takes an Element pointer.</remarks> static public string CreateProjectLevelGUID(Document document, IFCProjectLevelGUIDType guidType) { string parameterName = "Ifc" + guidType.ToString() + " GUID"; ProjectInfo projectInfo = document.ProjectInformation; if (projectInfo != null) { string paramValue = null; ParameterUtil.GetStringValueFromElement(projectInfo.Id, parameterName, out paramValue); if ((paramValue != null) && (IsValidIFCGUID(paramValue))) { return(paramValue); } } // CreateProjectLevelGUID will throw an exception if the is no Project Information, which indicates // some sort of error in the document. Don't bother trying to create a consistent GUID in this case. // This is fixed in 2014+. string guid = (projectInfo != null) ? ExporterIFCUtils.CreateProjectLevelGUID(document, guidType) : CreateGUID(); if ((projectInfo != null) && ExporterCacheManager.ExportOptionsCache.GUIDOptions.StoreIFCGUID) { BuiltInParameter parameterId = BuiltInParameter.INVALID; switch (guidType) { case IFCProjectLevelGUIDType.Building: parameterId = BuiltInParameter.IFC_BUILDING_GUID; break; case IFCProjectLevelGUIDType.Project: parameterId = BuiltInParameter.IFC_PROJECT_GUID; break; case IFCProjectLevelGUIDType.Site: parameterId = BuiltInParameter.IFC_SITE_GUID; break; } if (parameterId != BuiltInParameter.INVALID) { IFCStoredGUID.ProjectInfoParameterGUID[parameterId] = guid; } } return(guid); }
static private string CreateGUIDBase(Element element, BuiltInParameter parameterName, out bool shouldStore) { shouldStore = false; string ifcGUID = null; if (ExporterCacheManager.ExportOptionsCache.GUIDOptions.AllowGUIDParameterOverride) { ParameterUtil.GetStringValueFromElement(element, parameterName, out ifcGUID); } if (String.IsNullOrEmpty(ifcGUID)) { System.Guid guid = ExportUtils.GetExportId(element.Document, element.Id); ifcGUID = ConvertToIFCGuid(guid); shouldStore = true; } return(ifcGUID); }