Esempio n. 1
0
        internal RectangularAnchorPattern(SteelGeometry.Point3d astPoint1, SteelGeometry.Point3d astPoint2, IEnumerable <string> handlesToConnect,
                                          SteelGeometry.Vector3d vx, SteelGeometry.Vector3d vy,
                                          List <Property> anchorBoltData, int boltCon)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    Autodesk.AdvanceSteel.Modelling.AnchorPattern anchors = null;
                    string handle      = SteelServices.ElementBinder.GetHandleFromTrace();
                    var    astPointRef = astPoint1 + (astPoint2 - astPoint1) * 0.5;

                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        anchors = new Autodesk.AdvanceSteel.Modelling.AnchorPattern(astPoint1, astPoint2, vx, vy);
                        SetAnchorSetOutDetails(anchors, astPoint1 + (astPoint2 - astPoint1) * 0.5, Autodesk.AdvanceSteel.Arrangement.Arranger.eArrangerType.kBounded);

                        double aLengthX = Utils.GetRectangleLength(astPoint1, astPoint2, vx); // / (anchors.Nx - 1);
                        double aLengthY = Utils.GetRectangleLength(astPoint1, astPoint2, vy); // / (anchors.Ny - 1);
                        anchors.SetArrangerLength(aLengthX, 0);
                        anchors.SetArrangerLength(aLengthY, 1);

                        Utils.SetParameters(anchors, anchorBoltData);

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

                        if (anchors != null && anchors.IsKindOf(FilerObject.eObjectType.kAnchorPattern))
                        {
                            SetAnchorSetOutDetails(anchors, astPoint1 + (astPoint2 - astPoint1) * 0.5, Autodesk.AdvanceSteel.Arrangement.Arranger.eArrangerType.kBounded);

                            double aLengthX = Utils.GetRectangleLength(astPoint1, astPoint2, vx);
                            double aLengthY = Utils.GetRectangleLength(astPoint1, astPoint2, vy);
                            anchors.SetArrangerLength(aLengthX, 0);
                            anchors.SetArrangerLength(aLengthY, 1);

                            Utils.SetParameters(anchors, anchorBoltData);
                        }
                        else
                        {
                            throw new System.Exception("Not an anchor pattern");
                        }
                    }

                    FilerObject[] filerObjects = Utils.GetFilerObjects(handlesToConnect);
                    anchors.Connect(filerObjects, (AtomicElement.eAssemblyLocation)boltCon);

                    Handle = anchors.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(anchors);
                }
            }
        }
Esempio n. 2
0
        internal static void AdjustBeamEnd(Autodesk.AdvanceSteel.Modelling.Beam beam, Autodesk.AdvanceSteel.Geometry.Point3d newPtStart)
        {
            Autodesk.AdvanceSteel.Geometry.Point3d beamPtStart = beam.GetPointAtStart();
            Autodesk.AdvanceSteel.Geometry.Point3d beamPtEnd   = beam.GetPointAtEnd();

            if (beamPtEnd.IsEqualTo(newPtStart))
            {
                Autodesk.AdvanceSteel.Geometry.Point3d newBeamEnd = beamPtEnd + (beamPtEnd - beamPtStart) * 0.5;
                beam.SetSysEnd(newBeamEnd);
            }
        }
Esempio n. 3
0
        static public Autodesk.DesignScript.Geometry.Point ToDynPoint(Autodesk.AdvanceSteel.Geometry.Point3d pt, bool bConvertFromAstUnits)
        {
            double factor = 1.0;

            if (bConvertFromAstUnits)
            {
                var units = AppResolver.Instance.Resolve <IAppInteraction>().DbUnits;
                factor = units.UnitOfDistance.Factor;
            }
            pt = pt * (1 / factor);
            return(Autodesk.DesignScript.Geometry.Point.ByCoordinates(pt.x, pt.y, pt.z));
        }
