Exemplo n.º 1
0
        processWall(ObjectId idAlign)
        {
            List <POI> varpoi = new List <POI>();

            Stake_GetCardinals.getCardinals_Horizontal(idAlign, ref varpoi);
            Stake_GetCardinals.checkBegAndEndStations(idAlign, ref varpoi);
            Stake_DuplicateStations.resolveDuplicateStations(ref varpoi);

            WALL_DATA wall_Data = getWallData(idAlign);

            object varPntUpper = wall_Data.PntUpper;

            List <WALL_STEP> varPOI_TOW;
            List <WALL_STEP> varPOI_TOF;

            convertWallData(wall_Data, out varPOI_TOW, out varPOI_TOF);

            List <POI> varPOI_WALL = getWallPOI(varPOI_TOW, varPOI_TOF);

            fStake.POI_STAKE = varPOI_WALL;

            ObjectId idTable = Stake_Table.makeTable(idAlign, varPOI_WALL, varPntUpper: varPntUpper);

            Stake_Table.addTableData(idTable, varPOI_WALL);
        }
Exemplo n.º 2
0
        getCurbTransitions()
        {
            Alignment objAlign = fStake.ACTIVEALIGN;
            ObjectId  idAlign  = objAlign.ObjectId;

            if (idAlign == ObjectId.Null)
            {
                Point3d pnt3dPicked = Pub.pnt3dO;
                string  nameAlign   = "";
                idAlign  = Align.selectAlign("\nSelect Curb Alignment: ", "\nAlignment selection failed.", out pnt3dPicked, out nameAlign);
                objAlign = (Alignment)idAlign.getEnt();
            }

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            List <POI>   varpoi        = fStake.POI_CALC;
            string       strResponse   = "";
            bool         escape        = UserInput.getUserInput("\nEnter Curb Height in INCHES: ", out strResponse);
            double       dblHeightCurb = Double.Parse(strResponse);
            Point3d      varPntPick    = Pub.pnt3dO;
            PromptStatus ps;
            double       dblStation = 0, dblOffset = 0;
            bool         boolNewPVI = false;

            do
            {
                try
                {
                    varPntPick = UserInput.getPoint("\nSelect Location to Adjust: ", out ps, osMode: 8);
                }
                catch (System.Exception)
                {
                    break;
                }

                objAlign.StationOffset(varPntPick.X, varPntPick.Y, ref dblStation, ref dblOffset);
                getPVI(idAlign, Math.roundDown3(dblStation), ref varpoi, dblHeightCurb, ref boolNewPVI);
            }while (true);

            fStake.POI_CALC = varpoi;

            if (boolNewPVI)
            {
                Stake_Table.updateTableData(idTable, varpoi);
            }
        }
Exemplo n.º 3
0
        processAlign(string nameLayer, ObjectId idPolyGuideline)
        {
            BlockTableRecord ms       = null;
            List <POI>       varPOI   = new List <POI>();
            ObjectId         idTable  = ObjectId.Null;
            ObjectId         idAlign  = ObjectId.Null;
            string           nameXRef = "";
            ResultBuffer     rb;

            TypedValue[] tvs;

            switch (fStake.ClassObj)
            {
            case "BLDG":

                Stake_GetNestedObjects.copyGRID((fStake.XRefDbModelSpace));     //XrefDbModelSpace is source of grid selected
                idPolyGuideline.delete();
                fStake.Hide();
                Application.ShowModelessDialog(Application.MainWindow.Handle, fGrid, false);

                break;

            case "CURB":
                rb = xRef.getXRefsContainingTargetDwgName("GCAL");
                if (rb == null)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("GCAL drawing not attached");
                    return;
                }

                tvs      = rb.AsArray();
                nameXRef = tvs[0].Value.ToString();
                ms       = xRef.getXRefBlockTableRecordMS(nameXRef);

                processCurb(nameLayer, idPolyGuideline, ms, nameXRef, ref varPOI, out idAlign);

                idTable = Stake_Table.makeTable(idAlign, varPOI);
                Stake_Table.addTableData(idTable, varPOI);

                break;

            case "FL":
                rb = xRef.getXRefsContainingTargetDwgName("GCAL");
                if (rb == null)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("GCAL drawing not attached");
                    return;
                }

                tvs      = rb.AsArray();
                nameXRef = tvs[0].Value.ToString();
                ms       = xRef.getXRefBlockTableRecordMS(nameXRef);

                processFlowline(nameLayer, idPolyGuideline, ms, nameXRef, ref varPOI, out idAlign);

                //        fStake.POI = varPOI

                idTable = Stake_Table.makeTable(idAlign, varPOI);
                Stake_Table.addTableData(idTable, varPOI);

                break;

            case "SEWER":
                rb = xRef.getXRefsContainingTargetDwgName("UTIL");
                if (rb == null)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("UTIL drawing not attached");
                    return;
                }

                tvs      = rb.AsArray();
                nameXRef = tvs[0].Value.ToString();
                ms       = xRef.getXRefBlockTableRecordMS(nameXRef);

                processSewer(nameLayer, idPolyGuideline, ms, nameXRef, ref varPOI, out idAlign);

                //    Call makeProfileINVERT(objAlign, varPOI)

                //        fStake.POI = varPOI

                idTable = Stake_Table.makeTable(idAlign, varPOI);
                Stake_Table.addTableData(idTable, varPOI);

                break;

            case "WTR":

                processWater(nameLayer, idPolyGuideline, ms, ref varPOI, out idAlign);

                idTable = Stake_Table.makeTable(idAlign, varPOI);
                Stake_Table.addTableData(idTable, varPOI);

                break;
            }

            fStake.POI_CALC = varPOI;
            //#############################################################
        }
