示例#1
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;
                }
                }
            }
            return(forceTypes);
        }
示例#2
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));
        }
示例#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>
            }
        }
示例#4
0
        /// <summary>
        /// Gives possibility to read data from Revit data base and puts them into user element's objects and into user section's objects and into user common parameters.
        /// </summary>
        /// <param name="listElementData">List of user element objects.</param>
        /// <param name="parameters">User common parameters.</param>
        /// <param name="data">Acces to cref="ServiceData".</param>
        public void ReadFromRevitDB(List <ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data)
        {
            // read additional information from Revit data and store them in user objects derived from ElementDataBase and listed in listElementData

            Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("ReadingGeometry"), listElementData.Count);
            ElementAnalyser elementAnalyser = new ElementAnalyser(GetInputDataUnitSystem());

            int step = 0;

            foreach (ObjectDataBase elemData in listElementData)
            {
                Element element = data.Document.GetElement(elemData.ElementId);
                if (element != null)
                {
                    switch (elemData.Category)
                    {
                    default:
                        break;

                    case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                    {
                        ColumnElement elem = elemData as ColumnElement;
                        if (elem != null && !elem.Status.IsError())
                        {
                            elem.Info = elementAnalyser.Analyse(element);
                            if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon)
                            {
                                elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus"));
                            }

                            MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific;
                            if (concrete == null || concrete.Compression < Double.Epsilon)
                            {
                                elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression"));
                            }

                            foreach (SectionDataBase sectionDataBase in elem.ListSectionData)
                            {
                                ColumnSection sec = sectionDataBase as ColumnSection;
                                if (sec != null)
                                {
                                    sec.Info = elem.Info;
                                }
                            }
                        }
                        break;
                    }

                    case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                    {
                        BeamElement elem = elemData as BeamElement;
                        if (elem != null && !elem.Status.IsError())
                        {
                            elementAnalyser.TSectionAnalysis = false;
                            LabelBeam labelBeam = elem.Label as LabelBeam;
                            if (labelBeam != null)
                            {
                                elementAnalyser.TSectionAnalysis = labelBeam.SlabBeamInteraction == BeamSectionType.WithSlabBeamInteraction;
                            }

                            elem.Info = elementAnalyser.Analyse(element);
                            if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon)
                            {
                                elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus"));
                            }

                            MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific;
                            if (concrete == null || concrete.Compression < Double.Epsilon)
                            {
                                elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression"));
                            }

                            foreach (SectionDataBase sectionDataBase in elem.ListSectionData)
                            {
                                BeamSection sec = sectionDataBase as BeamSection;
                                if (sec != null)
                                {
                                    sec.Info = elem.Info;
                                }
                            }
                        }
                        break;
                    }
                    }
                }
                Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStep(string.Format("{0:d}%", ++step * 100 / listElementData.Count));
                if (NotificationService.ProgressBreakInvoked())
                {
                    break;
                }
            }
        }
示例#5
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;
                }
            }
        }
