Exemple #1
0
        public override Entity GetDefaultLabel(Autodesk.Revit.DB.Document document, StructuralAssetClass material, BuiltInCategory category)
        {
            switch (material)
            {
            case StructuralAssetClass.Concrete:
                switch (category)
                {
                default:
                    break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                {
                    IList <ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
                    if (materials.Count > 0)
                    {
                        IList <ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
                        if (barsIds.Count > 0)
                        {
                            LabelColumn label = new LabelColumn();
                            label.LongitudinalReinforcement.Material     = document.GetElement(materials[0]) as Material;
                            label.LongitudinalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);

                            label.TransversalReinforcement.Material     = label.LongitudinalReinforcement.Material;
                            label.TransversalReinforcement.RebarBarType = label.LongitudinalReinforcement.RebarBarType;

                            return(label.GetEntity());
                        }
                    }
                }
                break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                {
                    IList <ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
                    if (materials.Count > 0)
                    {
                        IList <ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
                        if (barsIds.Count > 0)
                        {
                            LabelBeam label = new LabelBeam();
                            label.LongitudinalReinforcement.Material     = document.GetElement(materials[0]) as Material;
                            label.LongitudinalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);

                            label.TransversalReinforcement.Material     = label.LongitudinalReinforcement.Material;
                            label.TransversalReinforcement.RebarBarType = label.LongitudinalReinforcement.RebarBarType;

                            return(label.GetEntity());
                        }
                    }
                }
                break;

                /// <structural_toolkit_2015>
                case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
                case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
                {
                    IList <ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
                    if (materials.Count > 0)
                    {
                        IList <ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
                        if (barsIds.Count > 0)
                        {
                            LabelFloor label = new LabelFloor();
                            label.PrimaryReinforcement.Material       = document.GetElement(materials[0]) as Material;
                            label.PrimaryReinforcement.RebarBarType   = RebarUtility.GetRebarType(document, barsIds[0]);
                            label.SecondaryReinforcement.Material     = document.GetElement(materials[0]) as Material;
                            label.SecondaryReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
                            return(label.GetEntity());
                        }
                    }
                }
                break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
                {
                    IList <ElementId> materials = RebarUtility.GetListMaterialOfRebars(document);
                    if (materials.Count > 0)
                    {
                        IList <ElementId> barsIds = RebarUtility.GetListRebarForMaterial(document, materials[0]);
                        if (barsIds.Count > 0)
                        {
                            LabelWall label = new LabelWall();
                            label.VerticalReinforcement.Material       = document.GetElement(materials[0]) as Material;
                            label.VerticalReinforcement.RebarBarType   = RebarUtility.GetRebarType(document, barsIds[0]);
                            label.HorizontalReinforcement.Material     = document.GetElement(materials[0]) as Material;
                            label.HorizontalReinforcement.RebarBarType = RebarUtility.GetRebarType(document, barsIds[0]);
                            return(label.GetEntity());
                        }
                    }
                }
                break;
                    /// </structural_toolkit_2015>
                }
                break;
            }

            return(base.GetDefaultLabel(document, material, category));
        }
Exemple #2
0
        private List <ForceType> GetForceTypes(Autodesk.Revit.DB.CodeChecking.ServiceData data, IEnumerable <ElementId> elementsIds)
        {
            List <ForceType> forceTypes = new List <ForceType>();

            foreach (ElementId elementId in elementsIds)
            {
                Tuple <Label, CalculationParameter, BuiltInCategory, Element> elementsInternalData = GetElementInternalData(data, elementId);
                BuiltInCategory category = elementsInternalData.Item3;
                Label           ccLabel  = elementsInternalData.Item1;

                switch (category)
                {
                default:
                    break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                {
                    LabelColumn label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelColumn;
                    if (label != null)
                    {
                        forceTypes = label.EnabledInternalForces.Select(s => s.GetForceType()).ToList();
                    }
                    break;
                }

                case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                {
                    LabelBeam label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelBeam;
                    if (label != null)
                    {
                        forceTypes = label.EnabledInternalForces.Select(s => s.GetForceType()).ToList();
                    }
                    break;
                }

                /// <structural_toolkit_2015>
                case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
                case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
                {
                    LabelFloor label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelFloor;
                    if (label != null)
                    {
                        if (label.EnabledInternalForces.Contains(EnabledInternalForces.MY))
                        {
                            forceTypes.Add(ForceType.Mxx);
                            forceTypes.Add(ForceType.Myy);
                        }
                        if (label.EnabledInternalForces.Contains(EnabledInternalForces.FX))
                        {
                            forceTypes.Add(ForceType.Fyy);
                            forceTypes.Add(ForceType.Fxx);
                        }
                    }
                    break;
                }

                case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical:
                {
                    LabelWall label = ReadElementLabel(category, ccLabel.Material, ccLabel, data) as LabelWall;
                    if (label != null)
                    {
                        if (label.EnabledInternalForces.Contains(EnabledInternalForces.FX))
                        {
                            forceTypes.Add(ForceType.Fyy);
                            forceTypes.Add(ForceType.Fxx);
                        }
                        if (label.EnabledInternalForces.Contains(EnabledInternalForces.MY))
                        {
                            forceTypes.Add(ForceType.Mxx);
                            forceTypes.Add(ForceType.Myy);
                        }
                    }
                    break;
                }
                    /// </structural_toolkit_2015>
                }
            }
            return(forceTypes);
        }