Exemplo n.º 4
0
        Process(string varObjName = "")
        {
            Object xRefPath = null;
            Entity obj      = xRef.getEntity("\nSelect feature to stake: ", out escape, out xRefPath, out ps);

            fStake.XRefDbModelSpace = xRef.getXRefBlockTableRecordMS(xRefPath.ToString());
            ObjectId idAlign = ObjectId.Null;

            if (escape)
            {
                return;
            }

            ObjectId idPolyGuideline = ObjectId.Null;

            string nameLayer = "";

            switch (obj.GetType().Name)
            {
            case "Arc":
            case "Line":
            case "Polyline":
            case "Polyline2d":
            case "Polyline3d":

                idPolyGuideline = Stake_GetGuidelines.getGuidelines(obj);

                if (varObjName == "")
                {
                    nameLayer = obj.Layer;
                    int intPos = nameLayer.IndexOf("|");
                    nameLayer = nameLayer.Substring(intPos + 1);

                    fStake.NameStakeObject = nameLayer;
                }
                else
                {
                    nameLayer              = "SIDEWALK";
                    fStake.ClassObj        = "SIDEWALK";
                    fStake.NameStakeObject = "SIDEWALK";
                }

                if (nameLayer.Contains("CURB"))
                {
                    if (!testClass("CURB", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("FL"))
                {
                    if (!testClass("FL", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("FTG") || nameLayer.Contains("FOOTING"))
                {
                    if (!testClass("FTG", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("SEWER"))
                {
                    if (!testClass("SEWER", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("SD"))
                {
                    if (!testClass("SD", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("WALL"))
                {
                    if (!testClass("WALL", nameLayer))
                    {
                        return;
                    }
                }
                else if (nameLayer.Contains("WATER") || nameLayer.Contains("WAT") || nameLayer.Contains("WTR") || nameLayer.Contains("FIRE") ||
                         nameLayer.Contains("VERIZON") || nameLayer.Contains("ELEC") || nameLayer.Contains("CABLE") ||
                         nameLayer.Contains("PHONE") || nameLayer.Contains("TELE"))
                {
                    if (!testClass("WTR", nameLayer))
                    {
                        return;
                    }
                }

                processAlign(nameLayer, idPolyGuideline);

                break;

            case "DbAlignment":

                List <POI> varPOI   = new List <POI>();
                Alignment  objAlign = (Alignment)obj;
                idAlign = objAlign.ObjectId;

                fStake.ACTIVEALIGN = objAlign;
                nameLayer          = string.Format("STAKE-{0}", objAlign.Name);
                Layer.manageLayers(nameLayer);
                idAlign.changeProp(nameLayer: nameLayer);

                fStake.HandleAlign = objAlign.Handle;
                fStake.objectID    = idAlign;

                fStake.NameStakeObject = objAlign.Name;

                if (objAlign.Name.Contains("WALL"))
                {
                    fStake.ClassObj = "WALL";
                }
                else
                {
                    fStake.ClassObj = "ALIGN";
                }

                switch (fStake.ClassObj)
                {
                case "ALIGN":

                    Stake_GetCardinals.getCardinals_Horizontal(idAlign, ref varPOI);

                    Stake_GetNestedObjects.getNestedPoints(idAlign, ref varPOI, fStake.XRefDbModelSpace, Path.GetFileName(xRefPath.ToString()));

                    Stake_GetCardinals.getCardinals_Vertical(idAlign, ref varPOI);

                    //        Call getNestedObjects(objAlign, varPOI)

                    Stake_GetCardinals.getCrossingAligns(idAlign, ref varPOI);

                    Stake_AddProfile.makeProfile(idAlign, varPOI, "STAKE", "ByLayout", false);

                    Stake_GetBC_EC.getBC_EC(idAlign, ref varPOI);

                    Stake_DuplicateStations.resolveDuplicateStations(ref varPOI);

                    Stake_UpdateProfile.updateProfile(idAlign, varPOI, "STAKE", false, "STAKE");
                    Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_PNTs), "STAKE", true, "PNTS");

                    ResultBuffer rb = xRef.getXRefsContainingTargetDwgName("GCAL");
                    if (rb == null)
                    {
                        Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("GCAL drawing not attached");
                        return;
                    }

                    TypedValue[]     tvs      = rb.AsArray();
                    string           nameXRef = tvs[0].Value.ToString();
                    BlockTableRecord ms       = xRef.getXRefBlockTableRecordMS(nameXRef);

                    //        If getNestedPoints(objAlign, varPOI, objXRefDbModelSpace, "GCAL") = False Then
                    //          Exit Sub
                    //        End If

                    Debug.Print("After getNestedPoints");
                    for (int i = 0; i < varPOI.Count; i++)
                    {
                        Debug.Print(varPOI[i].Station + "  " + varPOI[i].Desc0);
                    }

                    //    Call makeProfileINVERT(objAlign, varPOI)

                    fStake.POI_CALC = varPOI;
                    //#############################################################

                    ObjectId idTable = Stake_Table.makeTable(idAlign, varPOI);
                    Stake_Table.addTableData(idTable, varPOI);

                    break;

                case "WALL":

                    Stake_Wall.processWall(idAlign);

                    break;
                }
                break;

            default:
                break;
            }

            if (fStake.ClassObj != "BLDG")
            {
                TypedValue[] tvs = new TypedValue[2] {
                    new TypedValue(1001, "CLASS"), new TypedValue(1000, fStake.ClassObj)
                };
                idAlign.setXData(tvs, "CLASS");
            }
        }
Exemplo n.º 5
0
        changeAlignStartPoint()
        {
            //BEGIN: UPDATE PROFILE, TABLE, AND POIs

            AlgnData  algnData = new AlgnData();
            ObjectId  idAlign  = ObjectId.Null;
            Alignment objAlign = null;

            if (selectAlignment(idAlign))
            {
                objAlign = fStake.ACTIVEALIGN;
            }
            else
            {
                return;
            }

            objAlign = fStake.ACTIVEALIGN;
            AlignmentEntityCollection objAlignEnts = objAlign.Entities;

            //BEGIN: UPDATE PROFILE, TABLE, AND POIs
            double       dblLenAlign = objAlign.Length;
            PromptStatus ps;
            Point3d      varPnt = UserInput.getPoint("Select Desired Start Point", out ps, osMode: 0);

            double dblStation = 0, dblOffset = 0;

            idAlign.getAlignStaOffset(varPnt, ref dblStation, ref dblOffset);
            double dblStationStart = objAlign.StartingStation;
            double dblStationDelta = dblStation - dblStationStart;
            // if varPnt is out of range then dblStation returns ZERO

            Profile profFLOWLINE      = Prof.getProfile(idAlign, "FLOwLINE");
            ProfilePVICollection pvis = profFLOWLINE.PVIs;

            List <POI> varPOI_Temp = new List <POI>();

            foreach (ProfilePVI pvi in pvis)
            {
                POI poi = new POI {
                    Station = Math.roundDown3(pvi.Station), Elevation = pvi.Elevation
                };
                varPOI_Temp.Add(poi);
            }

            Debug.Print("varPOI_Temp Before");
            for (int i = 0; i < varPOI_Temp.Count; i++)
            {
                Debug.Print(varPOI_Temp[i].Station + "  " + varPOI_Temp[i].Elevation);
            }

            //adjust POI_Temp stationing

            for (int i = 0; i < varPOI_Temp.Count; i++)
            {
                POI poi = varPOI_Temp[i];
                if (poi.Station < dblStationDelta + dblStationStart)
                {
                    poi.Station = Math.roundDown3(dblLenAlign + varPOI_Temp[i].Station);
                }
                else
                {
                    poi.Station = Math.roundDown3(varPOI_Temp[i].Station - dblStationDelta);
                }
                varPOI_Temp[i] = poi;
            }

            List <POI> poiTmp       = new List <POI>();
            var        sortPOI_Temp = from t in varPOI_Temp
                                      orderby t.Station ascending
                                      select t;

            foreach (var t in sortPOI_Temp)
            {
                poiTmp.Add(t);
            }
            varPOI_Temp = poiTmp;

            int k = varPOI_Temp.Count;

            POI poitemp = varPOI_Temp[k - 1];

            poitemp.Elevation = varPOI_Temp[0].Elevation;
            varPOI_Temp[k]    = poitemp;

            Debug.Print("varPOI_Temp After");
            for (int i = 0; i < k; i++)
            {
                Debug.Print(varPOI_Temp[i].Station + "  " + varPOI_Temp[i].Elevation);
            }

            //END: UPDATE PROFILE, TABLE, AND POIs

            ObjectId idPoly = objAlign.GetPolyline();
            Polyline poly   = (Polyline)idPoly.getEnt();

            string   strAlignName = objAlign.Name;
            AlgnData aData;

            for (int j = 1; j < fStake.algnData.Count; j++)
            {
                aData = fStake.algnData[j];
                if (aData.AlignHandle == objAlign.Handle)
                {
                    break;
                }
            }

            objAlign.ReferencePointStation = 100.0;

            foreach (AlignmentEntity ent in objAlignEnts)
            {
                objAlignEnts.Remove(ent);
            }

            List <Vertex2d> v2ds = Conv.poly_Vertex2dList(idPoly);

            int p = 0;

            foreach (Vertex2d v in v2ds)
            {
                if (v.Position.IsEqualTo(varPnt, new Tolerance(0, 0)))
                {
                    break;
                }
                p++;
            }

            List <Vertex2d> v2dsNew = new List <Vertex2d>();

            for (int i = p; i < v2ds.Count; i++)
            {
                v2dsNew.Add(v2ds[i]);
            }

            for (int i = 1; i < p; i++)
            {
                v2dsNew.Add(v2ds[i]);
            }
            v2dsNew.Add(v2ds[p]);

            int     lngID = 0;
            Point3d dblPntBeg = Pub.pnt3dO, dblPntEnd = Pub.pnt3dO, dblPntMid = Pub.pnt3dO;

            for (int i = 1; i < v2dsNew.Count; i++)
            {
                if (v2dsNew[i].Bulge == 0)
                {
                    dblPntBeg = v2dsNew[i - 1].Position;
                    dblPntEnd = v2dsNew[i = 0].Position;

                    AlignmentLine objAlignEntTan = objAlign.Entities.AddFixedLine(lngID, dblPntBeg, dblPntEnd);
                    lngID = objAlignEntTan.EntityId;
                }
                else
                {
                    dblPntBeg = v2dsNew[i - 1].Position;
                    dblPntEnd = v2dsNew[i = 0].Position;

                    int intDir = 0;

                    if (v2dsNew[i - 1].Bulge > 0)
                    {
                        intDir = 1;
                    }
                    else
                    {
                        intDir = -1;
                    }

                    Arc arc = (Arc)Arc.Create(IntPtr.Zero, true);
                    arc.StartPoint = dblPntBeg;
                    arc.EndPoint   = dblPntEnd;

                    Point3d pnt3dMidLC = dblPntBeg.getMidPoint3d(dblPntEnd);
                    double  lenLC      = dblPntBeg.getDistance(dblPntEnd);
                    double  dirLC      = dblPntBeg.getDirection(dblPntEnd);
                    double  lenM       = System.Math.Abs(lenLC / 2 * v2dsNew[i - 1].Bulge);
                    dblPntMid = pnt3dMidLC.traverse(dirLC + System.Math.PI / 2 * intDir, lenM);

                    AlignmentArc objAlignEntArc = objAlign.Entities.AddFixedCurve(lngID, dblPntBeg, dblPntMid, dblPntEnd);
                    lngID = objAlignEntArc.EntityId;
                }
            }

            objAlign.Update();
            objAlign.ReferencePoint        = varPnt.Convert2d(BaseObjs.xyPlane);
            objAlign.ReferencePointStation = System.Math.Round(100.0 + dblStationDelta, 3);

            //BEGIN: UPDATE PROFILE, TABLE, AND POIs
            List <POI> varpoi = fStake.POI_CALC;

            //POIs are updated when selectAlignment is executed

            //ADJUST POI STATIONING
            //need complete POIs for descriptions
            for (int i = 0; i < varpoi.Count; i++)
            {
                if (varpoi[i].Station < dblStationDelta + dblStationStart)
                {
                    varpoi[i].Station = Math.roundDown3(dblLenAlign + varpoi[i].Station);
                }
                else
                {
                    varpoi[i].Station = Math.roundDown3(varpoi[i].Station - dblStationDelta);
                }
            }

            varpoi = varpoi.sortPOIbyStation();

            int n = varpoi.Count;

            varpoi[0].DescX     = "BEG " + varpoi[0].Desc0;
            varpoi[n - 2].DescX = varpoi[n - 2].DescX.Replace("END", "").Trim();
            varpoi[n - 1].DescX = varpoi[n - 1].DescX.Replace("BEG", "END").Trim();

            if (fStake.ClassObj == "CURB")
            {
                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "CURB", "ByLayout", true);
            }

            ObjectId idTable = Stake_Table.makeTable(idAlign, varpoi);

            Stake_Table.addTableData(idTable, varpoi);

            if (Stake_GetBC_EC.getBC_EC(idAlign, ref varpoi) == false)
            {
                return;
            }

            fStake.POI_CALC = varpoi;
            //END: UPDATE PROFILE, TABLE, AND POIs
        }
Exemplo n.º 6
0
        public static void reverseAlign(ObjectId idAlign)
        {
            List <POI>           varpoi      = null;
            List <POI>           varPOI_ORG  = null;
            List <POI>           varPOI_Temp = null;
            ProfilePVICollection objPVIs     = null;

            string nameLayer = idAlign.getLayer();

            TypedValue[] tvs = new TypedValue[9];
            tvs.SetValue(new TypedValue((int)DxfCode.Operator, "<OR"), 0);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Polyline)).DxfName), 1);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Leader)).DxfName), 2);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(DBText)).DxfName), 3);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(MText)).DxfName), 4);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Circle)).DxfName), 5);
            tvs.SetValue(new TypedValue((int)DxfCode.Start, RXClass.GetClass(typeof(Dimension)).DxfName), 6);
            tvs.SetValue(new TypedValue((int)DxfCode.Operator, "OR>"), 7);
            tvs.SetValue(new TypedValue((int)DxfCode.LayerName, nameLayer), 8);

            SelectionSet ss = Select.buildSSet(tvs);

            ObjectId[] ids = ss.GetObjectIds();
            foreach (ObjectId id in ids)
            {
                id.delete();
            }

            Alignment objAlign    = (Alignment)idAlign.getEnt();
            double    dblLenAlign = objAlign.Length;

            switch (fStake.ClassObj)
            {
            case "BLDG":
                Profile profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs = profCPNT.PVIs;
                break;

            case "CURB":
                Profile profFLOWLINE = Prof.getProfile(idAlign, "FLOWLINE");
                objPVIs = profFLOWLINE.PVIs;

                break;

            case "FL":

                profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs  = profCPNT.PVIs;

                break;

            case "SEWER":
            case "WTR":

                profCPNT = Prof.getProfile(idAlign, "CPNT");
                objPVIs  = profCPNT.PVIs;

                break;

            case "ALIGN":

                Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Object is an existing design alignment - exiting");
                return;
            }

            int j = objPVIs.Count;

            for (int i = 0; i < j; i++)
            {
                varPOI_Temp[i].Station = Math.roundDown3(dblLenAlign - (objPVIs[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
                varPOI_Temp[i].Elevation = objPVIs[i].Elevation;
            }

            objAlign.Reverse();

            varpoi = fStake.POI_CALC;

            //reverse varPOI stationing
            //need all POIs for descriptions
            for (int i = 0; i < varpoi.Count; i++)
            {
                varpoi[i].Station = Math.roundDown3(dblLenAlign - (varpoi[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
                varpoi[i].Side = varpoi[i].Side * -1;

                switch (varpoi[i].Desc0)
                {
                case "AP":

                    if (varpoi[i].isRightHand)
                    {
                        varpoi[i].AngDir = varpoi[i].AngDir + varpoi[i].AngDelta;
                    }
                    else
                    {
                        varpoi[i].AngDir = varpoi[i].AngDir - varpoi[i].AngDelta;
                    }

                    varpoi[i].isRightHand = !varpoi[i].isRightHand;

                    break;

                case "BC":

                    varpoi[i].Desc0 = "EC";
                    varpoi[i].DescX = varpoi[i].DescX.Replace("BC", "EC");

                    break;

                case "EC":

                    varpoi[i].Desc0 = "BC";
                    varpoi[i].DescX = varpoi[i].DescX.Replace("EC", "BC");

                    break;
                }
            }

            varPOI_ORG = fStake.POI_ORG;

            //reverse varPOI_ORG stationing
            //need all POIs for descriptions
            for (int i = 0; i < varPOI_ORG.Count; i++)
            {
                varPOI_ORG[i].Station = Math.roundDown3(dblLenAlign - (varPOI_ORG[i].Station - objAlign.StartingStation)) + objAlign.StartingStation;
                //starting station is always 100
            }
            List <POI> poiTmp = new List <POI>();

            var sortPOI = from p in varpoi
                          orderby p.Station ascending
                          select p;

            foreach (var p in sortPOI)
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            poiTmp = new List <POI>();
            var sortPOI_ORG = from n in varPOI_ORG
                              orderby n.Station ascending
                              select n;

            foreach (var n in sortPOI_ORG)
            {
                poiTmp.Add(n);
            }
            varPOI_ORG = poiTmp;

            poiTmp = new List <POI>();
            var sortPOI_Temp = from t in varPOI_Temp
                               orderby t.Station ascending
                               select t;

            foreach (var t in sortPOI_Temp)
            {
                poiTmp.Add(t);
            }
            varPOI_Temp = poiTmp;

            j = varpoi.Count;
            varpoi[0].DescX = varpoi[0].DescX.Replace("END", "BEG");
            varpoi[j].DescX = varpoi[j].DescX.Replace("BEG", "END");

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            Stake_Table.addTableData(idTable, varpoi);

            fStake.POI_CALC = varpoi;
            fStake.POI_ORG  = varPOI_ORG;

            switch (fStake.ClassObj)
            {
            case "BLDG":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "STAKE", "ByLayout", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "STAKE", true, "STAKE");

                break;

            case "CURB":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "CURB", "ByLayout", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "FLOWLINE", true, "ORG");

                break;

            case "FL":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "FLOWLINE", "BySurface", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "STAKE", true, "ORG");

                break;

            case "WTR":

                Stake_AddProfile.makeProfile(idAlign, varPOI_Temp, "STAKE", "BySurface", true);
                Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_ORG), "CPNT", true, "ORG");
                Stake_UpdateProfile.updateProfile(idAlign, varpoi, "STAKE", false, "STAKE");

                break;
            }
        }
