Ejemplo n.º 1
0
        getPipeData(double dblStation, ObjectId idAlign)
        {
            //BEGIN MATCH UP NETWORK TO PIPE
            ObjectIdCollection idsNets         = BaseObjs._civDoc.GetPipeNetworkIds();
            ObjectId           idAlignRef      = ObjectId.Null;
            string             strRefAlignName = "";
            Network            objNetWorkX     = null;

            PIPE_DATA pipeData = new PIPE_DATA();

            for (int i = 0; i < idsNets.Count; i++)
            {
                Network objNetWork = (Network)idsNets[i].getEnt();

                try
                {
                    idAlignRef = objNetWork.ReferenceAlignmentId;

                    strRefAlignName = objNetWork.ReferenceAlignmentName;
                }
                catch (System.Exception)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Error: Reference Alignment for Network" + objNetWork.Name + "not found - exiting");
                    return(pipeData);
                }

                string nameAlign = Align.getAlignName(idAlign);
                if (strRefAlignName == nameAlign)
                {
                    objNetWorkX = objNetWork;
                    break;
                }
            }
            //END MATCH UP NETWORK TO PIPE

            if (objNetWorkX == null)
            {
                pipeData.Invert = -1;
                pipeData.Size   = -1;
                return(pipeData);
            }

            ObjectIdCollection objPipes = objNetWorkX.GetPipeIds();
            ObjectId           idStructStart = ObjectId.Null, idStructEnd = ObjectId.Null;

            Structure objStructStart = null, objStructEnd = null;
            double    dblStationX = 0, dblOffset = 0, dblStaStructStart = 0, dblStaStructEnd = 0;

            for (int i = 0; i < objPipes.Count; i++)
            {
                Pipe objPipe = (Pipe)objPipes[i].getEnt();

                try
                {
                    idStructStart  = objPipe.StartStructureId;
                    objStructStart = (Structure)idStructStart.getEnt();
                    Point3d pnt3d = objStructStart.Location;
                    idAlign.getAlignStaOffset(pnt3d, ref dblStationX, ref dblOffset);
                    dblStaStructStart = dblStationX;
                }
                catch (System.Exception)
                {
                }

                try
                {
                    idStructEnd  = objPipe.EndStructureId;
                    objStructEnd = (Structure)idStructEnd.getEnt();
                    Point3d pnt3d = objStructEnd.Location;
                    idAlign.getAlignStaOffset(pnt3d, ref dblStationX, ref dblOffset);
                    dblStaStructEnd = dblStationX;
                }
                catch (System.Exception)
                {
                }
                double dblStaPipeStart = 0;
                if (System.Math.Round(dblStation, 2) > System.Math.Round(dblStaStructStart, 2))
                {
                    if (System.Math.Round(dblStation, 2) < System.Math.Round(dblStaStructEnd, 2))
                    {
                        idAlign.getAlignStaOffset(objPipe.StartPoint, ref dblStaPipeStart, ref dblOffset);
                        double dblElevStart = objPipe.StartPoint.Z;
                        double dblElevEnd   = objPipe.EndPoint.Z;
                        double dblSlope     = (dblElevEnd - dblElevStart) / objPipe.Length2DCenterToCenter;
                        double dblLenX      = dblStation - dblStaPipeStart;
                        double dblSize      = objPipe.InnerDiameterOrWidth;
                        double dblVertComp  = dblSize / System.Math.Cos(System.Math.Atan(dblSlope));
                        dblSize = System.Math.Round(dblSize * 12, 0);
                        double dblInvElev = (dblElevStart - 0.5 * dblVertComp) + dblSlope * dblLenX;

                        pipeData.Invert = System.Math.Round(dblInvElev, 3);
                        pipeData.Size   = dblSize;

                        break;
                    }
                }
            }

            return(pipeData);
        }
Ejemplo n.º 2
0
        getCrossingAligns(ObjectId idAlign, ref List <POI> varpoi)
        {
            Alignment          objAlign = (Alignment)idAlign.getEnt();
            bool               boolAdd = false;
            double             dblStation = 0, dblStationX = 0, dblOffset = 0;
            ObjectIdCollection idAligns = BaseObjs._civDoc.GetAlignmentIds();

            for (int i = 0; i < idAligns.Count; i++)
            {
                if (Align.getAlignName(idAligns[i]) != Align.getAlignName(idAlign))
                {
                    Alignment objAlignX = (Alignment)idAligns[i].getEnt();
                    objAlignX.Highlight();

                    if (objAlignX.IsReferenceObject)
                    {
                        boolAdd = true;

                        Point3dCollection varPntInt = new Point3dCollection();
                        objAlign.IntersectWith(objAlignX, Intersect.OnBothOperands, varPntInt, IntPtr.Zero, IntPtr.Zero);

                        for (int k = 0; k < varPntInt.Count; k++)
                        {
                            Point3d pnt3dInt = varPntInt[k];
                            idAlign.getAlignStaOffset(pnt3dInt, ref dblStation, ref dblOffset);

                            POI vpoi = new POI();

                            vpoi.Station    = Math.roundDown3(dblStation);
                            vpoi.Desc0      = fStake.NameStakeObject;
                            vpoi.ClassObj   = fStake.ClassObj;
                            vpoi.CrossAlign = objAlignX.Name;

                            //GET PIPE INVERT ELEVATION

                            PIPE_DATA varPipeData = Stake_GetPipeInvertElev.getPipeData(dblStation, idAlign);

                            vpoi.Size   = varPipeData.Size;
                            vpoi.Invert = varPipeData.Invert;

                            idAligns[i].getAlignStaOffset(pnt3dInt, ref dblStationX, ref dblOffset);

                            vpoi.CrossAlignSta = System.Math.Round(dblStation, 3);

                            //GET PIPE INVERT ELEVATION

                            varPipeData = Stake_GetPipeInvertElev.getPipeData(dblStationX, idAligns[i]);

                            vpoi.CrossAlignSize = varPipeData.Size;
                            vpoi.CrossAlignInv  = varPipeData.Invert;

                            varpoi.Add(vpoi);
                        }
                    }
                }
            }

            if (boolAdd)
            {
                varpoi = varpoi.sortPOIbyStation();
            }
        }