示例#1
0
        /// <summary>
        /// Get Plate Circumference
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="plateCircumference"> plate circumference value</returns>
        public static double GetCircumference(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.kPlateBase))
                        {
                            Autodesk.AdvanceSteel.Modelling.PlateBase selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.PlateBase;
                            ret = (double)selectedObj.GetCircumference();
                        }
                        else
                        {
                            throw new System.Exception("Not a Plate Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("AS Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(Utils.FromInternalDistanceUnits(ret, true));
        }
示例#2
0
        /// <summary>
        /// Is Plate Rectangular
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="IsRectangular"> reads if the plate is rectangular - true or false</returns>
        public static bool IsRectangular(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            bool ret = false;

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    if (filerObj != null)
                    {
                        if (filerObj.IsKindOf(FilerObject.eObjectType.kPlateBase))
                        {
                            Autodesk.AdvanceSteel.Modelling.PlateBase selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.PlateBase;
                            ret = (bool)selectedObj.IsRectangular();
                        }
                        else
                        {
                            throw new System.Exception("Not a Plate Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("AS Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(ret);
        }
示例#3
0
        public static Dictionary <string, double> GetPhysicalLengthAndWidth(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            Dictionary <string, double> ret = new Dictionary <string, double>();

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    if (filerObj != null)
                    {
                        if (filerObj.IsKindOf(FilerObject.eObjectType.kPlateBase))
                        {
                            Autodesk.AdvanceSteel.Modelling.PlateBase selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.PlateBase;
                            double length = 0;
                            double width  = 0;
                            selectedObj.GetPhysLengthAndWidth(out length, out width);
                            ret.Add("Length", Utils.FromInternalDistanceUnits(length, true));
                            ret.Add("Width", Utils.FromInternalDistanceUnits(width, true));
                        }
                        else
                        {
                            throw new System.Exception("Not a Plate Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("AS Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(ret);
        }