Exemplo n.º 7
0
        selectAlignment(ObjectId idAlign)
        {
            Alignment objAlign   = (Alignment)idAlign.getEnt();
            AlgnData  alignData  = new AlgnData();
            AlgnData  alignDataX = new AlgnData();

            Point3d pnt3dPicked = Pub.pnt3dO;
            string  nameAlign   = "";

            if ((idAlign == null))
            {
                idAlign = Align.selectAlign("\nSelect Alignment: ", "Alignment Selection Failed", out pnt3dPicked, out nameAlign);
            }

            ResultBuffer rb = idAlign.getXData("PROFILE");

            if (rb == null)
            {
                return(false);
            }
            TypedValue[] tvs = rb.AsArray();
            fStake.HandleProfileView = tvs[1].Value.ToString().stringToHandle();

            rb = idAlign.getXData("CLASS");
            if (rb == null)
            {
                return(false);
            }
            tvs = rb.AsArray();
            string strClass = tvs[1].Value.ToString();

            fStake.ClassObj = strClass;

            Alignment align = (Alignment)idAlign.getEnt();

            fStake.ACTIVEALIGN = align;
            fStake.HandleAlign = idAlign.getHandle();
            fStake.objectID    = idAlign;

            int result = 0;

            for (int i = nameAlign.Length - 1; i >= 1; i += -1)
            {
                if (!nameAlign.Substring(i, 1).isInteger(out result))
                {
                    fStake.NameStakeObject = nameAlign.Substring(0, i);
                    break;
                }
            }

            ObjectId idTable = ObjectId.Null;

            Table table = null;

            try
            {
                idTable = Stake_Table.getTableId(idAlign);
            }
            catch (System.Exception)
            {
                try
                {
                    SelectionSet ss  = Select.buildSSet(typeof(Table));
                    ObjectId[]   ids = ss.GetObjectIds();

                    using (Transaction tr = BaseObjs.startTransactionDb())
                    {
                        for (int i = 0; i < ids.Length; i++)
                        {
                            table = (Table)tr.GetObject(ids[i], OpenMode.ForRead);
                            if (table.Cells[1, 1].Value.ToString() == nameAlign)
                            {
                                TypedValue[] t = new TypedValue[2];
                                t.SetValue(new TypedValue(1001, "TABLE"), 0);
                                t.SetValue(new TypedValue(1005, ids[i].getHandle()), 1);
                                idAlign.setXData(t, "TABLE");
                                break;
                            }
                        }
                    }
                }
                catch (System.Exception)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Select Table Failed");
                }
            }

            switch (fStake.algnData.Count)
            {
            case 0:

                alignData.AlignHandle = align.Handle;
                alignData.TableHandle = table.Handle;
                alignData.AlignID     = idAlign;
                alignData.AlignName   = nameAlign;
                alignData.AlignLayer  = align.Layer;

                fStake.algnData.Add(alignData);

                break;

            case 1:

                alignData = fStake.algnData[0];

                if (alignData.AlignHandle == align.Handle)
                {
                    alignData.TableHandle = table.Handle;
                }
                else
                {
                    alignDataX.AlignHandle = align.Handle;
                    alignDataX.TableHandle = table.Handle;
                    alignDataX.AlignID     = idAlign;
                    alignDataX.AlignName   = align.Name;
                    alignDataX.AlignLayer  = align.Layer;

                    fStake.algnData.Add(alignDataX);
                }
                break;

            default:

                bool boolFound = false;

                for (int i = fStake.algnData.Count; i > 1; i--)
                {
                    alignDataX = fStake.algnData[i - 1];
                    alignData  = fStake.algnData[i];

                    if (alignDataX.AlignHandle == alignData.AlignHandle)
                    {
                        fStake.algnData.RemoveAt(i);
                    }
                }

                for (int i = 1; i < fStake.algnData.Count; i++)
                {
                    alignData = fStake.algnData[i];
                    if (alignData.AlignHandle == objAlign.Handle)
                    {
                        alignData.TableHandle = idTable.getHandle();
                        boolFound             = true;
                    }
                }

                if (!boolFound)
                {
                    alignDataX.AlignHandle = objAlign.Handle;
                    alignDataX.TableHandle = idTable.getHandle();

                    alignDataX.AlignID    = idAlign;
                    alignDataX.AlignName  = objAlign.Name;
                    alignDataX.AlignLayer = objAlign.Layer;

                    fStake.algnData.Add(alignDataX);
                }

                break;
            }

            fStake.POI_CALC = Stake_Table.resetPOI(idTable);

            Stake_Misc.set_fStakeProps(strClass);

            if (strClass == "BLDG")
            {
                Stake_Grid.updateGridCollections(objAlign.Name);

                Application.ShowModelessDialog(Application.MainWindow.Handle, fGrid, false);
                fStake.Hide();
            }

            fStake.ACTIVEALIGN = objAlign;

            return(true);
        }
