/// <summary> /// Elevations the in surface range. /// </summary> /// <param name="elevation">The elevation.</param> /// <param name="surface">The surface.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> private bool elevationInSurfaceRange(double elevation, TinSurface surface) { GeneralSurfaceProperties properties = surface.GetGeneralProperties(); if (elevation < properties.MinimumElevation || elevation > properties.MaximumElevation) { ////_editor.WriteMessage( //"\nSpecified elevation not in surface range.") //; return(false); } return(true); }
public void CDS_TinSurfacePropertiesDemo() { ObjectId surfaceId = promptForTinSurface(); if (ObjectId.Null == surfaceId) { write("\nNo TIN Surface object was selected."); return; // We don't have a surface; we can't continue. } using (Transaction tr = startTransaction()) { TinSurface surface = surfaceId.GetObject( OpenMode.ForRead) as TinSurface; write("\nInformation for TIN Surface: " + surface.Name); writeGeneralProperites(surface.GetGeneralProperties()); writeTerrainProperties(surface.GetTerrainProperties()); writeTinSurfaceProperties(surface.GetTinProperties()); } }
getAverageElev(ObjectId idPoly, bool boolShowPoints, string strSurface) { double dblZ_Total = 0; double dblZ_AVG = 0; bool exists = false; ObjectId idSurfaceEXIST = Surf.getSurface(strSurface, out exists); TinSurface surfaceEXIST = (TinSurface)idSurfaceEXIST.getEnt(); if (surfaceEXIST.GetGeneralProperties().MinimumElevation <= 0.0) { Autodesk.AutoCAD.ApplicationServices.Core.Application.ShowAlertDialog(string.Format("Check Surface EXIST elevations: Minimum elevation: {0}", surfaceEXIST.GetGeneralProperties().MinimumElevation)); return(0); } using (BaseObjs._acadDoc.LockDocument()) { if (!idPoly.isRightHand()) { idPoly.reversePolyX(); } idPoly.checkIfClosed(); } Point3dCollection pntsGrid = Misc.getBldgLimitsAVG(idPoly, 20); Point3dCollection pntsGridElev = new Point3dCollection(); foreach (Point3d pnt3d in pntsGrid) { try { double dblZ = surfaceEXIST.FindElevationAtXY(pnt3d.X, pnt3d.Y); dblZ_Total = dblZ_Total + dblZ; if (boolShowPoints) { pntsGridElev.Add(new Point3d(pnt3d.X, pnt3d.Y, dblZ)); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Grading_Floor.cs: line: 115"); } } if (boolShowPoints) { uint pntNum; using (BaseObjs._acadDoc.LockDocument()) { foreach (Point3d pnt3d in pntsGridElev) { pnt3d.setPoint(out pntNum, "CPNT-ON"); } } } dblZ_AVG = dblZ_Total / (pntsGrid.Count); return(dblZ_AVG); }
initForm() { TinVolumeSurface objSurfaceTIN = Surf.getTinVolumeSurface("VOL_EXIST_BOT"); dblVOL_EXIST_BOT_CUT = objSurfaceTIN.GetVolumeProperties().UnadjustedCutVolume / 27; dblVOL_EXIST_BOT_FILL = objSurfaceTIN.GetVolumeProperties().UnadjustedFillVolume / 27; objSurfaceTIN = Surf.getTinVolumeSurface("VOL_BOT_SG"); dblVOL_BOT_SG_CUT = objSurfaceTIN.GetVolumeProperties().UnadjustedCutVolume / 27; dblVOL_BOT_SG_FILL = objSurfaceTIN.GetVolumeProperties().UnadjustedFillVolume / 27; TinSurface objSurfaceCPNT = Surf.getTinSurface("CPNT-ON"); TinSurface objSurfaceSG = Surf.getTinSurface("SG"); dblSG_MEAN_ELEV = System.Math.Round(objSurfaceSG.GetGeneralProperties().MeanElevation, 2); dblVOL_CUT_TOT = dblVOL_EXIST_BOT_CUT + dblVOL_BOT_SG_CUT; dblVOL_FILL_TOT = dblVOL_EXIST_BOT_FILL + dblVOL_BOT_SG_FILL; dblVOL_CUT_SHRINK = dblVOL_CUT_TOT * dblSHRINKAGE_FACTOR * -1; dblVOL_CUT_NET = dblVOL_CUT_TOT + dblVOL_CUT_ADJ_NET + dblVOL_CUT_SHRINK; dblVOL_FILL_NET = dblVOL_FILL_TOT + dblVOL_FILL_ADJ_NET; dblVOL_NET = dblVOL_CUT_NET - dblVOL_FILL_NET; dblSITE_ADJUST = dblVOL_NET * 27 / dblAREA_SITE; strDATE = DateTime.Today.ToShortDateString(); strUSER = System.Environment.UserName; EW_Data varDataCurrent = new EW_Data(); varDataCurrent.ITERATION = "C"; varDataCurrent.DATE = strDATE; varDataCurrent.USER = strUSER; varDataCurrent.AREA_SITE = dblAREA_SITE; varDataCurrent.SG_MEAN_ELEV = dblSG_MEAN_ELEV; varDataCurrent.VOL_CUT_TOT = dblVOL_CUT_TOT; varDataCurrent.VOL_FILL_ADJ_NET = dblVOL_CUT_ADJ_NET; varDataCurrent.VOL_CUT_SHRINK = dblVOL_CUT_SHRINK; varDataCurrent.VOL_CUT_NET = dblVOL_CUT_NET; varDataCurrent.VOL_FILL_TOT = dblVOL_FILL_TOT; varDataCurrent.VOL_FILL_ADJ_NET = dblVOL_FILL_ADJ_NET; varDataCurrent.VOL_FILL_NET = dblVOL_FILL_NET; varDataCurrent.VOL_NET = dblVOL_NET; varDataCurrent.SITE_ADJUST = dblSITE_ADJUST; //ObjectId idDictEW = Dict.getNamedDictionary("EARTHWORK", out exists); //idDict.delete(); !!!!!!!!!!!!!!!!!!!!!!!****************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ObjectId idDictEW = Dict.getNamedDictionary("EARTHWORK", out exists); if (!exists) { this.Title = "NEW EARTHWORK - COOL!!"; dblSG_MEAN_ELEV0 = dblSG_MEAN_ELEV; this.AdjustSurfaceSG.Text = string.Format("{0:#0.00}", dblSG_MEAN_ELEV - dblSG_MEAN_ELEV0); ewData.Add(varDataCurrent); this.DG1.DataContext = ewData; } else { ewData = getDictData(); if (ewData.Count != 0) { dblSG_MEAN_ELEV0 = ewData[0].SG_MEAN_ELEV; if (dblSG_MEAN_ELEV0 == 0) { dblSG_MEAN_ELEV0 = dblSG_MEAN_ELEV; } this.AdjustSurfaceSG.Text = string.Format("{0:#0.00}", dblSG_MEAN_ELEV - dblSG_MEAN_ELEV0); } else { dblSG_MEAN_ELEV0 = dblSG_MEAN_ELEV; } this.DG1.DataContext = ewData; } }
balanceSite() { double dblSiteAdjust = 0; Point3d pnt3dMove0 = Point3d.Origin; TinSurface objSurfaceSG = Surf.getTinSurface("SG", out exists); TinSurface objSurfaceOX = Surf.getTinSurface("OX", out exists); dblSiteAdjust = double.Parse(this.tboxAdjSurface.Text); varDataCurrent.SITE_ADJUST = dblSiteAdjust; updateDictionary(varDataCurrent); Point3d pnt3dMoveX = new Point3d(0, 0, dblSiteAdjust); Matrix3d mtx3d = Matrix3d.Displacement(pnt3dMoveX - pnt3dMove0); objSurfaceSG.TransformBy(mtx3d); objSurfaceOX.TransformBy(mtx3d); ewtbe.reTest(); ewmsv.updateVolSurface("EXIST", "BOT"); ewmsv.updateVolSurface("BOT", "SG"); // ERROR: Not supported in C#: OnErrorStatement ObjectId idSurfaceCUT = Surf.getSurface("VOL_EXIST_BOT", out exists); if (idSurfaceCUT.IsNull) { ewmsv.updateVolSurface("EXIST", "BOT"); } ObjectId idSurfaceFILL = Surf.getSurface("VOL_BOT_SG", out exists); if (idSurfaceFILL.IsNull) { ewmsv.updateVolSurface("BOT", "SG"); } TinVolumeSurface objSurfaceCUT = (TinVolumeSurface)idSurfaceCUT.getEnt(); dblVOL_EXIST_BOT_CUT = objSurfaceCUT.GetVolumeProperties().UnadjustedCutVolume / 27; dblVOL_EXIST_BOT_FILL = objSurfaceCUT.GetVolumeProperties().UnadjustedFillVolume / 27; TinVolumeSurface objSurfaceFILL = (TinVolumeSurface)idSurfaceFILL.getEnt(); dblVOL_BOT_SG_CUT = objSurfaceFILL.GetVolumeProperties().UnadjustedCutVolume / 27; dblVOL_BOT_SG_FILL = objSurfaceFILL.GetVolumeProperties().UnadjustedFillVolume / 27; dblVOL_CUT_TOT = dblVOL_EXIST_BOT_CUT + dblVOL_BOT_SG_CUT; //Gross Cut put in spreadsheet dblVOL_FILL_TOT = dblVOL_EXIST_BOT_FILL + dblVOL_BOT_SG_FILL; //Gross Fill put in spreadsheet dblVOL_CUT_SHRINK = (dblVOL_CUT_TOT * dblSHRINKAGE_FACTOR * -1); dblVOL_CUT_NET = dblVOL_CUT_ADJ_NET + dblVOL_CUT_TOT + dblVOL_CUT_SHRINK; dblVOL_FILL_NET = dblVOL_FILL_ADJ_NET + dblVOL_FILL_TOT; dblSG_MEAN_ELEV = objSurfaceSG.GetGeneralProperties().MeanElevation; dblVOL_NET = (dblVOL_CUT_NET - dblVOL_FILL_NET); dblSITE_ADJUST = dblVOL_NET * 27 / dblAREA_SITE; this.AdjustSurfaceSG.Text = string.Format("{0:#0.00", dblSG_MEAN_ELEV - dblSG_MEAN_ELEV0); varDataCurrent.ITERATION = "C"; varDataCurrent.DATE = strDATE; varDataCurrent.USER = strUSER; varDataCurrent.AREA_SITE = dblAREA_SITE; varDataCurrent.SG_MEAN_ELEV = dblSG_MEAN_ELEV; varDataCurrent.VOL_CUT_TOT = dblVOL_CUT_TOT; varDataCurrent.VOL_CUT_ADJ_NET = dblVOL_CUT_ADJ_NET; varDataCurrent.VOL_CUT_SHRINK = dblVOL_CUT_SHRINK; varDataCurrent.VOL_CUT_NET = dblVOL_CUT_NET; varDataCurrent.VOL_FILL_TOT = dblVOL_FILL_TOT; varDataCurrent.VOL_FILL_ADJ_NET = dblVOL_FILL_ADJ_NET; varDataCurrent.VOL_FILL_NET = dblVOL_FILL_NET; varDataCurrent.VOL_NET = dblVOL_NET; varDataCurrent.SITE_ADJUST = dblSITE_ADJUST; ewData = getDictData(); ewData.Add(varDataCurrent); this.DG1.DataContext = ewData; return; }
public void TinSurfacePropertiesWriter() { var doc = Active.MdiDocument; var db = doc.Database; var surfaces = GetSurfaceEntityIDs(db); //Write PlaceHolder FeatureCount(); foreach (var surfid in surfaces) { ObjectId surfaceId = surfid; if (ObjectId.Null == surfaceId) { return; // We don't have a surface; we can't continue. } using (var tran = db.TransactionManager.StartTransaction()) { TinSurface surface = surfaceId.GetObject( OpenMode.ForRead) as TinSurface; if (surface.Name.Contains("GREEN")) { greens++; } else if (surface.Name.Contains("FAIRWAY")) { fairway++; } else if (surface.Name.Contains("BUNKER")) { bunker++; } else if (surface.Name.Contains("TEEBOX") || surface.Name.Contains("TEE")) { teebox++; } _write("\nInformation for TIN Surface: " + surface.Name); try { writeGeneralProperites(surface.GetGeneralProperties()); writeTerrainProperties(surface.GetTerrainProperties()); writeTinSurfaceProperties(surface.GetTinProperties()); } catch (System.Exception ex) { COMS.MessengerManager.LogException(ex); _write("Failure retrieving Surface Properties!"); } tran.Commit(); } } AddFooterInfo(); }