Esempio n. 4
0
        internal RectangularBoltPattern(SteelGeometry.Point3d astPoint1, SteelGeometry.Point3d astPoint2,
                                        IEnumerable <string> handlesToConnect,
                                        SteelGeometry.Vector3d vx, SteelGeometry.Vector3d vy,
                                        List <Property> boltData, int boltCon)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    Autodesk.AdvanceSteel.Modelling.FinitRectScrewBoltPattern bolts = null;

                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();
                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        bolts = new Autodesk.AdvanceSteel.Modelling.FinitRectScrewBoltPattern(astPoint1, astPoint2, vx, vy);

                        bolts.RefPoint = astPoint1 + (astPoint2 - astPoint1) * 0.5;
                        bolts.Length   = Utils.GetRectangleLength(astPoint1, astPoint2, vx);
                        bolts.Height   = Utils.GetRectangleHeight(astPoint1, astPoint2, vy);

                        Utils.SetParameters(bolts, boltData);

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

                        if (bolts != null && bolts.IsKindOf(FilerObject.eObjectType.kFinitRectScrewBoltPattern))
                        {
                            bolts.XDirection = vx;
                            bolts.YDirection = vy;

                            bolts.RefPoint = astPoint1 + (astPoint2 - astPoint1) * 0.5;
                            bolts.Length   = Utils.GetRectangleLength(astPoint1, astPoint2, vx);
                            bolts.Height   = Utils.GetRectangleHeight(astPoint1, astPoint2, vy);

                            Utils.SetParameters(bolts, boltData);
                        }
                        else
                        {
                            throw new System.Exception("Not a rectangular pattern");
                        }
                    }

                    FilerObject[] filerObjects = Utils.GetSteelObjectsToConnect(handlesToConnect);
                    bolts.Connect(filerObjects, (AtomicElement.eAssemblyLocation)boltCon);

                    Handle = bolts.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(bolts);
                }
            }
        }
Esempio n. 5
0
        public override Autodesk.DesignScript.Geometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    var shearStud = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.Connector;
                    if (shearStud == null)
                    {
                        throw new Exception("Null shear stud pattern");
                    }

                    var coordSystem = shearStud.CS;
                    // Vx and Vy direction
                    var tempVx = new Vector3d(coordSystem.Values[0][0], coordSystem.Values[1][0], coordSystem.Values[2][0]);
                    var tempVy = new Vector3d(coordSystem.Values[0][1], coordSystem.Values[1][1], coordSystem.Values[2][1]);

                    var tempXlen = shearStud.Arranger.Dx * (shearStud.Arranger.Nx - 1) / 2.0;
                    var tempYlen = shearStud.Arranger.Dy * (shearStud.Arranger.Ny - 1) / 2.0;

                    var temp1 = tempVx * tempXlen;
                    var temp2 = tempVy * tempYlen;

                    var pt1 = new SteelGeometry.Point3d(shearStud.CenterPoint);
                    pt1.Add(temp1 + temp2);

                    var pt2 = new SteelGeometry.Point3d(shearStud.CenterPoint);
                    pt2.Add(temp1 - temp2);

                    var pt3 = new SteelGeometry.Point3d(shearStud.CenterPoint);
                    pt3.Add(-temp1 - temp2);

                    var pt4 = new SteelGeometry.Point3d(shearStud.CenterPoint);
                    pt4.Add(-temp1 + temp2);

                    {
                        List <DynGeometry.Point> polyPoints = new List <DynGeometry.Point>
                        {
                            Utils.ToDynPoint(pt1, true),
                            Utils.ToDynPoint(pt2, true),
                            Utils.ToDynPoint(pt3, true),
                            Utils.ToDynPoint(pt4, true)
                        };

                        return(Autodesk.DesignScript.Geometry.Polygon.ByPoints(polyPoints));
                    }
                }
            }
        }
