Exemple #1
0
 /// <summary>
 /// Create an Advance Steel Beam Shorting from the End of the Beam by a Value
 /// </summary>
 /// <param name="element"> Input Beam</param>
 /// <param name="shorteningLength"> Input shortening Value</param>
 /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Cut Build Properties </param>
 /// <returns name="planeCut">planeCut</returns>
 public static BeamPlaneCut ByEndValue(AdvanceSteel.Nodes.SteelDbObject element,
                                       double shorteningLength,
                                       [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
 {
     additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters);
     return(new BeamPlaneCut(element, 1, Utils.ToInternalDistanceUnits(shorteningLength, true), additionalBeamFeatureParameters));
 }
Exemple #2
0
        /// <summary>
        /// Get Advance Steel Grid Numbering Type
        /// </summary>
        /// <param name="steelObject"> Selected Advance Steel Grid Object</param>
        /// <returns>Int = 0 - User Defined, 1 - Lowercase, 2 - Uppercase, 3 - Numerical</returns>
        public static int GetGridNumberingType(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            int ret = -1;

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject myGrid = Utils.GetObject(steelObject.Handle);
                    if (myGrid != null)
                    {
                        if (myGrid.IsKindOf(FilerObject.eObjectType.kGrid))
                        {
                            Autodesk.AdvanceSteel.Modelling.Grid selectedObj = myGrid as Autodesk.AdvanceSteel.Modelling.Grid;
                            ret = (int)selectedObj.NumberingType;
                        }
                        else
                        {
                            throw new System.Exception("Not a Grid Object");
                        }
                    }
                    else
                    {
                        throw new System.Exception("AS Object is null");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(ret);
        }
Exemple #3
0
        /// <summary>
        /// Get Beam Length relative to object display
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <param name="bodyResolutionForLength"> Set Steel body display resolution</param>
        /// <returns name="beamLength"> The beam length value based on a particular beam display mode / resolution</returns>
        public static double GetLength(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                       [DefaultArgument("0")] int bodyResolutionForLength)
        {
            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.GetLength((BodyContext.eBodyContext)bodyResolutionForLength);
                        }
                        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.FromInternalDistanceUnits(ret, true));
        }
Exemple #4
0
 /// <summary>
 /// Set Beam Cross Section to be Mirrored - i.e. Channels with toe pointing in the opposite direction
 /// </summary>
 /// <param name="steelObject"> Advance Steel element</param>
 /// <param name="crossSectionMirrored"> Input True or False Value</param>
 public static void SetBeamCrossSectionMirrored(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                                [DefaultArgument("true")] bool crossSectionMirrored)
 {
     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;
                     selectedObj.SetCrossSectionMirrored(crossSectionMirrored);
                 }
                 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 is null");
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Get Beam Insert Reference Axis
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="beamReferenceAxis"> Integer value for beam reference axis</returns>
        public static int GetBeamReferenceAxis(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            int ret = -1;

            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 = (int)selectedObj.RefAxis;
                        }
                        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(ret);
        }
Exemple #6
0
        public static void SetSection(AdvanceSteel.Nodes.SteelDbObject beamElement, string sectionName)
        {
            using (var ctx = new SteelServices.DocContext())
            {
                string handle = beamElement.Handle;

                FilerObject obj = Utils.GetObject(handle);

                if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kBeam))
                {
                    string sectionType = Utils.SplitSectionName(sectionName)[0];
                    string sectionSize = Utils.SplitSectionName(sectionName)[1];

                    Autodesk.AdvanceSteel.Modelling.Beam beam = obj as Autodesk.AdvanceSteel.Modelling.Beam;
                    if (obj.IsKindOf(FilerObject.eObjectType.kCompoundBeam) && !Utils.CompareCompoundSectionTypes(beam.ProfSectionType, sectionType))
                    {
                        throw new System.Exception("Failed to change section as compound section type is different");
                    }
                    beam.ChangeProfile(sectionType, sectionSize);
                }
                else
                {
                    throw new System.Exception("Failed to change section");
                }
            }
        }
