Exemple #1
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);
                }
            }
        }
Exemple #2
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);
                }
            }
        }
Exemple #3
0
        internal CircularShearStudsPattern(string handleToConnect,
                                           SteelGeometry.Matrix3d coordSyst,
                                           List <Property> shearStudData,
                                           int boltCon)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    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>();

                    Autodesk.AdvanceSteel.Modelling.Connector shearStuds = null;
                    string handle = SteelServices.ElementBinder.GetHandleFromTrace();
                    if (string.IsNullOrEmpty(handle) || Utils.GetObject(handle) == null)
                    {
                        var temp_radius = (double)arrangerShearStudData.FirstOrDefault <Property>(x => x.Name == "Radius").InternalValue;
                        var temp_noss   = (int)arrangerShearStudData.FirstOrDefault <Property>(x => x.Name == "NumberOfElements").InternalValue;

                        shearStuds          = new Autodesk.AdvanceSteel.Modelling.Connector();
                        shearStuds.Arranger = new Autodesk.AdvanceSteel.Arrangement.CircleArranger(Matrix2d.kIdentity, temp_radius, temp_noss);

                        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);
                }
            }
        }