Esempio n. 6
0
        static public Autodesk.AdvanceSteel.Geometry.Point3d[] ToAstPoints(Autodesk.DesignScript.Geometry.Point[] pts, bool bConvertToAstUnits)
        {
            if (pts == null)
            {
                return(new Autodesk.AdvanceSteel.Geometry.Point3d[0]);
            }

            Autodesk.AdvanceSteel.Geometry.Point3d[] astPts = new Autodesk.AdvanceSteel.Geometry.Point3d[pts.Length];
            for (int nIdx = 0; nIdx < pts.Length; nIdx++)
            {
                astPts[nIdx] = ToAstPoint(pts[nIdx], bConvertToAstUnits);
            }

            return(astPts);
        }
Esempio n. 7
0
        /// <summary>
        /// Create an Advance Steel Circular Anchor Pattern By Center Point and Dynamo Coordinate System
        /// </summary>
        /// <param name="point"> Input radius center point</param>
        /// <param name="anchorCS"> Input Dynamo Coordinate System</param>
        /// <param name="objectsToConnect"> Input Objects to be bolted </param>
        /// <param name="anchorBoltConnectionType"> Input Bolt Connection type - Shop Bolt Default</param>
        /// <param name="additionalAnchorBoltParameters"> Optional Input Bolt Build Properties </param>
        /// <returns name="circularAnchorPattern"> anchor</returns>
        public static CircularAnchorPattern AtCentrePoint(DynGeometry.Point point,
                                                          DynGeometry.CoordinateSystem anchorCS,
                                                          IEnumerable <SteelDbObject> objectsToConnect,
                                                          [DefaultArgument("2;")] int anchorBoltConnectionType,
                                                          [DefaultArgument("null")] List <Property> additionalAnchorBoltParameters)
        {
            SteelGeometry.Point3d astPointRef = Utils.ToAstPoint(point, true);

            var vx = Utils.ToAstVector3d(anchorCS.XAxis, true);
            var vy = Utils.ToAstVector3d(anchorCS.YAxis, true);

            vx = vx.Normalize();
            vy = vy.Normalize();

            IEnumerable <string> handles = Utils.GetSteelDbObjectsToConnect(objectsToConnect);

            return(new CircularAnchorPattern(astPointRef, handles, vx, vy, additionalAnchorBoltParameters, anchorBoltConnectionType));
        }
Esempio n. 8
0
        // custom function here
        private void CreateStraightBeam()
        {
            ProfileName pn = new ProfileName();

            ProfilesManager.GetProfTypeAsDefault("I", out pn);

            ASGeo.Point3d s1 = ASGeo.Point3d.kOrigin;
            ASGeo.Point3d e1 = new ASGeo.Point3d(0, 0, 3500);

            ASMod.StraightBeam b1 = new ASMod.StraightBeam(pn.Name, s1, e1, ASGeo.Vector3d.kXAxis);
            b1.WriteToDb();

            ASGeo.Point3d s2 = new ASGeo.Point3d(0, 0, 3500);
            ASGeo.Point3d e2 = new ASGeo.Point3d(0, 3000, 3500);

            ASMod.StraightBeam b2 = new ASMod.StraightBeam("AISC 14.1 W Shape#@§@#W10x33", s2, e2, ASGeo.Vector3d.kXAxis);
            // ASMod.StraightBeam b2 = new ASMod.StraightBeam("HEA  DIN18800-1#@§@#HEA200", s2, e2, ASGeo.Vector3d.kXAxis);
            b2.WriteToDb();
        }