Exemple #7
0
 /// <summary>
 /// Set Beam System Line End Point
 /// </summary>
 /// <param name="steelObject"> Advance Steel element</param>
 /// <param name="point"> Input Dynamo Point</param>
 public static void SetSystemLineEndPoint(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                          Autodesk.DesignScript.Geometry.Point point)
 {
     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;
                     selectedObj.SetSysEnd(Utils.ToAstPoint(point, true));
                 }
                 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 is null");
         }
     }
 }
Exemple #8
0
        /// <summary>
        /// Get Quantity in Model
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="objectQuantity"> steelobject total quantity in the current model - numbering needs to be completed</returns>
        public static int GetQuantityInModel(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            int ret = -1;

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    if (filerObj != null)
                    {
                        if (filerObj.IsKindOf(FilerObject.eObjectType.kAtomicElem))
                        {
                            AtomicElement selectedObj = filerObj as AtomicElement;
                            ret = (int)selectedObj.GetQuantityInModel();
                        }
                        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(ret);
        }
Exemple #9
0
        /// <summary>
        /// Get assembly location: Unkown = -1, 0 = On Site, 1 = Site Drilled, 2 = In Shop
        /// </summary>
        /// <param name="screwBolts">Input connection object </param>
        /// <returns name="assemblyLocation">An integer that represents the assembly location</returns>
        public static int GetBoltAssemblyLocation(AdvanceSteel.Nodes.SteelDbObject screwBolts)
        {
            int ret = -1;

            using (var ctx = new SteelServices.DocContext())
            {
                if (screwBolts != null)
                {
                    Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern obj = Utils.GetObject(screwBolts.Handle) as Autodesk.AdvanceSteel.Modelling.ScrewBoltPattern;
                    if (obj != null)
                    {
                        ret = (int)obj.AssemblyLocation;
                    }
                    else
                    {
                        throw new System.Exception("failed to get the connection object");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(ret);
        }
Exemple #10
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));
        }
Exemple #11
0
        /// <summary>
        /// Get anchor bolt orientation type: NormalOrientation = 0, 1 = DiagonalInside, 2 = DiagonalOutside, 3 = AllOutside, 4 = AllInside, 5 = InsideRotated, 6 = OutsideRotated
        /// </summary>
        /// <param name="anchorBolts">Input anchor bolts object </param>
        /// <returns name="orientation">An integer that represents the orientation</returns>
        public static int GetAnchorBoltOrientation(AdvanceSteel.Nodes.SteelDbObject anchorBolts)
        {
            int ret = -1;

            using (var ctx = new SteelServices.DocContext())
            {
                if (anchorBolts != null)
                {
                    Autodesk.AdvanceSteel.Modelling.AnchorPattern obj = Utils.GetObject(anchorBolts.Handle) as Autodesk.AdvanceSteel.Modelling.AnchorPattern;
                    if (obj != null)
                    {
                        ret = (int)obj.OrientationType;
                    }
                    else
                    {
                        throw new System.Exception("failed to get the connection object");
                    }
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(ret);
        }
Exemple #12
0
 /// <summary>
 /// Create an Advance Steel Beam Plane Cut by Coordinate System
 /// </summary>
 /// <param name="element"> Input Beam</param>
 /// <param name="coordinateSystem"> Input Dynamo CoordinateSytem</param>
 /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Cut Build Properties </param>
 /// <returns name="planeCut">planeCut</returns>
 public static BeamPlaneCut ByCS(AdvanceSteel.Nodes.SteelDbObject element,
                                 Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem,
                                 [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
 {
     additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters);
     return(new BeamPlaneCut(element, Utils.ToAstPoint(coordinateSystem.Origin, true), Utils.ToAstVector3d(coordinateSystem.ZAxis, true), additionalBeamFeatureParameters));
 }
Exemple #13
0
        /// <summary>
        /// This node can set User attributes for Advance Steel elements from Dynamo
        /// </summary>
        /// <param name="element">Advance Steel element</param>
        /// <param name="AttIdx">The index of the User attribute. Is a number between 1 and 10</param>
        /// <param name="value">Attribute value</param>
        /// <returns></returns>
        public static void SetUserAttribute(AdvanceSteel.Nodes.SteelDbObject element, int AttIdx, string value)
        {
            if (AttIdx < 1 || AttIdx > 10)
            {
                throw new System.Exception("Attribute index is not in the range from 1 to 10");
            }

            using (var ctx = new SteelServices.DocContext())
            {
                string handle = element.Handle;

                FilerObject   obj    = Utils.GetObject(handle);
                AtomicElement atomic = obj as AtomicElement;

                if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kAtomicElem))
                {
                    //[1, 10] ->[0 ,9]
                    AttIdx = AttIdx - 1;

                    atomic.SetUserAttribute(AttIdx, value);
                }
                else
                {
                    throw new System.Exception("Failed to set attribute");
                }
            }
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
Exemple #16
0
 /// <summary>
 /// Create an Advance Steel Beam Plane Cut by Point and Normal
 /// </summary>
 /// <param name="element"></param>
 /// <param name="origin"></param>
 /// <param name="normal"></param>
 /// <param name="additionalBeamFeatureParameters"></param>
 /// <returns name="planeCut">planeCut</returns>
 public static BeamPlaneCut ByPointAndNormal(AdvanceSteel.Nodes.SteelDbObject element,
                                             Autodesk.DesignScript.Geometry.Point origin,
                                             Autodesk.DesignScript.Geometry.Vector normal,
                                             [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
 {
     additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters);
     return(new BeamPlaneCut(element, Utils.ToAstPoint(origin, true), Utils.ToAstVector3d(normal, true), additionalBeamFeatureParameters));
 }
Exemple #17
0
 /// <summary>
 /// Create an Advance Steel corner feature - Straight Cut
 /// </summary>
 /// <param name="element"> Input Plate</param>
 /// <param name="length1"> Input Chamfer Length Value 1</param>
 /// <param name="length2"> Input Chamfer Length Value 2</param>
 /// <param name="plateFoldIndex"> Input plate fold number, 0 for normal plate, zero or greater for folded plate</param>
 /// <param name="cornerIndex"> Input corner number around the edge of the plate</param>
 /// <param name="additionalPlateFeatureParameters"> Optional Input Plate Cut Build Properties </param>
 /// <returns name="vertexCut">vertexCut</returns>
 public static PlateVertexCut ByChamfer(AdvanceSteel.Nodes.SteelDbObject element,
                                        double length1,
                                        double length2,
                                        [DefaultArgument("0")] int plateFoldIndex,
                                        [DefaultArgument("0")] short cornerIndex,
                                        [DefaultArgument("null")] List <Property> additionalPlateFeatureParameters)
 {
     additionalPlateFeatureParameters = PreSetDefaults(additionalPlateFeatureParameters, plateFoldIndex, cornerIndex, Utils.ToInternalDistanceUnits(length1, true), Utils.ToInternalDistanceUnits(length2, true));
     return(new PlateVertexCut(element, 2, additionalPlateFeatureParameters));
 }
Exemple #18
0
 /// <summary>
 /// Create an Advance Steel rotated Cope feature
 /// </summary>
 /// <param name="element"> Input Plate</param>
 /// <param name="end"> Input Beam End for Cope 1 - Start, 2 - End</param>
 /// <param name="side"> Input Beam Side for Cope 1 - Upper, 2 - Lower</param>
 /// <param name="length"> Input Length of Cope</param>
 /// <param name="depth"> Input depth of Cope</param>
 /// <param name="cornerRadius"> Input Cope radius at Corner</param>
 /// <param name="cornerType"> 0 - Straight, 1 - Round, 2 - Boring Hole</param>
 /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Feature Build Properties </param>
 /// <returns name="beamCope">beamCope</returns>
 public static BeamCope ByRectangularOrthoCope(AdvanceSteel.Nodes.SteelDbObject element,
                                               int end, int side,
                                               double length, double depth,
                                               [DefaultArgument("0")] double cornerRadius,
                                               [DefaultArgument("0")] int cornerType,
                                               [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
 {
     additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters, Utils.ToInternalDistanceUnits(length, true), Utils.ToInternalDistanceUnits(depth, true));
     return(new BeamCope(element, end, side, cornerType, Utils.ToInternalDistanceUnits(cornerRadius, true), additionalBeamFeatureParameters));
 }
Exemple #19
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="element"> Input Plate</param>
 /// <param name="radius"> Input Radius</param>
 /// <param name="xOffset"> Input X Offset from plate orgin</param>
 /// <param name="yOffset"> Input Y Offset from plate orgin</param>
 /// <param name="corner"> 0 - TL, 1 - TR, 2 - BR, 3 - BL, else center</param>
 /// <param name="additionalPlateFeatureParameters"> Optional Input Plate Build Properties </param>
 /// <returns name="polyCut">polyCut</returns>
 public static PlatePolycut ByRadius(AdvanceSteel.Nodes.SteelDbObject element,
                                     double radius,
                                     [DefaultArgument("0")] double xOffset,
                                     [DefaultArgument("0")] double yOffset,
                                     [DefaultArgument("-1")] int corner,
                                     [DefaultArgument("null")] List <Property> additionalPlateFeatureParameters)
 {
     additionalPlateFeatureParameters = PreSetDefaults(additionalPlateFeatureParameters, 0, 0, Utils.ToInternalDistanceUnits(radius, true));
     return(new PlatePolycut(element, Utils.ToInternalDistanceUnits(xOffset, true), Utils.ToInternalDistanceUnits(yOffset, true), corner, 1, additionalPlateFeatureParameters));
 }
Exemple #20
0
        /// <summary>
        /// Create an Advance Steel Polycut driven by Dynamo Curves on a Beam
        /// </summary>
        /// <param name="element"> Input Beam</param>
        /// <param name="curves"> Input Dynamo Curves referencing Clockwise in sequence to form a closed polyline</param>
        /// <param name="lengthVec"> Input vector in the length direction of rectangular polycut</param>
        /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Feature Build Properties </param>
        /// <returns name="polyCut">polyCut</returns>
        public static BeamPolycut FromListCurves(AdvanceSteel.Nodes.SteelDbObject element,
                                                 List <Autodesk.DesignScript.Geometry.Curve> curves,
                                                 Autodesk.DesignScript.Geometry.Vector lengthVec,
                                                 [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
        {
            Polyline3d curveCreatedPolyline = Utils.ToAstPolyline3d(curves, true);

            additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters);
            return(new BeamPolycut(element,
                                   curveCreatedPolyline,
                                   curveCreatedPolyline.Normal,
                                   Utils.ToAstVector3d(lengthVec, true),
                                   additionalBeamFeatureParameters));//ToAstPolyline3d
        }
Exemple #21
0
 /// <summary>
 /// Create an Advance Steel corner feature - fillet Cut
 /// </summary>
 /// <param name="element"> Input Plate</param>
 /// <param name="radius"> Input Radius</param>
 /// <param name="filletType"> Input 0 - Convex and 1 - Concave</param>
 /// <param name="plateFoldIndex"> Input plate fold number, 0 for normal plate, zero or greater for folded plate</param>
 /// <param name="cornerIndex"> Input corner number around the edge of the plate</param>
 /// <param name="additionalPlateFeatureParameters"> Optional Input Plate Cut Build Properties </param>
 /// <returns name="vertexCut">vertexCut</returns>
 public static PlateVertexCut ByRadius(AdvanceSteel.Nodes.SteelDbObject element,
                                       double radius,
                                       [DefaultArgument("0")] int filletType,
                                       [DefaultArgument("0")] int plateFoldIndex,
                                       [DefaultArgument("0")] short cornerIndex,
                                       [DefaultArgument("null")] List <Property> additionalPlateFeatureParameters)
 {
     if (filletType != 0 && filletType != 1)
     {
         throw new System.Exception("Fillet Type Can only be 0 or 1");
     }
     additionalPlateFeatureParameters = PreSetDefaults(additionalPlateFeatureParameters, plateFoldIndex, cornerIndex, 0, 0, Utils.ToInternalDistanceUnits(radius, true));
     return(new PlateVertexCut(element, filletType, additionalPlateFeatureParameters));
 }
Exemple #22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="element"> Input Beam</param>
        /// <param name="polyCurve"> Input Dynamo PolyCurve Object</param>
        /// <param name="lengthVec"> Input vector in the length direction of rectangular polycut</param>
        /// <param name="additionalPlateFeatureParameters"> Optional Input Plate Notch Countour Build Properties </param>
        /// <returns name="polyCut">polyCut</returns>
        public static PlatePolycut FromPolyCurve(AdvanceSteel.Nodes.SteelDbObject element,
                                                 Autodesk.DesignScript.Geometry.PolyCurve polyCurve,
                                                 Autodesk.DesignScript.Geometry.Vector lengthVec,
                                                 [DefaultArgument("null")] List <Property> additionalPlateFeatureParameters)
        {
            Polyline3d curveCreatedPolyline = Utils.ToAstPolyline3d(polyCurve, true);

            additionalPlateFeatureParameters = PreSetDefaults(additionalPlateFeatureParameters);
            return(new PlatePolycut(element,
                                    curveCreatedPolyline,
                                    curveCreatedPolyline.Normal,
                                    Utils.ToAstVector3d(lengthVec, true),
                                    additionalPlateFeatureParameters));
        }
Exemple #23
0
 /// <summary>
 /// Create an Advance Steel Circular Polycut feature by Radius
 /// </summary>
 /// <param name="element"> Input Plate</param>
 /// <param name="circularInsertPoint"> Input Insert Point for Rectangular polycut on Beam</param>
 /// <param name="normal"> Input normal vector to rectangular polycut</param>
 /// <param name="lengthVec"> Input vector in the length direction of rectangular polycut</param>
 /// <param name="radius"> Input Radius of Cut</param>
 /// <param name="corner">0 - TL, 1 - TR, 2 - BR, 3 - BL, else center</param>
 /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Feature Build Properties </param>
 /// <returns name="polyCut">polyCut</returns>
 public static BeamPolycut ByRadius(AdvanceSteel.Nodes.SteelDbObject element,
                                    Autodesk.DesignScript.Geometry.Point circularInsertPoint,
                                    Autodesk.DesignScript.Geometry.Vector normal,
                                    Autodesk.DesignScript.Geometry.Vector lengthVec,
                                    double radius,
                                    [DefaultArgument("-1")] int corner,
                                    [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
 {
     additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters, 0, 0, Utils.ToInternalDistanceUnits(radius, true));
     return(new BeamPolycut(element, 0, Utils.ToAstPoint(circularInsertPoint, true),
                            Utils.ToAstVector3d(normal, true),
                            Utils.ToAstVector3d(lengthVec, true),
                            corner,
                            additionalBeamFeatureParameters));
 }
Exemple #24
0
        /// <summary>
        /// Get weight from the steel object
        /// </summary>
        /// <param name="steelObject">Input steel object</param>
        /// <returns name="weight">The weight from the steel object</returns>
        public static double GetWeight(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            double ret = 0;

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null)
                {
                    ret = Utils.GetWeight(steelObject.Handle, 0);
                }
                else
                {
                    throw new System.Exception("Steel Object or Point is null");
                }
            }
            return(Utils.FromInternalWeightUnits(ret, true));
        }
Exemple #25
0
        /// <summary>
        /// Create an Advance Steel Rectangular Polycut feature by Length and Width
        /// </summary>
        /// <param name="element"> Input Plate</param>
        /// <param name="rectangle"> Input Dynamo Rectangle</param>
        /// <param name="lengthVec"> Input vector in the length direction of rectangular polycut</param>
        /// <param name="corner">0 - TL, 1 - TR, 2 - BR, 3 - BL, else center</param>
        /// <param name="additionalBeamFeatureParameters"> Optional Input Beam Feature Build Properties </param>
        /// <returns name="polyCut">polyCut</returns>
        public static BeamPolycut ByRectangle(AdvanceSteel.Nodes.SteelDbObject element,
                                              Autodesk.DesignScript.Geometry.Rectangle rectangle,
                                              Autodesk.DesignScript.Geometry.Vector lengthVec,
                                              [DefaultArgument("-1")] int corner,
                                              [DefaultArgument("null")] List <Property> additionalBeamFeatureParameters)
        {
            Autodesk.DesignScript.Geometry.Point  rectangleInsertPoint = rectangle.Center();
            Autodesk.DesignScript.Geometry.Vector normal = rectangle.Normal;
            double length = rectangle.Width;
            double width  = rectangle.Height;

            additionalBeamFeatureParameters = PreSetDefaults(additionalBeamFeatureParameters, Utils.ToInternalDistanceUnits(length, true), Utils.ToInternalDistanceUnits(width, true));
            return(new BeamPolycut(element, 0, Utils.ToAstPoint(rectangleInsertPoint, true),
                                   Utils.ToAstVector3d(normal, true),
                                   Utils.ToAstVector3d(lengthVec, true),
                                   corner,
                                   additionalBeamFeatureParameters));
        }
Exemple #26
0
 /// <summary>
 /// Return Dynamo Line object from the Beam System Line. Supports Straight Beam, Tapered Beam, Unfolded Beam or Compound Beam
 /// </summary>
 /// <param name="steelObject"> Advance Steel element</param>
 /// <returns name="line"> beam system line as line object</returns>
 public static Autodesk.DesignScript.Geometry.Line GetBeamLine(AdvanceSteel.Nodes.SteelDbObject steelObject)
 {
     Autodesk.DesignScript.Geometry.Line ret = null;
     using (var ctx = new SteelServices.DocContext())
     {
         if (steelObject != null)
         {
             FilerObject filerObj = Utils.GetObject(steelObject.Handle);
             if (filerObj != null)
             {
                 if (filerObj.IsKindOf(FilerObject.eObjectType.kStraightBeam) ||
                     filerObj.IsKindOf(FilerObject.eObjectType.kBeamTapered) ||
                     filerObj.IsKindOf(FilerObject.eObjectType.kUnfoldedStraightBeam) ||
                     filerObj.IsKindOf(FilerObject.eObjectType.kCompoundStraightBeam))
                 {
                     Autodesk.AdvanceSteel.Modelling.Beam selectedObj = filerObj as Autodesk.AdvanceSteel.Modelling.Beam;
                     Point3d foundStartPoint = selectedObj.GetPointAtStart();
                     Point3d foundEndPoint   = selectedObj.GetPointAtEnd();
                     if (foundStartPoint != null || foundEndPoint != null)
                     {
                         ret = Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(Utils.ToDynPoint(foundStartPoint, true), Utils.ToDynPoint(foundEndPoint, true));
                     }
                     else
                     {
                         throw new System.Exception("No Points wer returned from the Object");
                     }
                 }
                 else
                 {
                     throw new System.Exception("Not a Straight Beam, Tapered Beam, Unfolded Beam or Compound Beam Object");
                 }
             }
             else
             {
                 throw new System.Exception("AS Object is null");
             }
         }
         else
         {
             throw new System.Exception("Steel Object is null");
         }
     }
     return(ret);
 }
Exemple #27
0
        /// <summary>
        /// Get intersection point of Steel object system line with Dynamo plane
        /// </summary>
        /// <param name="steelObject"> Advance Steel element</param>
        /// <param name="intersectionPlane"> Dynamo Plane to intersect with Steel body</param>
        /// <returns name="point"> point formed by cutting the system line through a plane</returns>
        public static Autodesk.DesignScript.Geometry.Point CutSystemLineByPlane(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                                                                Autodesk.DesignScript.Geometry.Plane intersectionPlane)
        {
            Autodesk.DesignScript.Geometry.Point ret = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 0);
            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null || intersectionPlane != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    Plane       cutPlane = Utils.ToAstPlane(intersectionPlane, true);
                    if (filerObj != null)
                    {
                        AtomicElement selectedObj = filerObj as AtomicElement;

                        if (selectedObj.IsKindOf(FilerObject.eObjectType.kBeam))
                        {
                            Autodesk.AdvanceSteel.Modelling.Beam passedBeam = selectedObj as Autodesk.AdvanceSteel.Modelling.Beam;
                            Line3d    line   = new Line3d(passedBeam.GetPointAtStart(), passedBeam.GetPointAtEnd());
                            Point3d[] intPts = new Point3d[] { };
                            cutPlane.IntersectWith(line, ref intPts, new Tol());

                            if (intPts.Length > 0)
                            {
                                ret = Utils.ToDynPoint(intPts[0], true);
                            }
                            else
                            {
                                throw new System.Exception("No Intersection point found on steel object with current plane");
                            }
                        }
                    }
                    else
                    {
                        throw new System.Exception("No Object found via registered handle");
                    }
                }
                else
                {
                    throw new System.Exception("No Steel Object found or Plane is Null");
                }
            }
            return(ret);
        }
        /// <summary>
        /// This node can set the Material for Advance Steel elements from Dynamo
        /// </summary>
        /// <param name="element">Advance Steel element</param>
        /// <param name="materialName">Material</param>
        /// <returns></returns>
        public static void SetMaterial(AdvanceSteel.Nodes.SteelDbObject element, string materialName)
        {
            //lock the document and start transaction
            using (var ctx = new SteelServices.DocContext())
            {
                string handle = element.Handle;

                FilerObject obj = Utils.GetObject(handle);

                if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kAtomicElem))
                {
                    AtomicElement atomic = obj as AtomicElement;
                    atomic.Material = materialName;
                }
                else
                {
                    throw new System.Exception("Failed to set material");
                }
            }
        }
