示例#1
0
 /// <summary>
 /// Create an Advance Steel Slab By Polygon and Thickness
 /// </summary>
 /// <param name="poly"> Input Dynamo Polygon</param>
 /// <param name="thickness"> Slab Thickness in Current Model Length Unit Settings</param>
 /// <param name="additionalConcParameters"> Optional Input  Build Properties </param>
 /// <returns name="slabs"> slabs</returns>
 public static Slabs ByPolygon(Autodesk.DesignScript.Geometry.Polygon poly,
                               double thickness,
                               [DefaultArgument("null")] List <Property> additionalConcParameters)
 {
     additionalConcParameters = PreSetDefaults(additionalConcParameters);
     return(new Slabs(poly, thickness, additionalConcParameters));
 }
示例#2
0
 /// <summary>
 /// Create an Advance Steel plate (Position default to 0, with system thickness as default)
 /// </summary>
 /// <param name="poly">Input Dynamo Closed Polygon</param>
 /// <param name="additionalPlateParameters"> Optional Input Plate Build Properties </param>
 /// <returns name="plate"> plate</returns>
 public static Plate ByPolygon(Autodesk.DesignScript.Geometry.Polygon poly,
                               [DefaultArgument("null")] List <Property> additionalPlateParameters)
 {
     additionalPlateParameters = PreSetDefaults(additionalPlateParameters);
     Point3d[] astPoints = Utils.ToAstPoints(poly.Points, true);
     return(new Plate(astPoints, Utils.ToAstVector3d(poly.Normal, true), additionalPlateParameters));
 }
示例#3
0
 /// <summary>
 /// Create an Advance Steel Wall by Polygon and Thickness
 /// </summary>
 /// <param name="poly"> Input Dynamo Polygon for Wall shape</param>
 /// <param name="thickness"> Input Wall Thickness</param>
 /// <param name="additionalConcParameters"> Optional Input  Build Properties </param>
 /// <returns name="walls"> walls</returns>
 public static Walls FaceByPolygon(Autodesk.DesignScript.Geometry.Polygon poly,
                                   double thickness,
                                   [DefaultArgument("null")] List <Property> additionalConcParameters)
 {
     additionalConcParameters = PreSetDefaults(additionalConcParameters);
     return(new Walls(poly, Utils.ToInternalDistanceUnits(thickness, true), additionalConcParameters));
 }
示例#4
0
        internal Plate(Autodesk.DesignScript.Geometry.Polygon poly)
        {
            if (poly.IsPlanar == false)
            {
                throw new System.Exception("Polygon is not planar");
            }

            //use lock just to be safe
            //AutoCAD does not support multithreaded access
            lock (myLock)
            {
                //lock the document and start transaction
                using (var _CADAccess = new AdvanceSteel.Services.ObjectAccess.CADContext())
                {
                    string handle = AdvanceSteel.Services.ElementBinder.GetHandleFromTrace();

                    Point3d[] astPoints = Utils.ToAstPoints(poly.Points, true);
                    var       astPoly   = new Autodesk.AdvanceSteel.Geometry.Polyline3d(astPoints, null, poly.IsClosed, true);
                    var       polyPlane = new Plane(astPoints[0], astPoly.Normal);

                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        var myPlate = new Autodesk.AdvanceSteel.Modelling.Plate(polyPlane, astPoints);

                        myPlate.WriteToDb();
                        handle = myPlate.Handle;
                    }

                    Autodesk.AdvanceSteel.Modelling.Plate plate = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Plate;

                    if (plate != null && plate.IsKindOf(FilerObject.eObjectType.kPlate))
                    {
                        plate.DefinitionPlane = polyPlane;
                        plate.SetPolygonContour(astPoints);
                    }
                    else
                    {
                        throw new System.Exception("Not a Plate");
                    }

                    this.Handle = handle;

                    AdvanceSteel.Services.ElementBinder.CleanupAndSetElementForTrace(plate);
                }
            }
        }