Esempio n. 9
0
        public override Autodesk.DesignScript.Geometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    var boltPattern = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.CountableScrewBoltPattern;

                    if (boltPattern == null)
                    {
                        throw new Exception("Null bolt pattern");
                    }

                    var temp1 = boltPattern.XDirection * boltPattern.Length / 2.0;
                    var temp2 = boltPattern.YDirection * boltPattern.Height / 2.0;

                    var pt1 = new SteelGeometry.Point3d(boltPattern.CenterPoint);
                    pt1.Add(temp1 + temp2);

                    var pt2 = new SteelGeometry.Point3d(boltPattern.CenterPoint);
                    pt2.Add(temp1 - temp2);

                    var pt3 = new SteelGeometry.Point3d(boltPattern.CenterPoint);
                    pt3.Add(-temp1 - temp2);

                    var pt4 = new SteelGeometry.Point3d(boltPattern.CenterPoint);
                    pt4.Add(-temp1 + temp2);

                    {
                        List <DynGeometry.Point> polyPoints = new List <DynGeometry.Point>
                        {
                            Utils.ToDynPoint(pt1, true),
                            Utils.ToDynPoint(pt2, true),
                            Utils.ToDynPoint(pt3, true),
                            Utils.ToDynPoint(pt4, true)
                        };

                        return(Autodesk.DesignScript.Geometry.Polygon.ByPoints(polyPoints));
                    }
                }
            }
        }
Esempio n. 10
0
        public override DynGeometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    var anchorPattern = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.AnchorPattern;

                    if (anchorPattern == null)
                    {
                        throw new Exception("Null anchor pattern");
                    }

                    var temp1 = anchorPattern.XDirection * anchorPattern.Dx / 2.0;
                    var temp2 = anchorPattern.YDirection * anchorPattern.Dy / 2.0;

                    var pt1 = new SteelGeometry.Point3d(anchorPattern.RefPoint);
                    pt1.Add(temp1 + temp2);

                    var pt2 = new SteelGeometry.Point3d(anchorPattern.RefPoint);
                    pt2.Add(temp1 - temp2);

                    var pt3 = new SteelGeometry.Point3d(anchorPattern.RefPoint);
                    pt3.Add(-temp1 - temp2);

                    var pt4 = new SteelGeometry.Point3d(anchorPattern.RefPoint);
                    pt4.Add(-temp1 + temp2);

                    {
                        List <DynGeometry.Point> polyPoints = new List <DynGeometry.Point>
                        {
                            Utils.ToDynPoint(pt1, true),
                            Utils.ToDynPoint(pt2, true),
                            Utils.ToDynPoint(pt3, true),
                            Utils.ToDynPoint(pt4, true)
                        };

                        return(Autodesk.DesignScript.Geometry.Polygon.ByPoints(polyPoints));
                    }
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Create an Advance Steel Weld Line By PolyCurve
        /// </summary>
        /// <param name="polyCurve"> Input Weld PolyCurve</param>
        /// <param name="objectsToConnect"> Input Weld Connected Objects</param>
        /// <param name="connectionType"> Input Weld Type - 0-OnSite or 2-InShop</param>
        /// <returns name="weldLine"> weldLine</returns>
        public static WeldLine ByPolyCurve(DynGeometry.PolyCurve polyCurve,
                                           IEnumerable <SteelDbObject> objectsToConnect,
                                           [DefaultArgument("2;")] int connectionType)
        {
            List <string> handlesList = Utils.GetSteelDbObjectsToConnect(objectsToConnect);

            var temp = polyCurve.Curves();

            SteelGeometry.Point3d[] astArr = new SteelGeometry.Point3d[temp.Length + 1];
            for (int i = 0; i < temp.Length; i++)
            {
                Point3d startPoint = Utils.ToAstPoint(temp[i].StartPoint, true);
                astArr[i] = startPoint;
            }

            Point3d endPoint = Utils.ToAstPoint(temp[temp.Length - 1].EndPoint, true);

            astArr[temp.Length] = endPoint;

            return(new WeldLine(astArr, handlesList, connectionType, polyCurve.IsClosed));
        }
