Example #1
0
        public static string Description(this AngleProfile profile)
        {
            if (profile == null)
            {
                return("null profile");
            }

            return($"Angle {profile.Height:G3}x{profile.Width:G3}x{profile.WebThickness:G3}x{profile.FlangeThickness:G3}");
        }
        public override bool Execute(ExecutionInfo exInfo = null)
        {
            var profile = new AngleProfile(Depth, Width, FlangeThickness, WebThickness, RootRadius);

            profile.Material = Material;
            Section          = Model.Create.SectionFamily(Name, exInfo);
            Section.Profile  = profile;
            return(true);
        }
Example #3
0
        /***************************************************/

        public static double TorsionalConstant(this AngleProfile profile)
        {
            double totalWidth = profile.Width;
            double totalDepth = profile.Height;
            double tf         = profile.FlangeThickness;
            double tw         = profile.WebThickness;

            return(((totalWidth - tw / 2) * Math.Pow(tf, 3) + (totalDepth - tf / 2) * Math.Pow(tw, 3)) / 3);
        }
Example #4
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public static AngleProfile InterpolateProfile(AngleProfile startProfile, AngleProfile endProfile, double parameter, int interpolationOrder,
                                                      double domainStart = 0, double domainEnd = 1)
        {
            return(Create.AngleProfile(
                       Interpolate(startProfile.Height, endProfile.Height, parameter, interpolationOrder, domainStart, domainEnd),
                       Interpolate(startProfile.Width, endProfile.Width, parameter, interpolationOrder, domainStart, domainEnd),
                       Interpolate(startProfile.WebThickness, endProfile.WebThickness, parameter, interpolationOrder, domainStart, domainEnd),
                       Interpolate(startProfile.FlangeThickness, endProfile.FlangeThickness, parameter, interpolationOrder, domainStart, domainEnd),
                       Interpolate(startProfile.RootRadius, endProfile.RootRadius, parameter, interpolationOrder, domainStart, domainEnd),
                       Interpolate(startProfile.ToeRadius, endProfile.ToeRadius, parameter, interpolationOrder, domainStart, domainEnd),
                       startProfile.MirrorAboutLocalZ, startProfile.MirrorAboutLocalY));
        }
        public static double TorsionalConstant(this AngleProfile profile)
        {
            double b  = profile.Width;
            double h  = profile.Height;
            double tf = profile.FlangeThickness;
            double tw = profile.WebThickness;
            double r  = profile.RootRadius;

            double alpha = AlphaLJunction(tw, tf, r);
            double D     = InscribedDiameterLJunction(tw, tf, r);

            return((b * Math.Pow(tf, 3) + (h - tf) * Math.Pow(tw, 3)) / 3 + alpha * Math.Pow(D, 4) - 0.105 * Math.Pow(tf, 4) - 0.105 * Math.Pow(tw, 4));
        }
Example #6
0
        /***************************************************/

        private bool CreateProfile(string name, AngleProfile profile)
        {
            List <double> dimensionList = new List <double> {
                profile.Height, profile.Width, profile.WebThickness,
                profile.FlangeThickness, profile.RootRadius, profile.ToeRadius
            };

            double[] dimensionArray = dimensionList.ToArray();

            //List<string> valueList = new List<string> { "D", "B", "tw", "tf", "r1", "r2" };

            int lusasType = 7;

            CreateLibrarySection(name, dimensionArray, lusasType);

            return(true);
        }
Example #7
0
 private static void SetSpecificDimensions(AngleProfile dimensions, string sectionName, IMaterialFragment material, cSapModel model)
 {
     if (material is Steel || material is Aluminium)
     {
         model.PropFrame.SetSteelAngle(sectionName, material.Name, dimensions.Height, dimensions.Width, dimensions.FlangeThickness, dimensions.WebThickness, dimensions.RootRadius, dimensions.MirrorAboutLocalZ, dimensions.MirrorAboutLocalY);
     }
     else if (material is Concrete)
     {
         model.PropFrame.SetConcreteL(sectionName, material.Name, dimensions.Height, dimensions.Width, dimensions.FlangeThickness, dimensions.WebThickness, dimensions.WebThickness, dimensions.MirrorAboutLocalZ, dimensions.MirrorAboutLocalY);
     }
     else
     {
         model.PropFrame.SetAngle(sectionName, material.Name, dimensions.Height, dimensions.Width, dimensions.FlangeThickness, dimensions.WebThickness);
         if (dimensions.MirrorAboutLocalY || dimensions.MirrorAboutLocalZ)
         {
             RecordFlippingError(sectionName);
         }
     }
 }
