Esempio n. 1
0
        /// <summary>
        /// Reads from Revit selected elements identificators and collect in the list only that which has apprppriate label, material and category.
        /// </summary>
        /// <param name="server">Acces to cref="Server".</param>
        /// <param name="data">Acces to cref="ServiceData".</param>
        /// <returns>List identyficators of elements with result status.</returns>
        protected List <Tuple <ElementId, ResultStatus> > ReadListElementIdWithStatus(Server.Server server, Autodesk.Revit.DB.CodeChecking.ServiceData data)
        {
            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);
            Guid activePackageId = storageDocument.CalculationParamsManager.CalculationParams.GetInputResultPackageId(server.GetServerId());

            List <Tuple <ElementId, ResultStatus> > listElementId = new List <Tuple <ElementId, ResultStatus> >();

            foreach (Element element in data.Selection)
            {
                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;

                    if (server.GetSupportedMaterials().Contains(material) &&
                        server.GetSupportedCategories(material).Contains(category))
                    {
                        ElementId id = new ElementId(element.Id.IntegerValue);

                        SchemaClass  label  = EngineData.ReadElementLabel(category, material, ccLabel, data);
                        ResultStatus status = new Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus(Server.Server.ID, activePackageId);
                        EngineData.VerifyElementLabel(category, material, label, ref status);

                        listElementId.Add(new Tuple <ElementId, ResultStatus>(id, status));
                    }
                }
            }

            return(listElementId);
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the ElementDataBase object with list of parameters.
 /// </summary>
 /// <param name="elementResult">Element results schema.</param>
 /// <param name="listcalcPoint">List of the element's calculation points.</param>
 /// <param name="listSectionData">List of sections' data.</param>
 /// <param name="elementStatus">Element result status.</param>
 /// <param name="document">Acces to cref="Document".</param>
 /// <param name="data">Object with base parameters for the element.</param>
 public ElementDataBase(Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass elementResult,
                        List <CalcPoint> listcalcPoint,
                        List <SectionDataBase> listSectionData,
                        Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus elementStatus,
                        Document document,
                        ObjectDataBase data)
     : base(data)
 {
     Result        = elementResult;
     calcPoints    = listcalcPoint;
     listSectData  = listSectionData;
     Status        = elementStatus;
     this.document = document;
 }
Esempio n. 3
0
        /// <summary>
        /// Verify parameters of user element label.
        /// </summary>
        /// <param name="category">Category of the element.</param>
        /// <param name="material">Material of the element.</param>
        /// <param name="label">Element label."</param>
        /// <param name="status">Reference to element's status".</param>
        public void VerifyElementLabel(Autodesk.Revit.DB.BuiltInCategory category, StructuralAssetClass material, Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass label,
                                       ref Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status)
        {
            if (label != null)
            {
                switch (material)
                {
                case StructuralAssetClass.Concrete:
                    switch (category)
                    {
                    default:
                        break;

                    case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                    {
                        LabelColumn labelCol = label as LabelColumn;
                        if (labelCol != null)
                        {
                            if (labelCol.EnabledInternalForces.Count == 0)
                            {
                                status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
                            }
                            List <string> errors = VerifySteel(labelCol.LongitudinalReinforcement, true);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                            errors = VerifySteel(labelCol.TransversalReinforcement, false);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                        }
                    }
                    break;

                    case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                    {
                        LabelBeam labelBm = label as LabelBeam;
                        if (labelBm != null)
                        {
                            if (labelBm.EnabledInternalForces.Count == 0)
                            {
                                status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
                            }
                            List <string> errors = VerifySteel(labelBm.LongitudinalReinforcement, true);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                            errors = VerifySteel(labelBm.TransversalReinforcement, false);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                        }
                    }
                    break;
                    }
                    break;

                case StructuralAssetClass.Metal:
                    break;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Saves in Revit the result object of an element.
        /// </summary>
        /// <param name="elementId">Identificator of an element.</param>
        /// <param name="resultSchema">Result object.</param>
        /// <param name="status">Status of element's results.</param>
        /// <param name="data">Acces to cref="ServiceData".</param>
        protected void SaveElementResult(ElementId elementId, Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass resultSchema, Autodesk.Revit.DB.CodeChecking.Storage.ResultStatus status, Autodesk.Revit.DB.CodeChecking.ServiceData data)
        {
            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);

            Element element = data.Document.GetElement(elementId);

            if (resultSchema != null)
            {
                storageDocument.ResultsManager.SetResult(resultSchema.GetEntity(), element, status, true);
            }
        }