Esempio n. 12
0
        internal WeldPoint(SteelGeometry.Point3d astPoint, IEnumerable <string> handlesToConnect, int connectionType)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    Autodesk.AdvanceSteel.Modelling.WeldPoint weld = null;
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();

                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        weld = new Autodesk.AdvanceSteel.Modelling.WeldPoint(astPoint, Vector3d.kXAxis, Vector3d.kYAxis);
                        weld.WriteToDb();
                    }
                    else
                    {
                        weld = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.WeldPoint;

                        if (weld != null && weld.IsKindOf(FilerObject.eObjectType.kWeldPattern))
                        {
                            Matrix3d coordinateSystem = new Matrix3d();
                            coordinateSystem.SetCoordSystem(astPoint, Vector3d.kXAxis, Vector3d.kYAxis, Vector3d.kZAxis);
                            weld.SetCS(coordinateSystem);
                        }
                        else
                        {
                            throw new System.Exception("Not a weld point");
                        }
                    }

                    FilerObject[] filerObjects = Utils.GetFilerObjects(handlesToConnect);
                    weld.Connect(filerObjects, (AtomicElement.eAssemblyLocation)connectionType);

                    Handle = weld.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(weld);
                }
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Get Grating Centre Point on Top
        /// </summary>
        /// <param name="steelObject">Advance Steel element</param>
        /// <returns name="point"> The centre point on top side of the grating</returns>
        public static Autodesk.DesignScript.Geometry.Point GetCenterOnTop(AdvanceSteel.Nodes.SteelDbObject steelObject)
        {
            Autodesk.DesignScript.Geometry.Point ret;
            //lock the document and start transaction
            using (var ctx = new SteelServices.DocContext())
            {
                string handle = steelObject.Handle;

                FilerObject obj = Utils.GetObject(handle);

                if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kGrating))
                {
                    Autodesk.AdvanceSteel.Modelling.Grating grating = obj as Autodesk.AdvanceSteel.Modelling.Grating;
                    Autodesk.AdvanceSteel.Geometry.Point3d  point   = grating.GetCenterOnTop();
                    ret = Utils.ToDynPoint(point, true);
                }
                else
                {
                    throw new System.Exception("Not a Grating Object");
                }
            }
            return(ret);
        }
Esempio n. 14
0
        public static List <DynGeometry.Point> GetPointsToDraw(Autodesk.AdvanceSteel.Modelling.Grating grating)
        {
            var coordSystem = grating.CS;

            coordSystem.GetCoordSystem(out var origPt, out var vX, out var vY, out var vZ);

            var temp1 = vY * grating.Width / 2.0;
            var temp2 = vX * grating.Length / 2.0;

            var pt1 = new SteelGeometry.Point3d(grating.CenterPoint);

            pt1.Add(temp1 + temp2);

            var pt2 = new SteelGeometry.Point3d(grating.CenterPoint);

            pt2.Add(temp1 - temp2);

            var pt3 = new SteelGeometry.Point3d(grating.CenterPoint);

            pt3.Add(-temp1 - temp2);

            var pt4 = new SteelGeometry.Point3d(grating.CenterPoint);

            pt4.Add(-temp1 + temp2);


            List <DynGeometry.Point> polyPoints = new List <DynGeometry.Point>
            {
                Utils.ToDynPoint(pt1, true),
                Utils.ToDynPoint(pt2, true),
                Utils.ToDynPoint(pt3, true),
                Utils.ToDynPoint(pt4, true)
            };

            return(polyPoints);
        }