Example #8
0
        /***************************************************/

        private bool SetProfile(AngleProfile profile, string sectionName, IMaterialFragment material)
        {
            if (material is Steel || material is Aluminium)
            {
                return(m_model.PropFrame.SetSteelAngle(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness, profile.RootRadius, profile.MirrorAboutLocalZ, profile.MirrorAboutLocalY) == 0);
            }
            else if (material is Concrete)
            {
                return(m_model.PropFrame.SetConcreteL(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness, profile.WebThickness, profile.MirrorAboutLocalZ, profile.MirrorAboutLocalY) == 0);
            }
            else
            {
                bool success = m_model.PropFrame.SetAngle(sectionName, material?.DescriptionOrName() ?? "", profile.Height, profile.Width, profile.FlangeThickness, profile.WebThickness) == 0;
                if (success && (profile.MirrorAboutLocalY || profile.MirrorAboutLocalZ))
                {
                    RecordFlippingError(sectionName);
                }
                return(success);
            }
        }
Example #9
0
        /***************************************************/

        public static string Description(this AngleProfile profile)
        {
            return("Angle " + profile.Height + "x" + profile.Width + "x" + profile.WebThickness + "x" + profile.FlangeThickness);
        }
Example #10
0
        /***************************************************/
        /****              Public methods               ****/
        /***************************************************/

        public static IFramingElementProperty FramingElementProperty(this FamilyInstance familyInstance, RevitSettings settings, Dictionary <string, List <IBHoMObject> > refObjects = null)
        {
            if (familyInstance == null || familyInstance.Symbol == null)
            {
                return(null);
            }

            ConstantFramingProperty framingProperty = refObjects.GetValue <ConstantFramingProperty>(familyInstance.Id);

            if (framingProperty != null)
            {
                return(framingProperty);
            }

            // Convert the material to BHoM.
            ElementId structuralMaterialId = familyInstance.StructuralMaterialId;

            if (structuralMaterialId.IntegerValue < 0)
            {
                structuralMaterialId = familyInstance.Symbol.LookupParameterElementId(BuiltInParameter.STRUCTURAL_MATERIAL_PARAM);
            }

            Material revitMaterial = familyInstance.Document.GetElement(structuralMaterialId) as Material;

            if (revitMaterial == null)
            {
                revitMaterial = familyInstance.Category.Material;
            }

            string materialGrade = familyInstance.MaterialGrade(settings);

            BH.oM.Physical.Materials.Material material = revitMaterial.MaterialFromRevit(materialGrade, settings, refObjects);

            // If Revit material is null, rename the BHoM material based on material type of framing family.
            if (material != null && revitMaterial == null)
            {
                material.Name = String.Format("Unknown {0} Material", familyInstance.StructuralMaterialType);
                material.Properties.Add(familyInstance.StructuralMaterialType.EmptyMaterialFragment(materialGrade));
            }

            IProfile profile = familyInstance.Symbol.ProfileFromRevit(settings, refObjects);

            if (profile == null)
            {
                familyInstance.Symbol.NotConvertedWarning();
            }

            if (familyInstance.Mirrored)
            {
                if (profile is FreeFormProfile)
                {
                    BH.oM.Geometry.Plane mirror = new oM.Geometry.Plane {
                        Normal = BH.oM.Geometry.Vector.XAxis
                    };
                    profile = BH.Engine.Spatial.Create.FreeFormProfile(profile.Edges.Select(x => x.IMirror(mirror)));
                }
                else if (profile is AngleProfile)
                {
                    AngleProfile angle = ((AngleProfile)profile);
                    profile = BH.Engine.Spatial.Create.AngleProfile(angle.Height, angle.Width, angle.WebThickness, angle.FlangeThickness, angle.RootRadius, angle.ToeRadius, true, false);
                }
                else if (profile is ChannelProfile)
                {
                    ChannelProfile channel = ((ChannelProfile)profile);
                    profile = BH.Engine.Spatial.Create.ChannelProfile(channel.Height, channel.FlangeWidth, channel.WebThickness, channel.FlangeThickness, channel.RootRadius, channel.ToeRadius, true);
                }
            }

            double rotation = familyInstance.OrientationAngle(settings);

            framingProperty = BH.Engine.Physical.Create.ConstantFramingProperty(profile, material, rotation, familyInstance.Symbol.Name);

            //Set identifiers, parameters & custom data
            framingProperty.SetIdentifiers(familyInstance.Symbol);
            framingProperty.CopyParameters(familyInstance.Symbol, settings.ParameterSettings);
            framingProperty.SetProperties(familyInstance.Symbol, settings.ParameterSettings);

            refObjects.AddOrReplace(familyInstance.Id, framingProperty);
            return(framingProperty);
        }
Example #11
0
        /***************************************************/
        /****** Set Profile                          *******/
        /***************************************************/

        private bool SetProfile(AngleProfile bhomProfile, string sectionName, string matName)
        {
            int ret = m_model.PropFrame.SetAngle(sectionName, matName, bhomProfile.Height, bhomProfile.Width, bhomProfile.FlangeThickness, bhomProfile.WebThickness);

            return(ret == 0);
        }
Example #12
0
 private (double[], int, string) GetProfileDimensions(AngleProfile profile)
 {
     return(new double[] { profile.Width, profile.Height, 0, profile.FlangeThickness, profile.WebThickness, 0 }, St7.bsLSection, profile.Name);
 }