Exemplo n.º 8
0
        modifyStaking(List <POI> varpoi)
        {
            Alignment objAlign = fStake.ACTIVEALIGN;
            ObjectId  idAlign  = objAlign.ObjectId;

            List <POI> varPOIadd = new List <POI>();

            if (Stake_GetCardinals.userAddCrossingsFeatures(idAlign, ref varPOIadd))
            {
                switch (fStake.ClassObj)
                {
                case "WTR":
                    Stake_GetSurfaceElev.getSurfaceElevations(idAlign, ref varPOIadd);

                    break;

                case "ALIGN":
                case "SEWER":

                    Stake_GetSurfaceElev.getProfileElevations(idAlign, "STAKE", ref varPOIadd);

                    break;
                }

                for (int i = 0; i <= varPOIadd.Count; i++)
                {
                    varpoi.Add(varPOIadd[i]);
                }

                var sortSta = from s in varpoi
                              orderby s.Station ascending
                              select s;

                List <POI> poitmp = new List <POI>();
                foreach (var s in sortSta)
                {
                    poitmp.Add(s);
                }

                varpoi = poitmp;

                Stake_AddProfile.makeProfile(idAlign, varpoi, "STAKE", "ByLayout", true);

                switch (fStake.ClassObj)
                {
                case "ALIGN":
                case "SEWER":

                    Stake_UpdateProfile.updateProfile(idAlign, varpoi, "STAKE", false, "STAKE");

                    break;
                }

                List <AlgnData> algnData = fStake.algnData;
                AlgnData        aData    = new AlgnData();
                Table           objTable = null;
                for (int i = 1; i < algnData.Count; i++)
                {
                    aData = algnData[i];

                    if (aData.AlignHandle == objAlign.Handle)
                    {
                        objTable = (Table)aData.TableHandle.getEnt();
                        objTable.ObjectId.delete();
                        break;
                    }
                }

                ObjectId idTable = Stake_Table.makeTable(idAlign, varpoi, aData);
                Stake_Table.addTableData(idTable, varpoi);
            }
            return(varpoi);
        }