示例#5
0
        internal Plate(Autodesk.DesignScript.Geometry.Polygon poly)
        {
            if (poly.IsPlanar == false)
            {
                throw new System.Exception("Polygon is not planar");
            }

            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();

                    Point3d[] astPoints = Utils.ToAstPoints(poly.Points, true);
                    var       astPoly   = new Autodesk.AdvanceSteel.Geometry.Polyline3d(astPoints, null, poly.IsClosed, true);
                    var       polyPlane = new Plane(astPoints[0], astPoly.Normal);

                    Autodesk.AdvanceSteel.Modelling.Plate plate = null;
                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        plate = new Autodesk.AdvanceSteel.Modelling.Plate(polyPlane, astPoints);

                        plate.WriteToDb();
                    }
                    else
                    {
                        plate = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Plate;

                        if (plate != null && plate.IsKindOf(FilerObject.eObjectType.kPlate))
                        {
                            plate.DefinitionPlane = polyPlane;
                            plate.SetPolygonContour(astPoints);
                        }
                        else
                        {
                            throw new System.Exception("Not a Plate");
                        }
                    }

                    Handle = plate.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(plate);
                }
            }
        }
示例#6
0
 /// <summary>
 /// Create an Advance Steel plate
 /// </summary>
 /// <param name="poly">Input polygon</param>
 /// <returns></returns>
 public static Plate ByPolygon(Autodesk.DesignScript.Geometry.Polygon poly)
 {
     return(new Plate(poly));
 }
示例#7
0
        internal Slabs(Autodesk.DesignScript.Geometry.Polygon poly,
                       double thickness,
                       List <Property> concreteProperties)
        {
            if (poly.IsPlanar == false)
            {
                throw new System.Exception("Polygon is not planar");
            }

            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    List <Property> defaultData     = concreteProperties.Where(x => x.Level == ".").ToList <Property>();
                    List <Property> postWriteDBData = concreteProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>();

                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();

                    Point3d[] astPoints   = Utils.ToAstPoints(poly.Points, true);
                    double[]  cornerRadii = (double[])System.Collections.ArrayList.Repeat(0.0, poly.Points.Length).ToArray(typeof(double));

                    var astPoly   = new Autodesk.AdvanceSteel.Geometry.Polyline3d(astPoints, null, poly.IsClosed, true);
                    var polyPlane = new Plane(astPoints[0], astPoly.Normal);

                    Autodesk.AdvanceSteel.Modelling.Slab floorSlab = null;
                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        floorSlab           = new Autodesk.AdvanceSteel.Modelling.Slab(polyPlane, astPoints);
                        floorSlab.Thickness = thickness;
                        Polyline3d             outerPoly          = new Polyline3d(astPoints, cornerRadii, true, astPoly.Normal, false, 0, true, true);
                        IEnumerable <ObjectId> deletedFeaturesIds = null;
                        IEnumerable <ObjectId> newFeaturesIds     = null;
                        floorSlab.SetOuterContour(outerPoly, out deletedFeaturesIds, out newFeaturesIds);
                        if (defaultData != null)
                        {
                            Utils.SetParameters(floorSlab, defaultData);
                        }

                        floorSlab.WriteToDb();

                        if (postWriteDBData != null)
                        {
                            Utils.SetParameters(floorSlab, postWriteDBData);
                        }
                    }
                    else
                    {
                        floorSlab = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Slab;

                        if (floorSlab != null && floorSlab.IsKindOf(FilerObject.eObjectType.kSlab))
                        {
                            floorSlab.DefinitionPlane = polyPlane;
                            floorSlab.Thickness       = thickness;
                            Polyline3d             outerPoly          = new Polyline3d(astPoints, cornerRadii, true, astPoly.Normal, false, 0, true, true);
                            IEnumerable <ObjectId> deletedFeaturesIds = null;
                            IEnumerable <ObjectId> newFeaturesIds     = null;

                            if (defaultData != null)
                            {
                                Utils.SetParameters(floorSlab, defaultData);
                            }

                            floorSlab.SetOuterContour(outerPoly, out deletedFeaturesIds, out newFeaturesIds);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(floorSlab, postWriteDBData);
                            }
                        }
                        else
                        {
                            throw new System.Exception("Not a Slab");
                        }
                    }

                    Handle = floorSlab.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(floorSlab);
                }
            }
        }