예제 #1
0
 /// <summary>
 /// Initializes a new instance of the ElementDataBase from an existing one.
 /// </summary>
 /// <param name="elementDataBase">Element data to copy.</param>
 public ElementDataBase(ElementDataBase elementDataBase)
     : base(elementDataBase as ObjectDataBase)
 {
     Result       = elementDataBase.Result;
     calcPoints   = elementDataBase.ListCalcPoints;
     listSectData = elementDataBase.ListSectionData;
     Status       = elementDataBase.Status;
     document     = elementDataBase.document;
 }
예제 #2
0
        /// <summary>
        /// Reads from Revit information about selected elements and store it in the list with elements data.
        /// </summary>
        /// <param name="data">Acces to cref="ServiceData".</param>
        /// <param name="listElementStatus">List identyficators of elements with result status.</param>
        /// <param name="parameters">Common parameters.</param>
        /// <returns>List of elements data.</returns>
        protected List <ObjectDataBase> ReadListElementData(Autodesk.Revit.DB.CodeChecking.ServiceData data, List <Tuple <ElementId, ResultStatus> > listElementStatus, CommonParametersBase parameters)
        {
            Autodesk.Revit.DB.CodeChecking.Storage.StorageService  service         = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService();
            Autodesk.Revit.DB.CodeChecking.Storage.StorageDocument storageDocument = service.GetStorageDocument(data.Document);

            List <ObjectDataBase> listElementData = new List <ObjectDataBase>();

            foreach (Tuple <ElementId, ResultStatus> elemStatus in listElementStatus)
            {
                Element element = data.Document.GetElement(elemStatus.Item1);
                if (element != null)
                {
                    Autodesk.Revit.DB.CodeChecking.Storage.Label ccLabel = storageDocument.LabelsManager.GetLabel(element);
                    if (ccLabel != null)
                    {
                        Autodesk.Revit.DB.BuiltInCategory category = (Autodesk.Revit.DB.BuiltInCategory)element.Category.Id.IntegerValue;
                        StructuralAssetClass material = ccLabel.Material;
                        Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label  = EngineData.ReadElementLabel(category, material, ccLabel, data);
                        Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass result = EngineData.CreateElementResult(category, material);

                        ObjectDataBase         objectData       = new ObjectDataBase(elemStatus.Item1, category, material, label);
                        List <SectionDataBase> listSectionsData = new List <SectionDataBase>();
                        List <CalcPoint>       listCalcPoints   = EngineData.CreateCalcPointsForElement(data, parameters, elemStatus.Item1);
                        foreach (CalcPoint p in listCalcPoints)
                        {
                            SectionDataBase sectBase = new SectionDataBase(p, objectData);
                            SectionDataBase sectData = EngineData.CreateSectionData(sectBase);

                            listSectionsData.Add(sectData);
                        }

                        ElementDataBase elemBase = new ElementDataBase(result, listCalcPoints, listSectionsData, elemStatus.Item2, data.Document, objectData);
                        ElementDataBase elemData = EngineData.CreateElementData(elemBase);

                        listElementData.Add(elemData);
                    }
                }
            }

            return(listElementData);
        }