Esempio n. 1
0
        internal PlatePolycut(AdvanceSteel.Nodes.SteelDbObject element,
                              double xOffset, double yOffset, int corner,
                              int cutShapeRectCircle,
                              List <Property> plateFeatureProperties)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    List <Property> defaultData     = plateFeatureProperties.Where(x => x.Level == ".").ToList <Property>();
                    List <Property> postWriteDBData = plateFeatureProperties.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);
                    PlateFeatContour plateFeat     = null;
                    if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kPlate))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            Matrix2d m2d = new Matrix2d();
                            m2d.SetCoordSystem(new Point2d(xOffset, yOffset), new Vector2d(1, 0), new Vector2d(0, 1));
                            switch (cutShapeRectCircle)
                            {
                            case 0:
                                plateFeat = new PlateFeatContour(m2d, length, width);
                                break;

                            case 1:
                                plateFeat = new PlateFeatContour(m2d, 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;
                            }
                            plateFeat.Offset = offset;
                            AtomicElement atomic = obj as AtomicElement;

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

                            atomic.AddFeature(plateFeat);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(plateFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            plateFeat = Utils.GetObject(existingFeatureHandle) as PlateFeatContour;
                            if (plateFeat != null && plateFeat.IsKindOf(FilerObject.eObjectType.kPlateFeatContour))
                            {
                                Plate plate = obj as Plate;
                                plate.DelFeature(plateFeat);
                                plate.WriteToDb();

                                Matrix2d m2d = new Matrix2d();
                                m2d.SetCoordSystem(new Point2d(xOffset, yOffset), new Vector2d(1, 0), new Vector2d(0, 1));
                                switch (cutShapeRectCircle)
                                {
                                case 0:
                                    plateFeat = new PlateFeatContour(m2d, length, width);
                                    break;

                                case 1:
                                    plateFeat = new PlateFeatContour(m2d, 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;
                                }
                                plateFeat.Offset = offset;
                                AtomicElement atomic = obj as AtomicElement;

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

                                atomic.AddFeature(plateFeat);

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

                    Handle = plateFeat.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(plateFeat);
                }
            }
        }
Esempio n. 2
0
        internal PlatePolycut(AdvanceSteel.Nodes.SteelDbObject element,
                              Polyline3d cutPolyline,
                              Autodesk.AdvanceSteel.Geometry.Vector3d normal,
                              Autodesk.AdvanceSteel.Geometry.Vector3d lengthVector,
                              List <Property> plateFeatureProperties)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    List <Property> defaultData     = plateFeatureProperties.Where(x => x.Level == ".").ToList <Property>();
                    List <Property> postWriteDBData = plateFeatureProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>();

                    string existingFeatureHandle = SteelServices.ElementBinder.GetHandleFromTrace();

                    string            elementHandle = element.Handle;
                    FilerObject       obj           = Utils.GetObject(elementHandle);
                    PlateContourNotch plateFeat     = null;
                    if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kPlate))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            Plate plate = obj as Plate;
                            plateFeat = new PlateContourNotch(plate, 0, cutPolyline, normal, lengthVector);

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

                            plate.AddFeature(plateFeat);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(plateFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            plateFeat = Utils.GetObject(existingFeatureHandle) as PlateContourNotch;
                            if (plateFeat != null && plateFeat.IsKindOf(FilerObject.eObjectType.kPlateContourNotch))
                            {
                                Plate plate = obj as Plate;
                                plate.DelFeature(plateFeat);
                                plate.WriteToDb();

                                plateFeat = new PlateContourNotch(plate, 0, cutPolyline, normal, lengthVector);
                                AtomicElement atomic = obj as AtomicElement;

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

                                atomic.AddFeature(plateFeat);

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

                    Handle = plateFeat.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(plateFeat);
                }
            }
        }
