コード例 #1
0
ファイル: IFCImportLog.cs プロジェクト: masixian/revit-ifc
        /// <summary>
        /// Keep track of materials that have been created, for later summary count.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="createdMaterialId">The created material id.</param>
        public void AddCreatedMaterial(Document doc, ElementId createdMaterialId)
        {
            if (createdMaterialId == ElementId.InvalidElementId)
            {
                return;
            }

            Element createdElement = doc.GetElement(createdMaterialId);

            if (createdElement == null)
            {
                return;
            }

            CreatedElementsKey mapKey = new CreatedElementsKey(null, "Materials");

            if (m_CreatedElements.ContainsKey(mapKey))
            {
                m_CreatedElements[mapKey]++;
            }
            else
            {
                m_CreatedElements.Add(new KeyValuePair <CreatedElementsKey, int>(mapKey, 1));
            }

            m_TotalCreatedElements++;
            UpdateStatusBarAfterCreate();
        }
コード例 #2
0
ファイル: IFCImportLog.cs プロジェクト: masixian/revit-ifc
            public int CompareTo(Object obj)
            {
                if (obj == null || (!(obj is CreatedElementsKey)))
                {
                    return(-1);
                }

                CreatedElementsKey otherKey = obj as CreatedElementsKey;
                int catComp = string.Compare(CatName, otherKey.CatName);

                if (catComp != 0)
                {
                    return(catComp);
                }
                return(string.Compare(ElemName, otherKey.ElemName));
            }
コード例 #3
0
ファイル: IFCImportLog.cs プロジェクト: masixian/revit-ifc
        /// <summary>
        /// Keep track of elements that have been created, for later summary count.
        /// </summary>
        /// <param name="doc">The document.</param>
        /// <param name="objDef">The created entity.</param>
        public void AddCreatedEntity(Document doc, IFCObjectDefinition objDef)
        {
            if (objDef == null)
            {
                return;
            }

            ISet <ElementId> createdElementIds = new HashSet <ElementId>();

            objDef.GetCreatedElementIds(createdElementIds);

            foreach (ElementId createdElementId in createdElementIds)
            {
                Element createdElement = doc.GetElement(createdElementId);
                if (createdElement == null)
                {
                    continue;
                }

                Category elementCategory = createdElement.Category;
                string   catName         = (elementCategory == null) ? "" : elementCategory.Name;

                string typeName = createdElement.GetType().Name;

                CreatedElementsKey mapKey = new CreatedElementsKey(catName, typeName);
                if (m_CreatedElements.ContainsKey(mapKey))
                {
                    m_CreatedElements[mapKey]++;
                }
                else
                {
                    m_CreatedElements.Add(new KeyValuePair <CreatedElementsKey, int>(mapKey, 1));
                }

                m_TotalCreatedElements++;
                UpdateStatusBarAfterCreate();
            }
        }
コード例 #4
0
      /// <summary>
      /// Keep track of materials that have been created, for later summary count.
      /// </summary>
      /// <param name="doc">The document.</param>
      /// <param name="createdMaterialId">The created material id.</param>
      public void AddCreatedMaterial(Document doc, ElementId createdMaterialId)
      {
         if (createdMaterialId == ElementId.InvalidElementId)
            return;

         Element createdElement = doc.GetElement(createdMaterialId);
         if (createdElement == null)
            return;

         CreatedElementsKey mapKey = new CreatedElementsKey(null, "Materials");
         if (m_CreatedElements.ContainsKey(mapKey))
            m_CreatedElements[mapKey]++;
         else
            m_CreatedElements.Add(new KeyValuePair<CreatedElementsKey, int>(mapKey, 1));

         m_TotalCreatedElements++;
         UpdateStatusBarAfterCreate();
      }
コード例 #5
0
      /// <summary>
      /// Keep track of elements that have been created, for later summary count.
      /// </summary>
      /// <param name="doc">The document.</param>
      /// <param name="objDef">The created entity.</param>
      public void AddCreatedEntity(Document doc, IFCObjectDefinition objDef)
      {
         if (objDef == null)
            return;

         ISet<ElementId> createdElementIds = new HashSet<ElementId>();
         objDef.GetCreatedElementIds(createdElementIds);

         foreach (ElementId createdElementId in createdElementIds)
         {
            Element createdElement = doc.GetElement(createdElementId);
            if (createdElement == null)
               continue;

            Category elementCategory = createdElement.Category;
            string catName = (elementCategory == null) ? "" : elementCategory.Name;

            string typeName = createdElement.GetType().Name;

            CreatedElementsKey mapKey = new CreatedElementsKey(catName, typeName);
            if (m_CreatedElements.ContainsKey(mapKey))
               m_CreatedElements[mapKey]++;
            else
               m_CreatedElements.Add(new KeyValuePair<CreatedElementsKey, int>(mapKey, 1));

            m_TotalCreatedElements++;
            UpdateStatusBarAfterCreate();
         }
      }