Exemple #3
0
        /// <summary>
        /// Gets the document body for label.
        /// </summary>
        /// <param name="label">label.</param>
        /// <param name="document">document.</param>
        /// <returns>
        /// The body of the document.
        /// </returns>
        public override DocumentBody BuildLabelDocumentBody(Entity label, Autodesk.Revit.DB.Document document)
        {
            switch (label.Schema.SchemaName)
            {
            default:
                return(base.BuildLabelDocumentBody(label, document));

            case "LabelColumn":
            {
                DocumentBody body        = new DocumentBody();
                LabelColumn  labelColumn = new LabelColumn();
                labelColumn.SetProperties(label, document);

                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));

                if (labelColumn.EnabledInternalForces.Count > 0)
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFX_Note"), true));
                    }
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFY_Note"), true));
                    }
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnFZ_Note"), true));
                    }
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMX_Note"), true));
                    }
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMY_Note"), true));
                    }
                    if (labelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("ColumnMZ_Note"), true));
                    }
                }

                body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelColumn, this, document));

                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("Buckling"), 4));
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionY"), 5));
                if (labelColumn.BucklingDirectionY)
                {
                    body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientY", labelColumn, this, document));
                    body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeY", labelColumn, this, document));
                }
                else
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true));
                }


                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("BucklingDirectionZ"), 5));
                if (labelColumn.BucklingDirectionZ)
                {
                    body.Elements.Add(DocumentElement.GetDocumentElement("LengthCoefficientZ", labelColumn, this, document));
                    body.Elements.Add(DocumentElement.GetDocumentElement("ColumnStructureTypeZ", labelColumn, this, document));
                }
                else
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("NotTakenIntoConsideration"), true));
                }


                // longitudinal
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4));
                if (labelColumn.LongitudinalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.LongitudinalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (labelColumn.LongitudinalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.LongitudinalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.LongitudinalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                // transverse
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4));
                if (labelColumn.TransversalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelColumn.TransversalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelColumn.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (labelColumn.TransversalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelColumn.TransversalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelColumn.TransversalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelColumn.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));


                return(body);
            }

            case "LabelBeam":
            {
                DocumentBody body      = new DocumentBody();
                LabelBeam    labelBeam = new LabelBeam();
                labelBeam.SetProperties(label, document);


                body.Elements.Add(new DocumentLineBreak(1));
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));

                if (labelBeam.EnabledInternalForces.Count > 0)
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFX_Note"), true));
                    }
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FY))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFY_Note"), true));
                    }
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamFZ_Note"), true));
                    }
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMX_Note"), true));
                    }
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMY_Note"), true));
                    }
                    if (labelBeam.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("BeamMZ_Note"), true));
                    }
                }

                body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", labelBeam, this, document));

                string interaction = Resources.ResourceManager.GetString("No");
                if (labelBeam.SlabBeamInteraction == ConcreteTypes.BeamSectionType.WithSlabBeamInteraction)
                {
                    interaction = Resources.ResourceManager.GetString("Yes");
                }

                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("SlabBeamInteraction"), interaction));

                // longitudinal
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("LongitudinalReinforcement"), 4));
                if (labelBeam.LongitudinalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.LongitudinalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.LongitudinalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (labelBeam.LongitudinalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.LongitudinalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.LongitudinalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.LongitudinalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                // transverse
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("TransversalReinforcement"), 4));
                if (labelBeam.TransversalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(labelBeam.TransversalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), labelBeam.TransversalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (labelBeam.TransversalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), labelBeam.TransversalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), labelBeam.TransversalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), labelBeam.TransversalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                return(body);
            }

            /// <structural_toolkit_2015>
            case "LabelFloor":
            {
                DocumentBody body       = new DocumentBody();
                LabelFloor   LabelFloor = new LabelFloor();
                LabelFloor.SetProperties(label, document);


                body.Elements.Add(new DocumentLineBreak(1));
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));

                if (LabelFloor.EnabledInternalForces.Count > 0)
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
                    if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorF_Note"), true));
                    }
                    if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorQ_Note"), true));
                    }
                    if (LabelFloor.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("FloorM_Note"), true));
                    }
                }

                body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelFloor, this, document));
                // Primary
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("PrimaryReinforcement"), 4));
                if (LabelFloor.PrimaryReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.PrimaryReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.PrimaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (LabelFloor.PrimaryReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.PrimaryReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.PrimaryReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.PrimaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                // Secondary
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("SecondaryReinforcement"), 4));
                if (LabelFloor.SecondaryReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelFloor.SecondaryReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelFloor.SecondaryReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (LabelFloor.SecondaryReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelFloor.SecondaryReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelFloor.SecondaryReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelFloor.SecondaryReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                return(body);
            }

            case "LabelWall":
            {
                DocumentBody body      = new DocumentBody();
                LabelWall    LabelWall = new LabelWall();
                LabelWall.SetProperties(label, document);


                body.Elements.Add(new DocumentLineBreak(1));
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("CalculationOptions"), 4));

                if (LabelWall.EnabledInternalForces.Count > 0)
                {
                    body.Elements.Add(new DocumentText(Resources.ResourceManager.GetString("EnabledInternalForces") + ":", true));
                    if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallF_Note"), true));
                    }
                    if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.FZ))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallQ_Note"), true));
                    }
                    if (LabelWall.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MX))
                    {
                        body.Elements.Add(new DocumentText("- " + Resources.ResourceManager.GetString("WallM_Note"), true));
                    }
                }

                body.Elements.Add(DocumentElement.GetDocumentElement("CreepCoefficient", LabelWall, this, document));
                // Vertical
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("VerticalReinforcement"), 4));
                if (LabelWall.VerticalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.VerticalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.VerticalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (LabelWall.VerticalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.VerticalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.VerticalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.VerticalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                // Horizontal
                body.Elements.Add(new DocumentTitle(Resources.ResourceManager.GetString("HorizontalReinforcement"), 4));
                if (LabelWall.HorizontalReinforcement.Material != null)
                {
                    StructuralAsset assL = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(LabelWall.HorizontalReinforcement.Material);
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), assL.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("Material"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("MinimumYieldStress"), LabelWall.HorizontalReinforcement.MinimumYieldStress, UnitsConverter.GetInternalUnit(UnitType.UT_Stress), UnitType.UT_Stress, document.GetUnits()));

                if (LabelWall.HorizontalReinforcement.RebarBarType != null)
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), LabelWall.HorizontalReinforcement.RebarBarType.Name));
                }
                else
                {
                    body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("RebarBarType"), ""));
                }
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("DeformationType"), LabelWall.HorizontalReinforcement.DeformationType.ToString()));
                body.Elements.Add(new DocumentValueWithName(Resources.ResourceManager.GetString("BarDiameter"), LabelWall.HorizontalReinforcement.BarDiameter, UnitsConverter.GetInternalUnit(UnitType.UT_Bar_Diameter), UnitType.UT_Bar_Diameter, document.GetUnits()));

                return(body);
            }
                /// </structural_toolkit_2015>
            }
        }
Exemple #4
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;

                    case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical:
                    case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical:
                    {
                        LabelFloor labelFloor = label as LabelFloor;
                        if (labelFloor != null)
                        {
                            if (labelFloor.EnabledInternalForces.Count == 0)
                            {
                                status.AddError(Resources.ResourceManager.GetString("ErrNoChosenInternalForces"));
                            }
                            List <string> errors = VerifySteel(labelFloor.PrimaryReinforcement, true);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                            errors = VerifySteel(labelFloor.SecondaryReinforcement, false);
                            foreach (string s in errors)
                            {
                                status.AddError(s);
                            }
                        }
                    }
                    break;

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

                case StructuralAssetClass.Metal:
                    break;
                }
            }
        }