Ejemplo n.º 1
0
        processCurb(string nameLayer, ObjectId idPolyGuideline, BlockTableRecord ms, string nameXRef, ref List <POI> varPOI, out ObjectId idAlign)
        {
            string    nameAlign = Align.getAlignName(nameLayer);
            Alignment align     = Align.addAlignmentFromPoly(nameAlign, nameLayer, idPolyGuideline, "Standard", "Standard", true);

            fStake.ACTIVEALIGN = align;
            idAlign            = align.ObjectId;
            fStake.objectID    = idAlign;

            Stake_GetCardinals.getCardinals_Horizontal(idAlign, ref varPOI);

            Stake_GetNestedObjects.getNestedPoints(idAlign, ref varPOI, ms, nameXRef);

            fStake.POI_ORG = varPOI;

            Stake_GetCardinals.getCardinals_Vertical(idAlign, ref varPOI);

            Stake_AddProfile.makeProfile(idAlign, varPOI, "CURB", "ByLayout", false); //VERTICAL CONTROL IS SET FROM POINTS

            Stake_GetAnglePoints.getAnglePoints(idAlign, ref varPOI);                 //IDENTIFY ANGLE POINTS - CHECK IF CLOSED

            Stake_GetCardinals.checkBegAndEndStations(idAlign, ref varPOI);

            if (varPOI[0].isClosed)
            {
                Stake_GetAnglePoints.addEndElev(idAlign, ref varPOI, "FLOWLINE");
            }

            Stake_GetBC_EC.getBC_EC(idAlign, ref varPOI);

            Debug.Print("BEGIN POI AFTER getBC_EC");

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

            Debug.Print("END POI AFTER getBC_EC");

            Stake_DuplicateStations.resolveDuplicateStations(ref varPOI);

            Stake_AddProfile.makeProfile(idAlign, varPOI, "CURB", "ByLayout", true);

            Stake_UpdateProfile.updateProfile(idAlign, fStake.POI_ORG, "FLOWLINE", true, "ORG");

            Stake_UpdateProfile.updateProfile(idAlign, varPOI, "STAKE", false, "STAKE");
        }
Ejemplo n.º 2
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");
            }
        }
Ejemplo n.º 3
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
        }
Ejemplo n.º 4
0
        processSewer(string nameLayer, ObjectId idPolyGuideline, BlockTableRecord ms, string nameXRef, ref List <POI> varPOI, out ObjectId idAlign)
        {
            List <Point3d> pnts3d    = idPolyGuideline.getCoordinates3dList();
            Alignment      align     = null;
            string         nameAlign = "";

            idAlign = ObjectId.Null;

            if (pnts3d.Count == 1)
            {
                DialogResult varResponse = System.Windows.Forms.MessageBox.Show("Single segment selected!!\n\n" + "Proceed with single segment?\n", "SINGLE SEGMENT SELECTED", MessageBoxButtons.YesNo);

                switch (varResponse)
                {
                case DialogResult.Yes:
                    nameAlign          = Align.getAlignName(nameLayer);
                    align              = Align.addAlignmentFromPoly(nameAlign, nameLayer, idPolyGuideline, "Standard", "Standard", true);
                    fStake.ACTIVEALIGN = align;
                    idAlign            = align.ObjectId;
                    fStake.objectID    = idAlign;
                    break;

                case DialogResult.No:
                    varResponse = System.Windows.Forms.MessageBox.Show("Create Alignment?\n", "CREATE ALIGNMENT", MessageBoxButtons.YesNo);

                    switch (varResponse)
                    {
                    case DialogResult.Yes:
                        Stake_Algn.createNewAlign(nameLayer);
                        idPolyGuideline.delete();
                        break;

                    case DialogResult.No:
                        idPolyGuideline.delete();
                        break;
                    }
                    break;
                }
            }
            else
            {
                nameAlign          = Align.getAlignName(nameLayer);
                align              = Align.addAlignmentFromPoly(nameAlign, nameLayer, idPolyGuideline, "Standard", "Standard", true);
                fStake.ACTIVEALIGN = align;
                idAlign            = align.ObjectId;
                fStake.objectID    = idAlign;
            }

            fStake.HandleAlign     = idAlign.getHandle();
            fStake.NameStakeObject = nameAlign;

            Stake_GetCardinals.getCardinals_Horizontal(idAlign, ref varPOI);

            Stake_GetNestedObjects.getNestedPoints(idAlign, ref varPOI, ms, nameXRef);

            Stake_GetCardinals.getCrossingAligns(idAlign, ref varPOI);

            fStake.POI_ORG = varPOI;

            Stake_GetCardinals.getCardinals_Vertical(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");
        }