Example #1
0
        private void onChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
        {
            String elementTypeName = e.Editor.GetEntity().Schema.SchemaName;

            if (elementTypeName == "LabelColumn")
            {
                LabelColumn obj = new LabelColumn();
                obj.SetProperties(e.Entity as Autodesk.Revit.DB.ExtensibleStorage.Entity, e.Document);

                e.Editor.SetAttribute("LengthCoefficientY", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionY, DisplayUnitType.DUT_UNDEFINED);
                e.Editor.SetAttribute("ColumnStructureTypeY", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionY, DisplayUnitType.DUT_UNDEFINED);
                e.Editor.SetAttribute("LengthCoefficientZ", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionZ, DisplayUnitType.DUT_UNDEFINED);
                e.Editor.SetAttribute("ColumnStructureTypeZ", FieldUIAttribute.PropertyIsEnabled, obj.BucklingDirectionZ, DisplayUnitType.DUT_UNDEFINED);
            }
        }
Example #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;
                }
                }
            }
            return(forceTypes);
        }
Example #3
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));
        }
Example #4
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>
            }
        }
Example #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;
                }
            }
        }
Example #6
0
 private void InitializeComponent()
 {
     this.pickButton             = new System.Windows.Forms.Button();
     this.cancelButton           = new System.Windows.Forms.Button();
     this.conditionGrid          = new System.Windows.Forms.DataGridView();
     this.okButton               = new System.Windows.Forms.Button();
     this.panel1                 = new System.Windows.Forms.Panel();
     this.splitContainer1        = new System.Windows.Forms.SplitContainer();
     this.label1                 = new System.Windows.Forms.Label();
     this.testButton             = new System.Windows.Forms.Button();
     this.clearButton            = new System.Windows.Forms.Button();
     this.conditionEnabledColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
     this.conditionNameColumn    = new Roro.Activities.LabelColumn();
     this.conditionValueColumn   = new System.Windows.Forms.DataGridViewTextBoxColumn();
     ((System.ComponentModel.ISupportInitialize)(this.conditionGrid)).BeginInit();
     this.panel1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
     this.splitContainer1.Panel1.SuspendLayout();
     this.splitContainer1.Panel2.SuspendLayout();
     this.splitContainer1.SuspendLayout();
     this.SuspendLayout();
     //
     // pickButton
     //
     this.pickButton.Location = new System.Drawing.Point(12, 12);
     this.pickButton.Name     = "pickButton";
     this.pickButton.Size     = new System.Drawing.Size(75, 23);
     this.pickButton.TabIndex = 0;
     this.pickButton.TabStop  = false;
     this.pickButton.Text     = "Pick";
     this.pickButton.UseVisualStyleBackColor = true;
     this.pickButton.Click += new System.EventHandler(this.PickButton_Click);
     //
     // cancelButton
     //
     this.cancelButton.Anchor                  = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.cancelButton.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
     this.cancelButton.Location                = new System.Drawing.Point(447, 12);
     this.cancelButton.Name                    = "cancelButton";
     this.cancelButton.Size                    = new System.Drawing.Size(75, 23);
     this.cancelButton.TabIndex                = 1;
     this.cancelButton.TabStop                 = false;
     this.cancelButton.Text                    = "Cancel";
     this.cancelButton.UseVisualStyleBackColor = true;
     //
     // conditionGrid
     //
     this.conditionGrid.AutoSizeColumnsMode         = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
     this.conditionGrid.AutoSizeRowsMode            = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
     this.conditionGrid.BackgroundColor             = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(225)))), ((int)(((byte)(230)))));
     this.conditionGrid.BorderStyle                 = System.Windows.Forms.BorderStyle.None;
     this.conditionGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     this.conditionGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
         this.conditionEnabledColumn,
         this.conditionNameColumn,
         this.conditionValueColumn
     });
     this.conditionGrid.Dock = System.Windows.Forms.DockStyle.Fill;
     this.conditionGrid.EnableHeadersVisualStyles = false;
     this.conditionGrid.Location = new System.Drawing.Point(0, 0);
     this.conditionGrid.Name     = "conditionGrid";
     this.conditionGrid.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
     this.conditionGrid.Size     = new System.Drawing.Size(510, 220);
     this.conditionGrid.TabIndex = 2;
     this.conditionGrid.TabStop  = false;
     //
     // okButton
     //
     this.okButton.Anchor                  = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.okButton.DialogResult            = System.Windows.Forms.DialogResult.OK;
     this.okButton.Location                = new System.Drawing.Point(366, 12);
     this.okButton.Name                    = "okButton";
     this.okButton.Size                    = new System.Drawing.Size(75, 23);
     this.okButton.TabIndex                = 3;
     this.okButton.TabStop                 = false;
     this.okButton.Text                    = "OK";
     this.okButton.UseVisualStyleBackColor = true;
     //
     // panel1
     //
     this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(235)))), ((int)(((byte)(240)))));
     this.panel1.Controls.Add(this.splitContainer1);
     this.panel1.Controls.Add(this.testButton);
     this.panel1.Controls.Add(this.clearButton);
     this.panel1.Controls.Add(this.pickButton);
     this.panel1.Controls.Add(this.okButton);
     this.panel1.Controls.Add(this.cancelButton);
     this.panel1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.panel1.Location = new System.Drawing.Point(0, 0);
     this.panel1.Name     = "panel1";
     this.panel1.Size     = new System.Drawing.Size(534, 311);
     this.panel1.TabIndex = 4;
     //
     // splitContainer1
     //
     this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                          | System.Windows.Forms.AnchorStyles.Left)
                                                                         | System.Windows.Forms.AnchorStyles.Right)));
     this.splitContainer1.FixedPanel      = System.Windows.Forms.FixedPanel.Panel2;
     this.splitContainer1.IsSplitterFixed = true;
     this.splitContainer1.Location        = new System.Drawing.Point(12, 41);
     this.splitContainer1.Name            = "splitContainer1";
     this.splitContainer1.Orientation     = System.Windows.Forms.Orientation.Horizontal;
     //
     // splitContainer1.Panel1
     //
     this.splitContainer1.Panel1.Controls.Add(this.conditionGrid);
     //
     // splitContainer1.Panel2
     //
     this.splitContainer1.Panel2.Controls.Add(this.label1);
     this.splitContainer1.Panel2.Paint    += new System.Windows.Forms.PaintEventHandler(this.splitContainer1_Panel2_Paint);
     this.splitContainer1.Size             = new System.Drawing.Size(510, 258);
     this.splitContainer1.SplitterDistance = 220;
     this.splitContainer1.TabIndex         = 6;
     this.splitContainer1.TabStop          = false;
     //
     // label1
     //
     this.label1.BackColor = System.Drawing.Color.Yellow;
     this.label1.Dock      = System.Windows.Forms.DockStyle.Fill;
     this.label1.Location  = new System.Drawing.Point(0, 0);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(510, 34);
     this.label1.TabIndex  = 0;
     this.label1.Text      = "Press CTRL key to pick the highlighted element";
     this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // testButton
     //
     this.testButton.Location = new System.Drawing.Point(93, 12);
     this.testButton.Name     = "testButton";
     this.testButton.Size     = new System.Drawing.Size(75, 23);
     this.testButton.TabIndex = 5;
     this.testButton.TabStop  = false;
     this.testButton.Text     = "Test";
     this.testButton.UseVisualStyleBackColor = true;
     this.testButton.Click += new System.EventHandler(this.TestButton_Click);
     //
     // clearButton
     //
     this.clearButton.Location = new System.Drawing.Point(174, 12);
     this.clearButton.Name     = "clearButton";
     this.clearButton.Size     = new System.Drawing.Size(75, 23);
     this.clearButton.TabIndex = 4;
     this.clearButton.TabStop  = false;
     this.clearButton.Text     = "Clear";
     this.clearButton.UseVisualStyleBackColor = true;
     this.clearButton.Click += new System.EventHandler(this.ClearButton_Click);
     //
     // conditionEnabledColumn
     //
     this.conditionEnabledColumn.DataPropertyName = "Use";
     this.conditionEnabledColumn.FillWeight       = 10F;
     this.conditionEnabledColumn.HeaderText       = "Use";
     this.conditionEnabledColumn.Name             = "conditionEnabledColumn";
     this.conditionEnabledColumn.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
     this.conditionEnabledColumn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
     //
     // conditionNameColumn
     //
     this.conditionNameColumn.DataPropertyName = "Name";
     this.conditionNameColumn.FillWeight       = 30F;
     this.conditionNameColumn.HeaderText       = "Name";
     this.conditionNameColumn.Name             = "conditionNameColumn";
     this.conditionNameColumn.ReadOnly         = true;
     this.conditionNameColumn.Resizable        = System.Windows.Forms.DataGridViewTriState.True;
     this.conditionNameColumn.SortMode         = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
     //
     // conditionValueColumn
     //
     this.conditionValueColumn.DataPropertyName = "Value";
     this.conditionValueColumn.FillWeight       = 60F;
     this.conditionValueColumn.HeaderText       = "Value";
     this.conditionValueColumn.Name             = "conditionValueColumn";
     //
     // ElementPickerForm
     //
     this.AcceptButton = this.okButton;
     this.CancelButton = this.cancelButton;
     this.ClientSize   = new System.Drawing.Size(534, 311);
     this.Controls.Add(this.panel1);
     this.Font            = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Name            = "ElementPickerForm";
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text            = "Element Picker";
     this.TopMost         = true;
     this.Load           += new System.EventHandler(this.ElementPickerForm_Load);
     ((System.ComponentModel.ISupportInitialize)(this.conditionGrid)).EndInit();
     this.panel1.ResumeLayout(false);
     this.splitContainer1.Panel1.ResumeLayout(false);
     this.splitContainer1.Panel2.ResumeLayout(false);
     ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
     this.splitContainer1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
Example #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);
        }