Esempio n. 15
0
        internal RectangularShearStudsPattern(SteelGeometry.Point3d astPoint1, SteelGeometry.Point3d astPoint2, string handleToConnect,
                                              SteelGeometry.Vector3d vx, SteelGeometry.Vector3d vy,
                                              SteelGeometry.Matrix3d coordSyst,
                                              List <Property> shearStudData, int boltCon)
        {
            lock (access_obj)
            {
                List <Property> defaultShearStudData  = shearStudData.Where(x => x.Level == ".").ToList <Property>();
                List <Property> arrangerShearStudData = shearStudData.Where(x => x.Level == "Arranger").ToList <Property>();
                List <Property> postWriteDBData       = shearStudData.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>();

                int temp_nx = (int)arrangerShearStudData.FirstOrDefault <Property>(x => x.Name == "Nx").InternalValue;
                int temp_ny = (int)arrangerShearStudData.FirstOrDefault <Property>(x => x.Name == "Ny").InternalValue;

                var dx = Utils.GetRectangleLength(astPoint1, astPoint2, vx) / (temp_nx - 1);
                Utils.CheckListUpdateOrAddValue(arrangerShearStudData, "Dx", dx, "Arranger");

                var dy = Utils.GetRectangleHeight(astPoint1, astPoint2, vx) / (temp_ny - 1);
                Utils.CheckListUpdateOrAddValue(arrangerShearStudData, "Dy", dy, "Arranger");

                using (var ctx = new SteelServices.DocContext())
                {
                    Autodesk.AdvanceSteel.Modelling.Connector shearStuds = null;
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();
                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        shearStuds = new Autodesk.AdvanceSteel.Modelling.Connector();
                        Autodesk.AdvanceSteel.Arrangement.Arranger arranger = new Autodesk.AdvanceSteel.Arrangement.RectangularArranger(Matrix2d.kIdentity, dx, dy, temp_nx, temp_ny);
                        shearStuds.Arranger = arranger;

                        if (defaultShearStudData != null)
                        {
                            Utils.SetParameters(shearStuds, defaultShearStudData);
                        }

                        Utils.SetParameters(shearStuds.Arranger, arrangerShearStudData);

                        shearStuds.WriteToDb();

                        if (postWriteDBData != null)
                        {
                            Utils.SetParameters(shearStuds, postWriteDBData);
                        }
                    }
                    else
                    {
                        shearStuds = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Connector;
                        if (shearStuds != null || shearStuds.IsKindOf(FilerObject.eObjectType.kConnector))
                        {
                            if (defaultShearStudData != null)
                            {
                                Utils.SetParameters(shearStuds, defaultShearStudData);
                            }

                            Utils.SetParameters(shearStuds.Arranger, arrangerShearStudData);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(shearStuds, postWriteDBData);
                            }
                        }
                        else
                        {
                            throw new System.Exception("Not a shear stud pattern");
                        }
                    }

                    FilerObject obj = Utils.GetObject(handleToConnect);
                    Autodesk.AdvanceSteel.Modelling.WeldPoint weld = shearStuds.Connect(obj, coordSyst);
                    weld.AssemblyLocation = (AtomicElement.eAssemblyLocation)boltCon;

                    Handle = shearStuds.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(shearStuds);
                }
            }
        }
Esempio n. 16
0
        internal Walls(SteelGeometry.Point3d ptCenter,
                       double dLength, double dHeight, double thickness,
                       SteelGeometry.Vector3d vNormal,
                       List <Property> concreteProperties)
        {
            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>();

                    SteelGeometry.Plane plane = new SteelGeometry.Plane(ptCenter, vNormal);
                    Autodesk.AdvanceSteel.Modelling.Wall wallObject = null;
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();

                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        wallObject           = new Autodesk.AdvanceSteel.Modelling.Wall(plane, ptCenter, dLength, dHeight);
                        wallObject.Thickness = thickness;
                        if (defaultData != null)
                        {
                            Utils.SetParameters(wallObject, defaultData);
                        }

                        wallObject.WriteToDb();

                        if (postWriteDBData != null)
                        {
                            Utils.SetParameters(wallObject, postWriteDBData);
                        }
                    }
                    else
                    {
                        wallObject = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Wall;
                        if (wallObject != null && wallObject.IsKindOf(FilerObject.eObjectType.kWall))
                        {
                            wallObject.DefinitionPlane = plane;
                            wallObject.Thickness       = thickness;
                            wallObject.SetLength(dLength, true);
                            wallObject.SetWidth(dHeight, true);

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

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

                    Handle = wallObject.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(wallObject);
                }
            }
        }
