예제 #1
0
        /// <summary>
        /// Get Beam Weight Per Meter
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="beamWeightPerMeter"> The beam weight per meter</returns>
        public static double GetWeightPerMeter(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            double ret = 0;

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    if (filerObj != null)
                    {
                        if (filerObj.IsKindOf(FilerObject.eObjectType.kBeam))
                        {
                            Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam;
                            ret = (double)selectedObj.GetWeightPerMeter();
                        }
                        else
                        {
                            throw new System.Exception("Not a BEAM Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("AS Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(Utils.FromInternalWeightPerDistanceUnits(ret, true));
        }
예제 #2
0
        public static Dictionary <string, object> GetBeamData(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                                              [DefaultArgument("0")] int bodyResolutionForLength)
        {
            Dictionary <string, object> ret = new Dictionary <string, object>();

            double length          = 0;
            double paintArea       = 0;
            double weight          = 0;
            double weightPerUnit   = 0;
            int    profileType     = 0;
            string profileTypeCode = "No Code";

            ret.Add("Length", length);
            ret.Add("PaintArea", paintArea);
            ret.Add("ExactWeight", weight);
            ret.Add("WeightPerUnit", weightPerUnit);
            ret.Add("ProfileType", profileType);
            ret.Add("ProfileTypeCode", profileTypeCode);

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    if (filerObj != null)
                    {
                        if (filerObj.IsKindOf(FilerObject.eObjectType.kBeam))
                        {
                            Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam;
                            length                 = selectedObj.GetLength((BodyContext.eBodyContext)bodyResolutionForLength);
                            paintArea              = selectedObj.GetPaintArea();
                            weight                 = selectedObj.GetWeight(2);
                            weightPerUnit          = selectedObj.GetWeightPerMeter();
                            profileTypeCode        = selectedObj.GetProfType().GetDSTVValues().GetProfileTypeString();
                            profileType            = (int)selectedObj.GetProfType().GetDSTVValues().DSTVType;
                            ret["Length"]          = Utils.FromInternalDistanceUnits(length, true);
                            ret["PaintArea"]       = Utils.FromInternalAreaUnits(paintArea, true);
                            ret["ExactWeight"]     = Utils.FromInternalWeightUnits(weight, true);
                            ret["WeightPerUnit"]   = Utils.FromInternalWeightPerDistanceUnits(weightPerUnit, true);
                            ret["ProfileType"]     = profileType;
                            ret["ProfileTypeCode"] = profileTypeCode;
                        }
                        else
                        {
                            throw new System.Exception("Not a BEAM Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("No AS Steel Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("No Steel Object or Point is null");
                }
            }
            return(ret);
        }