Esempio n. 1
0
        /// <summary>
        /// Checks if the handle is a sub-type of a particular type.
        /// </summary>
        /// <param name="handle">The handle.</param>
        /// <param name="type">The type.</param>
        /// <returns>True if the handle is exactly of the specified type.</returns>
        public static bool IsSubTypeOf(IFCAnyHandle handle, IFCEntityType type)
        {
            if (IsNullOrHasNoValue(handle))
            {
                return(false);
            }
            IFCEntityType subType;
            bool          val;

            if (ExporterCacheManager.HandleTypeCache.TryGetValue(handle, out subType))
            {
                if (subType == type)
                {
                    return(true);
                }
                KeyValuePair <IFCEntityType, IFCEntityType> subTypeToTypeEntry = new KeyValuePair <IFCEntityType, IFCEntityType>(subType, type);
                if (ExporterCacheManager.HandleIsSubTypeOfCache.TryGetValue(subTypeToTypeEntry, out val))
                {
                    return(val);
                }
                val = handle.IsSubTypeOf(type.ToString());
                ExporterCacheManager.HandleIsSubTypeOfCache[subTypeToTypeEntry] = val;
            }
            else
            {
                val = handle.IsSubTypeOf(type.ToString());
            }

            return(val);
        }
Esempio n. 2
0
 /// <summary>
 /// Updates the project information.
 /// </summary>
 /// <param name="project">The project.</param>
 /// <param name="projectName">The project name.</param>
 /// <param name="projectLongName">The project long name.</param>
 /// <param name="projectStatus">The project status.</param>
 public static void UpdateProject(IFCAnyHandle project, string projectName, string projectLongName,
                                  string projectStatus)
 {
     if (!IsNullOrHasNoValue(project) && project.IsSubTypeOf(IFCEntityType.IfcProject.ToString()))
     {
         SetAttribute(project, "Name", projectName);
         SetAttribute(project, "LongName", projectLongName);
         SetAttribute(project, "Phase", projectStatus);
     }
 }