コード例 #1
0
        public override Autodesk.DesignScript.Geometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    Autodesk.DesignScript.Geometry.PolyCurve poly = null;
                    var plateFeat = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.PlateFeatContour;

                    if (plateFeat != null)
                    {
                        var dynPoints = Utils.ToDynPoints(plateFeat.GetContourPolygon(0), true);
                        poly = Autodesk.DesignScript.Geometry.Polygon.ByPoints(dynPoints, true);
                        foreach (var pt in dynPoints)
                        {
                            pt.Dispose();
                        }
                    }
                    else
                    {
                        var plateFeatx = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.PlateContourNotch;
                        if (plateFeatx != null)
                        {
                            Autodesk.AdvanceSteel.Geometry.Matrix3d matrix = plateFeat.CS;
                            poly = Autodesk.DesignScript.Geometry.PolyCurve.ByJoinedCurves(Utils.ToDynPolyCurves(plateFeatx.GetPolygon(), true));
                        }
                    }

                    return(poly);
                }
            }
        }
コード例 #2
0
        public override Autodesk.DesignScript.Geometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    var beamFeat = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.BeamMultiContourNotch;

                    Autodesk.AdvanceSteel.Geometry.Matrix3d matrix = beamFeat.CS;
                    var poly = Autodesk.DesignScript.Geometry.PolyCurve.ByJoinedCurves(Utils.ToDynPolyCurves(beamFeat.GetPolygon(), true));

                    return(poly);
                }
            }
        }
コード例 #3
0
        public override Autodesk.DesignScript.Geometry.Curve GetDynCurve()
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    var beamFeat = Utils.GetObject(Handle) as Autodesk.AdvanceSteel.Modelling.BeamShortening;
                    Autodesk.AdvanceSteel.Geometry.Matrix3d matrix = beamFeat.CS;
                    var poly = Autodesk.DesignScript.Geometry.Rectangle.ByWidthLength(Utils.ToDynCoordinateSys(matrix, true),
                                                                                      Utils.FromInternalDistanceUnits(200, true),
                                                                                      Utils.FromInternalDistanceUnits(100, true));

                    return(poly);
                }
            }
        }
コード例 #4
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);
                }
            }
        }
コード例 #5
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);
                }
            }
        }
コード例 #6
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);
                }
            }
        }