示例#6
0
        /// <summary>
        /// Runs calculation\operations for cref="BeamSection" and cref="ColumnSection".
        /// </summary>
        /// <param name="obj">cref="BeamSection" object or cref="ColumnSection" object.</param>
        /// <returns>Result of calculation.</returns>
        public bool Run(ObjectDataBase obj)
        {
            SectionDataBase sectionData = obj as SectionDataBase;

            if (obj != null)
            {
                CommonParameters commParams = Parameters as CommonParameters;

                ForceResultsCache cache = null;
                if (commParams != null)
                {
                    cache = commParams.ResultCache;
                }

                Section sec = null;

                switch (sectionData.Category)
                {
                default:
                    break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                    if (sectionData is ColumnSection)
                    {
                        ColumnSection section = sectionData as ColumnSection;

                        if (section.Info != null)
                        {
                            SectionsInfo secInfo = section.Info.Sections.AtTheBeg;

                            if (secInfo.Sections.Count > 0)
                            {
                                sec = secInfo.Sections[0];
                            }
                        }
                    }
                    break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                    if (sectionData is BeamSection && sectionData.Label is LabelBeam)
                    {
                        BeamSection section = sectionData as BeamSection;
                        LabelBeam   label   = sectionData.Label as LabelBeam;

                        if (section.Info != null)
                        {
                            SectionsInfo secInfo = section.Info.Sections.AtTheBeg;

                            if (secInfo.Sections.Count > 0)
                            {
                                sec = secInfo.Sections[0];

                                if (label.SlabBeamInteraction == ConcreteTypes.BeamSectionType.WithSlabBeamInteraction && section.Info.Slabs != null && section.Info.Slabs.TSection != null)
                                {
                                    int    nbrPoints      = (sec.Contour != null && sec.Contour.Points != null) ? sec.Contour.Points.Count : 0;
                                    double relativeX      = (section.CalcPoint as CalcPointLinear).CoordRelative;
                                    double maxFlangeWidth = 0.5 * section.Info.SectionsParams.AtThePoint(relativeX).Dimensions.h;
                                    sec = section.Info.Slabs.TSection.GetContour(relativeX, maxFlangeWidth, maxFlangeWidth);
                                    if (sec.Contour.Points.Count != nbrPoints)
                                    {
                                        section.IsTSection = true;
                                        section.DesignInfo.Add(Resources.ResourceManager.GetString("SlabBeamInteraction"));
                                    }
                                }
                            }
                        }
                    }
                    break;
                }

                switch (sectionData.Category)
                {
                default:
                    break;

                case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical:
                case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical:
                    if (sectionData is LinearSection)
                    {
                        LinearSection section = sectionData as LinearSection;

                        if (sec != null && sec.Contour != null)
                        {
                            foreach (Autodesk.Revit.DB.XYZ p in sec.Contour.Points)
                            {
                                section.Geometry.Add(p.X, p.Y);
                            }

                            Autodesk.Revit.DB.XYZ pmin = sec.GetMinimumBoundary();
                            Autodesk.Revit.DB.XYZ pmax = sec.GetMaximumBoundary();
                            section.Width  = Math.Abs(pmin.X - pmax.X);
                            section.Height = Math.Abs(pmin.Y - pmax.Y);
                        }


                        if (cache != null)
                        {
                            IList <ForceLoadCaseDescriptor> loadCaseDescriptors = cache.GetLoadCaseDescriptors();
                            List <double> vFx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fx);
                            List <double> vFy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fy);
                            List <double> vFz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fz);
                            List <double> vMx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Mx);
                            List <double> vMy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.My);
                            List <double> vMz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Mz);

                            List <double> vUx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Ux);
                            List <double> vUy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Uy);
                            List <double> vUz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Uz);

                            int i = -1;
                            foreach (ForceLoadCaseDescriptor cas in loadCaseDescriptors)
                            {
                                i++;
                                InternalForcesLinear    linForces = new InternalForcesLinear();
                                InternalForcesContainer forces    = new InternalForcesContainer();

                                forces.CaseName   = cas.Name;
                                forces.LimitState = cas.State;

                                forces.ForceFx      = vFx.Count == 0 ? 0.0 : vFx[i];
                                forces.ForceFy      = vFy.Count == 0 ? 0.0 : vFy[i];
                                forces.ForceFz      = vFz.Count == 0 ? 0.0 : vFz[i];
                                forces.MomentMx     = vMx.Count == 0 ? 0.0 : vMx[i];
                                forces.MomentMy     = vMy.Count == 0 ? 0.0 : vMy[i];
                                forces.MomentMz     = vMz.Count == 0 ? 0.0 : vMz[i];
                                forces.DeflectionUx = vUx.Count == 0 ? 0.0 : vUx[i];
                                forces.DeflectionUy = vUy.Count == 0 ? 0.0 : vUy[i];
                                forces.DeflectionUz = vUz.Count == 0 ? 0.0 : vUz[i];

                                linForces.Forces = forces;

                                section.ListInternalForces.Add(linForces);
                            }
                        }
                    }
                    break;
                }
            }
            return(true);
        }
示例#7
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);
        }