Exemplo n.º 9
0
        syncTableWithProfile()
        {
            List <POI> varPOIcur = fStake.POI_CALC;

            Alignment    objAlign = fStake.ACTIVEALIGN;
            ObjectId     idAlign  = objAlign.ObjectId;
            ResultBuffer rb       = idAlign.getXData("CLASS");

            if (rb == null)
            {
                return;
            }

            TypedValue[] tvs = rb.AsArray();
            fStake.ClassObj = tvs[1].Value.ToString();

            Profile objProfile = null;

            try
            {
                objProfile = Prof.getProfile(idAlign, "STAKE");
            }
            catch (System.Exception)
            {
            }

            ProfilePVICollection objProfilePVIs = objProfile.PVIs;
            Table    objTable = null;
            ObjectId idTable  = ObjectId.Null;

            try
            {
                idTable = Stake_Table.getTableId(idAlign);
            }
            catch (System.Exception)
            {
                try
                {
                    SelectionSet ss  = Select.buildSSet(typeof(Table));
                    ObjectId[]   ids = ss.GetObjectIds();

                    if (ids.Length > 0)
                    {
                        for (int i = 0; i < ids.Length; i++)
                        {
                            idTable  = ids[i];
                            objTable = (Table)idTable.getEnt();
                            if (objTable.Cells[1, 1].TextString == objAlign.Name)
                            {
                                break;
                            }
                        }
                    }
                }
                catch (System.Exception)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Select Table Failed");
                    return;
                }
            }

            fStake.POI_CALC = resetPOI(idTable);
            List <POI> varPOITmp = fStake.POI_CALC;

            List <POI> varpoi    = new List <POI>();
            List <POI> varpoiAdd = new List <POI>();

            Debug.Print(varPOITmp.Count.ToString());
            ProfilePVI objProfilePVI = null;

            for (int i = 0; i < varPOITmp.Count; i++)
            {
                for (int j = 0; j < objProfilePVIs.Count; j++)
                {
                    objProfilePVI = objProfilePVIs[j];
                    if (Math.roundDown2((objProfilePVI.Station)) == Math.roundDown2(varPOITmp[i].Station))
                    {
                        varpoi.Add(varPOITmp[i]);
                        break;
                    }
                }
            }
            bool boolExists = false;

            for (int i = 0; i < objProfilePVIs.Count; i++)
            {
                boolExists    = false;
                objProfilePVI = objProfilePVIs[i];
                for (int j = 0; j < varpoi.Count; j++)
                {
                    if (Math.roundDown2(varpoi[j].Station) == Math.roundDown2((objProfilePVI.Station)))
                    {
                        boolExists = true;
                        break;
                    }
                }

                if (!boolExists)
                {
                    POI vpoi = new POI();
                    vpoi.Station   = Math.roundDown3((objProfilePVI.Station));
                    vpoi.Elevation = objProfilePVI.Elevation;
                    vpoi.ClassObj  = fStake.ClassObj;
                    vpoi.Desc0     = "GB";
                    varpoiAdd.Add(vpoi);
                }
            }

            if (varpoiAdd[0].Desc0 != "NOTHING")
            {
                for (int i = 0; i < varpoiAdd.Count; i++)
                {
                    varpoi.Add(varpoiAdd[i]);
                }
            }

            var sortSta = from p in varpoi
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }

            varpoi = poiTmp;

            updateTableData(idTable, varpoi);

            fStake.POI_CALC = varpoi;
        }
