Exemple #1
0
        public void GetFFLfromSurface()
        {
            Database acCurDb;

            acCurDb = Application.DocumentManager.MdiActiveDocument.Database;

            Transaction acTrans = acCurDb.TransactionManager.TopTransaction;

            BlockReference     newBlockRef   = acTrans.GetObject(BlockRef, OpenMode.ForWrite) as BlockReference;//(BlockReference)BlockRef.GetObject(OpenMode.ForWrite);
            DBObjectCollection explodedBlock = new DBObjectCollection();

            newBlockRef.Explode(explodedBlock);

            ObjectIdCollection SurfaceIds     = CivilApplication.ActiveDocument.GetSurfaceIds();
            CivSurface         proposedGround = null;

            foreach (ObjectId surfaceId in SurfaceIds)
            {
                CivSurface oSurface = surfaceId.GetObject(OpenMode.ForRead) as CivSurface;
                if (oSurface.Name == Civils.Constants.ProposedGroundName)
                {
                    proposedGround = oSurface;
                }
            }

            double maxLevel = double.NegativeInfinity;

            if (proposedGround != null)
            {
                try
                {
                    foreach (WallJoint wj in Joints)
                    {
                        wj.ExternalLevel = Math.Round(proposedGround.FindElevationAtXY(wj.Point.X, wj.Point.Y) * 1000) / 1000;
                        if (wj.ExternalLevel > maxLevel)
                        {
                            maxLevel = wj.ExternalLevel;
                        }
                    }
                }
                catch (PointNotOnEntityException e)
                {
                    maxLevel           = -0.15;
                    this.Status        = PlotStatus.Error;
                    this.StatusMessage = "Plot has points not on proposed ground model";
                }

                if (maxLevel == double.NegativeInfinity)
                {
                    maxLevel           = -0.15;
                    this.Status        = PlotStatus.Error;
                    this.StatusMessage = "Surface elevations not found correctly";
                }
            }
            else
            {
                maxLevel           = -0.15;
                this.Status        = PlotStatus.Error;
                this.StatusMessage = "Proposed Ground model not found";
            }

            this.FinishedFloorLevel = Math.Round(maxLevel * 1000) / 1000 + 0.15;
        }