Esempio n. 17
0
        internal Walls(SteelGeometry.Matrix3d matrix,
                       double dLength, double dHeight, double thickness,
                       List <Property> concreteProperties)
        {
            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>();

                    SteelGeometry.Point3d  baseOrigin = new SteelGeometry.Point3d();
                    SteelGeometry.Vector3d xAxis      = new SteelGeometry.Vector3d();
                    SteelGeometry.Vector3d yAxis      = new SteelGeometry.Vector3d();
                    SteelGeometry.Vector3d zAxis      = new SteelGeometry.Vector3d();
                    matrix.GetCoordSystem(out baseOrigin, out xAxis, out yAxis, out zAxis);

                    SteelGeometry.Vector3d lengthVec = xAxis * dLength;
                    SteelGeometry.Vector3d heightVec = zAxis * dHeight;

                    SteelGeometry.Point3d brPnt = new SteelGeometry.Point3d(baseOrigin).Add(lengthVec);
                    SteelGeometry.Point3d trPnt = new SteelGeometry.Point3d(brPnt).Add(heightVec);
                    SteelGeometry.Point3d tlPnt = new SteelGeometry.Point3d(baseOrigin).Add(heightVec);

                    SteelGeometry.Point3d centerWallPnt = baseOrigin.GetMidPointBetween(trPnt);

                    SteelGeometry.Point3d[] wallPoints = { baseOrigin, brPnt, trPnt, tlPnt };
                    double[] cornerRadii = (double[])System.Collections.ArrayList.Repeat(0.0, wallPoints.Length).ToArray(typeof(double));

                    SteelGeometry.Plane plane = new SteelGeometry.Plane(centerWallPnt, yAxis);

                    Autodesk.AdvanceSteel.Modelling.Wall wallObject = null;
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();

                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        wallObject           = new Autodesk.AdvanceSteel.Modelling.Wall(plane, wallPoints);
                        wallObject.Thickness = thickness;
                        Polyline3d             outerPoly          = new Polyline3d(wallPoints, cornerRadii, true, yAxis, false, 0, true, true);
                        IEnumerable <ObjectId> deletedFeaturesIds = null;
                        IEnumerable <ObjectId> newFeaturesIds     = null;
                        wallObject.SetOuterContour(outerPoly, out deletedFeaturesIds, out newFeaturesIds);

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

                        wallObject.WriteToDb();

                        if (postWriteDBData != null)
                        {
                            Utils.SetParameters(wallObject, postWriteDBData);
                        }
                    }
                    else
                    {
                        wallObject = Utils.GetObject(handle) as Autodesk.AdvanceSteel.Modelling.Wall;
                        if (wallObject != null && wallObject.IsKindOf(FilerObject.eObjectType.kWall))
                        {
                            //TODO - Missing SetPolygon
                            wallObject.DefinitionPlane = plane;
                            wallObject.Thickness       = thickness;
                            Polyline3d             outerPoly          = new Polyline3d(wallPoints, cornerRadii, true, yAxis, false, 0, true, true);
                            IEnumerable <ObjectId> deletedFeaturesIds = null;
                            IEnumerable <ObjectId> newFeaturesIds     = null;

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

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

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

                    Handle = wallObject.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(wallObject);
                }
            }
        }