Esempio n. 3
0
        internal BeamPlaneCut(AdvanceSteel.Nodes.SteelDbObject element,
                              int end,
                              double shorteningLength,
                              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>();

                    string         existingFeatureHandle = SteelServices.ElementBinder.GetHandleFromTrace();
                    string         elementHandle         = element.Handle;
                    FilerObject    obj      = Utils.GetObject(elementHandle);
                    BeamShortening beamFeat = null;
                    if (obj != null && (obj.IsKindOf(FilerObject.eObjectType.kBeam)))
                    {
                        Matrix3d matrixAtPointOnBeam = null;
                        Point3d  shortPt             = null;
                        Point3d  cutPoint            = null;
                        Vector3d normal = null;
                        if (obj.IsKindOf(FilerObject.eObjectType.kBentBeam))
                        {
                            BentBeam actObj = obj as BentBeam;
                            switch (end)
                            {
                            case 0: //Start
                                shortPt = actObj.GetPointAtStart(shorteningLength);
                                break;

                            case 1: //End
                                shortPt = actObj.GetPointAtEnd(shorteningLength);
                                break;
                            }
                            matrixAtPointOnBeam = actObj.GetCSAtPoint(shortPt);
                        }
                        else
                        {
                            Beam actObj = obj as Beam;
                            switch (end)
                            {
                            case 0: //Start
                                shortPt = actObj.GetPointAtStart(shorteningLength);
                                break;

                            case 1: //End
                                shortPt = actObj.GetPointAtEnd(shorteningLength);
                                break;
                            }
                            matrixAtPointOnBeam = actObj.GetCSAtPoint(shortPt);
                        }
                        Point3d  orgin = null;
                        Vector3d xV    = null;
                        Vector3d xY    = null;
                        Vector3d xZ    = null;
                        matrixAtPointOnBeam.GetCoordSystem(out orgin, out xV, out xY, out xZ);
                        cutPoint = orgin;
                        normal   = (end == 0 ? xV : xV.Negate());
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            AtomicElement atomic = obj as AtomicElement;
                            beamFeat = new BeamShortening();
                            atomic.AddFeature(beamFeat);
                            beamFeat.Set(cutPoint, normal);
                            if (defaultData != null)
                            {
                                Utils.SetParameters(beamFeat, defaultData);
                            }
                            atomic.AddFeature(beamFeat);
                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(beamFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            beamFeat = Utils.GetObject(existingFeatureHandle) as BeamShortening;
                            if (beamFeat != null && beamFeat.IsKindOf(FilerObject.eObjectType.kBeamShortening))
                            {
                                beamFeat.Set(cutPoint, normal);
                                if (defaultData != null)
                                {
                                    Utils.SetParameters(beamFeat, defaultData);
                                }

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

                    Handle = beamFeat.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(beamFeat);
                }
            }
        }
Esempio n. 4
0
        internal BeamPlaneCut(AdvanceSteel.Nodes.SteelDbObject element,
                              Point3d cutPoint,
                              Vector3d normal,
                              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>();

                    string existingFeatureHandle = SteelServices.ElementBinder.GetHandleFromTrace();

                    string         elementHandle = element.Handle;
                    FilerObject    obj           = Utils.GetObject(elementHandle);
                    BeamShortening beamFeat      = null;
                    if (obj != null && (obj.IsKindOf(FilerObject.eObjectType.kBeam)))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            AtomicElement atomic = obj as AtomicElement;
                            beamFeat = new BeamShortening();
                            atomic.AddFeature(beamFeat);
                            beamFeat.Set(cutPoint, normal);
                            if (defaultData != null)
                            {
                                Utils.SetParameters(beamFeat, defaultData);
                            }
                            atomic.AddFeature(beamFeat);
                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(beamFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            beamFeat = Utils.GetObject(existingFeatureHandle) as BeamShortening;
                            if (beamFeat != null && beamFeat.IsKindOf(FilerObject.eObjectType.kBeamShortening))
                            {
                                beamFeat.Set(cutPoint, normal);
                                if (defaultData != null)
                                {
                                    Utils.SetParameters(beamFeat, defaultData);
                                }

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

                    Handle = beamFeat.Handle;
                    SteelServices.ElementBinder.CleanupAndSetElementForTrace(beamFeat);
                }
            }
        }
Esempio n. 5
0
        internal BeamCope(AdvanceSteel.Nodes.SteelDbObject element,
                          int end, int side,
                          int cnrType, double radius,
                          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 depth  = 0;

                    length = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "ReferenceLength").InternalValue;
                    depth  = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "ReferenceDepth").InternalValue;

                    string existingFeatureHandle = SteelServices.ElementBinder.GetHandleFromTrace();

                    string          elementHandle = element.Handle;
                    FilerObject     obj           = Utils.GetObject(elementHandle);
                    BeamNotch2Ortho beamFeat      = null;
                    if (obj != null && obj.IsKindOf(FilerObject.eObjectType.kBeam))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            beamFeat = new BeamNotch2Ortho((Beam.eEnd)end, (Beam.eSide)side, length, depth);
                            beamFeat.SetCorner((BeamNotch.eBeamNotchCornerType)cnrType, radius);

                            AtomicElement atomic = obj as AtomicElement;

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

                            atomic.AddFeature(beamFeat);

                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(beamFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            beamFeat = Utils.GetObject(existingFeatureHandle) as BeamNotch2Ortho;
                            if (beamFeat != null && beamFeat.IsKindOf(FilerObject.eObjectType.kBeamNotch2Ortho))
                            {
                                beamFeat.End  = (Beam.eEnd)end;
                                beamFeat.Side = (Beam.eSide)side;
                                beamFeat.SetCorner((BeamNotch.eBeamNotchCornerType)cnrType, radius);

                                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);
                }
            }
        }