Exemple #29
0
 /// <summary>
 /// Get Point at a distance from the START of the Beam
 /// </summary>
 /// <param name="steelObject">Advance Steel element</param>
 /// <param name="distance"> Distance from start point</param>
 /// <returns name="point"> from beam object start point return a point by the distance value</returns>
 public static Autodesk.DesignScript.Geometry.Point GetPointFromStart(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                                                      [DefaultArgument("0")] double distance)
 {
     Autodesk.DesignScript.Geometry.Point ret = Autodesk.DesignScript.Geometry.Point.ByCoordinates(0, 0, 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;
                     Point3d foundPoint = selectedObj.GetPointAtStart(distance);
                     if (foundPoint != null)
                     {
                         ret = Utils.ToDynPoint(foundPoint, true);
                     }
                     else
                     {
                         throw new System.Exception("No Point was returned from Function");
                     }
                 }
                 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 is null");
         }
     }
     return(ret);
 }
Exemple #30
0
        /// <summary>
        /// Get line segments of steel body that interected with plane
        /// </summary>
        /// <param name="steelObject"> Advance Steel element</param>
        /// <param name="bodyResolution"> Set Steel body display resolution</param>
        /// <param name="intersectionPlane"> Dynamo Plane to intersect with Steel body</param>
        /// <returns name="lines"> list of lines that form the section created by passing the steel object through the plane</returns>
        public static List <Autodesk.DesignScript.Geometry.Line> CutElementByPlane(AdvanceSteel.Nodes.SteelDbObject steelObject,
                                                                                   int bodyResolution,
                                                                                   Autodesk.DesignScript.Geometry.Plane intersectionPlane)
        {
            List <Autodesk.DesignScript.Geometry.Line> ret = new List <Autodesk.DesignScript.Geometry.Line>()
            {
            };

            using (var ctx = new SteelServices.DocContext())
            {
                if (steelObject != null || intersectionPlane != null)
                {
                    FilerObject filerObj = Utils.GetObject(steelObject.Handle);
                    Plane       cutPlane = Utils.ToAstPlane(intersectionPlane, true);
                    if (filerObj != null)
                    {
                        AtomicElement selectedObj = filerObj as AtomicElement;

                        ModelerBody modelerTestBody = selectedObj.GetModeler((BodyContext.eBodyContext)bodyResolution);
                        LineSeg3d[] segs            = null;

                        modelerTestBody.IntersectWith(cutPlane, out segs);
                        for (int i = 0; i < segs.Length; i++)
                        {
                            Autodesk.DesignScript.Geometry.Point dynStartPoint = Utils.ToDynPoint(segs[i].StartPoint, true);
                            Autodesk.DesignScript.Geometry.Point dynEndPoint   = Utils.ToDynPoint(segs[i].EndPoint, true);
                            ret.Add(Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(dynStartPoint, dynEndPoint));
                        }
                    }
                    else
                    {
                        throw new System.Exception("No Object found via registered handle");
                    }
                }
                else
                {
                    throw new System.Exception("No Steel Object found or Plane is Null");
                }
            }
            return(ret);
        }