Esempio n. 18
0
        internal BeamPolycut(AdvanceSteel.Nodes.SteelDbObject element,
                             int cutShapeRectCircle,
                             Autodesk.AdvanceSteel.Geometry.Point3d insertPoint,
                             Autodesk.AdvanceSteel.Geometry.Vector3d normal,
                             Autodesk.AdvanceSteel.Geometry.Vector3d lengthVector,
                             int corner,
                             List <Property> beamFeatureProperties)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    List <Property> defaultData     = beamFeatureProperties.Where(x => x.Level == ".").ToList <Property>();
                    List <Property> postWriteDBData = beamFeatureProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>();

                    double length = 0;
                    double width  = 0;
                    double radius = 0;

                    if (defaultData.FirstOrDefault <Property>(x => x.Name == "Length") != null)
                    {
                        length = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "Length").InternalValue;
                    }
                    if (defaultData.FirstOrDefault <Property>(x => x.Name == "Width") != null)
                    {
                        width = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "Width").InternalValue;
                    }
                    if (defaultData.FirstOrDefault <Property>(x => x.Name == "Radius") != null)
                    {
                        radius = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "Radius").InternalValue;
                    }

                    string existingFeatureHandle = SteelServices.ElementBinder.GetHandleFromTrace();

                    string                elementHandle = element.Handle;
                    FilerObject           obj           = Utils.GetObject(elementHandle);
                    BeamMultiContourNotch beamFeat      = null;
                    if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kBeam))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            Beam bmObj = obj as Beam;
                            switch (cutShapeRectCircle)
                            {
                            case 0:
                                beamFeat = new BeamMultiContourNotch(bmObj, (Beam.eEnd) 1, insertPoint, normal, lengthVector, length, width);
                                break;

                            case 1:
                                beamFeat = new BeamMultiContourNotch(bmObj, (Beam.eEnd) 1, insertPoint, normal, lengthVector, radius);
                                break;
                            }

                            Vector2d offset;
                            switch (corner)
                            {
                            case 0: //Top Left
                                offset = new Vector2d(-1, 1);
                                break;

                            case 1: //Top Right
                                offset = new Vector2d(1, 1);
                                break;

                            case 2: //Bottom Right
                                offset = new Vector2d(1, -1);
                                break;

                            case 3: //Bottom left
                                offset = new Vector2d(-1, -1);
                                break;

                            default: //Anything else ignore
                                offset = new Vector2d(0, 0);
                                break;
                            }
                            beamFeat.Offset = offset;

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

                            bmObj.AddFeature(beamFeat);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(beamFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            beamFeat = Utils.GetObject(existingFeatureHandle) as BeamMultiContourNotch;
                            if (beamFeat != null && beamFeat.IsKindOf(FilerObject.eObjectType.kBeamMultiContourNotch))
                            {
                                beamFeat.End = (Beam.eEnd) 0;
                                Matrix3d cutMatrix = beamFeat.CS;
                                Point3d  orgin     = null;
                                Vector3d xVec      = null;
                                Vector3d yVec      = null;
                                Vector3d zVec      = null;
                                cutMatrix.GetCoordSystem(out orgin, out xVec, out yVec, out zVec);
                                xVec = new Vector3d(lengthVector);
                                yVec = xVec.CrossProduct(normal);
                                zVec = xVec.CrossProduct(yVec);
                                cutMatrix.SetCoordSystem(insertPoint, xVec, yVec, zVec);
                                beamFeat.CS = cutMatrix;

                                Vector2d offset;
                                switch (corner)
                                {
                                case 0: //Top Left
                                    offset = new Vector2d(-1, 1);
                                    break;

                                case 1: //Top Right
                                    offset = new Vector2d(1, 1);
                                    break;

                                case 2: //Bottom Right
                                    offset = new Vector2d(1, -1);
                                    break;

                                case 3: //Bottom left
                                    offset = new Vector2d(-1, -1);
                                    break;

                                default: //Anything else ignore
                                    offset = new Vector2d(0, 0);
                                    break;
                                }
                                beamFeat.Offset = offset;

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

                                if (postWriteDBData != null)
                                {
                                    Utils.SetParameters(beamFeat, postWriteDBData);
                                }
                            }
                            else
                            {
                                throw new System.Exception("Not a Beam Feature");
                            }
                        }
                    }
                    else
                    {
                        throw new System.Exception("No Input Element found");
                    }

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