Esempio n. 6
0
        internal PlateVertexCut(AdvanceSteel.Nodes.SteelDbObject element,
                                int vertexFeatureType,
                                List <Property> plateFeatureProperties)
        {
            lock (access_obj)
            {
                using (var ctx = new SteelServices.DocContext())
                {
                    List <Property> defaultData     = plateFeatureProperties.Where(x => x.Level == ".").ToList <Property>();
                    List <Property> postWriteDBData = plateFeatureProperties.Where(x => x.Level == "Z_PostWriteDB").ToList <Property>();

                    double length1 = 0;
                    double length2 = 0;
                    double radius  = 0;

                    if (defaultData.FirstOrDefault <Property>(x => x.Name == "Length1") != null)
                    {
                        length1 = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "Length1").InternalValue;
                    }
                    if (defaultData.FirstOrDefault <Property>(x => x.Name == "Length2") != null)
                    {
                        length2 = (double)defaultData.FirstOrDefault <Property>(x => x.Name == "Length2").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);
                    PlateFeatVertFillet plateFeat     = null;
                    if (obj != null && (obj.IsKindOf(FilerObject.eObjectType.kPlate) || obj.IsKindOf(FilerObject.eObjectType.kFoldedPlate)))
                    {
                        if (string.IsNullOrEmpty(existingFeatureHandle) || Utils.GetObject(existingFeatureHandle) == null)
                        {
                            plateFeat            = new PlateFeatVertFillet();
                            plateFeat.FilletType = (FilerObject.eFilletTypes)vertexFeatureType;

                            AtomicElement atomic = obj as AtomicElement;
                            if (defaultData != null)
                            {
                                Utils.SetParameters(plateFeat, defaultData);
                            }
                            atomic.AddFeature(plateFeat);
                            if (postWriteDBData != null)
                            {
                                Utils.SetParameters(plateFeat, postWriteDBData);
                            }
                        }
                        else
                        {
                            plateFeat = Utils.GetObject(existingFeatureHandle) as PlateFeatVertFillet;
                            if (plateFeat != null && plateFeat.IsKindOf(FilerObject.eObjectType.kPlateFeatVertFillet))
                            {
                                if (defaultData != null)
                                {
                                    Utils.SetParameters(plateFeat, defaultData);
                                }

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

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