Exemplo n.º 10
0
        stakePoints(object varStaBeg = null, object varStaEnd = null, object varSide = null, object varBegNum = null)
        {
            string    strClass = fStake.ClassObj;
            Alignment objAlign = null;

            try
            {
                objAlign = fStake.ACTIVEALIGN;
            }
            catch (System.Exception)
            {
                if (Stake_Algn.selectAlignment(ObjectId.Null))
                {
                    objAlign = fStake.ACTIVEALIGN;
                }
                else
                {
                    return;
                }
            }

            ObjectId idAlign = objAlign.ObjectId;

            fStake.STAKE_LAYER = fStake.cboOffset.Text + "-OS-" + objAlign.Name;

            ObjectId idTable = Stake_Table.getTableId(idAlign);

            List <POI> varpoi = Stake_Table.resetPOI(idTable);

            fStake.POI_CALC = varpoi;

            fStake.objectID = objAlign.ObjectId;
            int intSide = 0;

            double dblStation = 0, dblOffset = 0;

            if ((varSide == null))
            {
                if (double.Parse(fStake.cboOffset.Text) != 0)
                {
                    PromptStatus ps;
                    Point3d      varPntPick = Pub.pnt3dO;
                    try
                    {
                        varPntPick = UserInput.getPoint("\nSelect side to place stake points: <ESC to Cancel>", out ps, osMode: 0);
                    }
                    catch (System.Exception)
                    {
                        return;

                        ;
                    }

                    idAlign.getAlignStaOffset(varPntPick, ref dblStation, ref dblOffset);
                    if (System.Math.Abs(dblOffset) > 10.0)
                    {
                        string       message     = string.Format("Point selected is more than 10' from Alignment: {0} Continue", objAlign.Name);
                        DialogResult varResponse = MessageBox.Show(message, "Confirm stakng target.", MessageBoxButtons.YesNo);

                        if (varResponse == DialogResult.No)
                        {
                            return;
                        }
                        else
                        {
                            if (dblOffset < 0)
                            {
                                intSide = -1;
                            }
                            else
                            {
                                intSide = 1;
                            }

                            fStake.Side = intSide;
                        }
                    }
                    else
                    {
                        if (dblOffset < 0)
                        {
                            intSide = -1;
                        }
                        else
                        {
                            intSide = 1;
                        }

                        fStake.Side = intSide;
                    }
                }
                else
                {
                    fStake.Side = 1;
                }
            }
            else
            {
                intSide = int.Parse(varSide.ToString());
            }

            dblOffset = double.Parse(fStake.cboOffset.Text);
            string strName = fStake.NameStakeObject;

            var sortSta = from p in varpoi                              //sort stations
                          orderby p.Station ascending
                          select p;

            List <POI> poiTmp = new List <POI>();

            foreach (var p in sortSta)
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            double dblStaBeg = Math.roundDown3((objAlign.StartingStation));
            double dblStaEnd = Math.roundDown3((objAlign.EndingStation));

            List <POI> varPOI_TOF = null;
            List <POI> varPOI_TOW = null;

            Profile objProfile = null;

            switch (strClass)
            {
            case "WTR":

                objProfile = Prof.getProfile(idAlign, "CPNT");

                break;

            case "WALL":
                for (int i = 0; i < varpoi.Count; i++)
                {
                    if (varpoi[i].Desc0 == "TOF")
                    {
                        varPOI_TOF.Add(varpoi[i]);
                    }
                    else if (varpoi[i].Desc0 == "TOW")
                    {
                        varPOI_TOW.Add(varpoi[i]);
                    }
                }
                break;

            default:

                objProfile = Prof.getProfile(idAlign, "STAKE");

                break;
            }

            List <POI> varPOI_TMP = new List <POI>();

            if (strClass == "WALL")
            {
                Stake_GetStationing.getStationing(ref varPOI_TOF, dblStaBeg, dblStaEnd);
                Stake_GetStationing.getStationing(ref varPOI_TOW, dblStaBeg, dblStaEnd);
                for (int i = 0; i < varPOI_TOF.Count; i++)
                {
                    varPOI_TMP.Add(varPOI_TOF[i]);
                }

                for (int j = 0; j < varPOI_TOW.Count; j++)
                {
                    varPOI_TMP.Add(varPOI_TOW[j]);
                }

                varpoi = varPOI_TMP;
            }
            else
            {
                Stake_GetCardinals.checkBegAndEndDesc(idAlign, ref varpoi);
                Stake_GetStationing.getStationing(ref varpoi, dblStaBeg, dblStaEnd);
            }

            poiTmp = new List <POI>();
            foreach (var p in sortSta)             //sort stations
            {
                poiTmp.Add(p);
            }
            varpoi = poiTmp;

            uint lngPntNumBeg = Stake_Util.getBegPntNum();

            fStake.POI_STAKED = new List <POI>();
            List <POI> varPOI_STAKE = new List <POI>();

            if (strClass == "BLDG")
            {
                varPOI_STAKE = fStake.POI_STAKE;
            }
            else
            {
                if ((varStaBeg == null))
                {
                    varPOI_STAKE = varpoi;
                }
                else
                {
                    for (int i = 0; i < varpoi.Count; i++)
                    {
                        if (varpoi[i].Station >= double.Parse(varStaBeg.ToString()) && varpoi[i].Station <= double.Parse(varStaEnd.ToString()))
                        {
                            varPOI_STAKE.Add(varpoi[i]);
                        }
                    }
                }
            }

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {
                Debug.Print(varPOI_STAKE[i].Station + " " + varPOI_STAKE[i].Desc0);
            }
            POI     poi = new POI();
            double  dblElev = 0, dblEasting = 0, dblNorthing = 0;
            string  strDesc = "", strOffset = "";
            Point3d dblPnt = Pub.pnt3dO;

            for (int i = 0; i < varPOI_STAKE.Count; i++)
            {             //**********PROCESS varPOI_STAKE*********************
                if (varPOI_STAKE[i].DescX == "")
                {
                    poi             = varPOI_STAKE[i];
                    poi.DescX       = varPOI_STAKE[i].Desc0;
                    varPOI_STAKE[i] = poi;
                }

                switch (varPOI_STAKE[i].ClassObj)
                {
                case "WALL":

                    if (varPOI_STAKE[i].Desc0 == "TOW")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOW;
                    }
                    else if (varPOI_STAKE[i].Desc0 == "TOF")
                    {
                        dblElev = varPOI_STAKE[i].ElevTOF;
                    }

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        if (string.IsNullOrEmpty(strDesc))
                        {
                            strDesc = varPOI_STAKE[i].Desc0;
                        }

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }

                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "WTR":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0.Substring(0, 2))
                    {
                    case "TE":

                        if (varPOI_STAKE[i].Side == intSide)
                        {
                            set5x5(idAlign, dblElev, varPOI_STAKE[i].Station, dblOffset, intSide, strName, varPOI_STAKE[i].DescX);
                        }
                        else
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);

                            dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                            strOffset = dblOffset.ToString();

                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);
                        }

                        break;

                    case "AP":

                        switch (intSide)
                        {
                        case 1:
                            //right side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;

                        case -1:
                            //left side

                            //counterclockwise
                            if (varPOI_STAKE[i].isRightHand)
                            {
                                doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                //clockwise
                            }
                            else
                            {
                                doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                            }

                            break;
                        }

                        break;

                    default:

                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();

                        double dblCrossingInv = 0;
                        string strCrossingInv = "";
                        if (varPOI_STAKE[i].CrossAlign != "")
                        {
                            if (varPOI_STAKE[i].CrossAlignInv != 0)
                            {
                                dblCrossingInv = System.Math.Round(varPOI_STAKE[i].CrossAlignInv, 2);
                                strCrossingInv = string.Format("{0} INV.", dblCrossingInv);
                            }
                            else
                            {
                                strCrossingInv = "";
                            }

                            ASCIIEncoding ascii = new ASCIIEncoding();

                            string strAlignDesc = string.Format("{0}{1}%%C PIPE {2}", varPOI_STAKE[i].CrossAlignSize, ascii.GetString(new Byte[] { (Byte)34 }), strCrossingInv);

                            setOffsetPoint(dblPnt, strOffset, strName, strAlignDesc, idAlign, varPOI_STAKE[i].Station);
                        }
                        else
                        {
                            setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].DescX, idAlign, varPOI_STAKE[i].Station);

                            if (varPOI_STAKE[i].Type != "")
                            {
                                setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Type, idAlign, varPOI_STAKE[i].Station, " INV=");
                            }
                        }

                        break;
                    }

                    break;

                case "CURB":
                case "FL":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    switch (varPOI_STAKE[i].Desc0)
                    {
                    case "AP":

                        if (varPOI_STAKE[i].DescX.Contains("END"))
                        {
                            switch (intSide)
                            {
                            case 1:                                                    //right side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;

                            case -1:                                                    //left side

                                if (varPOI_STAKE[i].isRightHand)
                                {                                                         //counterclockwise
                                    doAnglePointIN(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }
                                else
                                {                                                         //clockwise
                                    doAnglePointOUT(idAlign, dblElev, varPOI_STAKE[i].Station, varPOI_STAKE[i].AngDelta, varPOI_STAKE[i].AngDir, varPOI_STAKE[i].DescX, strName, intSide, dblOffset);
                                }

                                break;
                            }
                        }

                        break;

                    case "BC":
                    case "EC":

                        doCurve(ref i, idAlign, objProfile, varPOI_STAKE, intSide, dblOffset, strName);

                        break;

                    default:

                        strDesc = varPOI_STAKE[i].DescX;
                        //          If strDesc = "" Then
                        //            strDesc = varPOI_Stake[i].Desc0
                        //          End If

                        try
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        catch (System.Exception)
                        {
                            idAlign.getAlignPointLoc(varPOI_STAKE[i].Station - 0.01, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                        }
                        dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                        strOffset = dblOffset.ToString();
                        setOffsetPoint(dblPnt, strOffset, strName, strDesc, idAlign, varPOI_STAKE[i].Station);

                        break;
                    }

                    break;

                case "ALIGN":
                case "SEWER":

                    dblElev = System.Math.Round(objProfile.ElevationAt(Math.roundDown3(varPOI_STAKE[i].Station)), 2);

                    if (varPOI_STAKE[i].Desc0 == "BC")
                    {
                        setRadiusPoint(idAlign, varPOI_STAKE[i], varPOI_STAKE[i].Radius, strName);
                    }

                    try
                    {
                        idAlign.getAlignPointLoc(varPOI_STAKE[i].Station, dblOffset * intSide, ref dblEasting, ref dblNorthing);
                    }
                    catch (System.Exception)
                    {
                    }

                    dblPnt = new Point3d(dblEasting, dblNorthing, dblElev);

                    strOffset = dblOffset.ToString();
                    setOffsetPoint(dblPnt, strOffset, strName, varPOI_STAKE[i].Desc0, idAlign, varPOI_STAKE[i].Station);

                    break;
                }
            }

            List <POI> varPOI_STAKED = fStake.POI_STAKED;
            int        intUBnd       = varPOI_STAKED.Count - 1;

            uint lngPntNumEnd = uint.Parse(varPOI_STAKED[intUBnd].PntNum);

            TypedValue[] tvs = new TypedValue[4] {
                new TypedValue(1001, "STAKE"),
                new TypedValue(1071, lngPntNumBeg),
                new TypedValue(1071, lngPntNumEnd),
                new TypedValue(1000, fStake.STAKE_LAYER)
            };

            idAlign.setXData(tvs, "STAKE");

            CgPnt_Group.updatePntGroup("SPNT");

            Stake_UpdateProfile.updateProfile(idAlign, (fStake.POI_STAKED), "STAKE", true, "STAKED");

            bool     exists = false;
            ObjectId idDict = Dict.getNamedDictionary("STAKE_PNTS", out exists);

            List <Point3d> dblPnts   = new List <Point3d>();
            Point3d        pnt3d     = Pub.pnt3dO;
            uint           lngPntNum = 0;

            for (int p = 0; p < varPOI_STAKED.Count; p++)
            {
                string varPntNum = varPOI_STAKED[p].PntNum;

                int intPos = varPntNum.IndexOf(" ");

                if (intPos != 0)
                {
                    lngPntNum = uint.Parse(varPntNum.Substring(0, intPos - 1));
                }
                else
                {
                    lngPntNum = uint.Parse(varPntNum);
                }

                ObjectId idPnt = BaseObjs._civDoc.CogoPoints.GetPointByPointNumber(uint.Parse(varPOI_STAKED[p].PntNum));
                pnt3d = idPnt.getCogoPntCoordinates();
                dblPnts.Add(pnt3d);
                ResultBuffer rb = new ResultBuffer {
                    new TypedValue(1000, idPnt.getCogoPntNumber().ToString()),
                    new TypedValue(1005, idPnt.getHandle().ToString())
                };
                Dict.addXRec(idDict, idPnt.ToString(), rb);
            }

            dblPnts.Add(dblPnts[0]);

            Misc.logUsage("STAKE", (lngPntNumEnd - lngPntNumBeg + 1));
        }