makeBotSurfaceGrid(int intInterval, int i1) { App.SetSystemVariable("PDSISE", 0.01); setPointStyleBOT(); setPointLabelStyleBOT(); bool exists; TinSurface objSurfaceCPNT_ON = Surf.getTinSurface("CPNT-ON", out exists); Object[] varLimits = EW_Utility2.getLimits(intInterval); double dblPntXmin = (double)varLimits[0]; double dblPntYmin = (double)varLimits[1]; int iMax = (int)varLimits[2]; int jMax = (int)varLimits[3]; for (int j = 0; j <= jMax; j++) { double dblY = dblPntYmin + (j * intInterval); for (int i = 0; i <= iMax; i++) { double dblX = dblPntXmin + (i * intInterval); double dblZ_OX = objSurfaceCPNT_ON.FindElevationAtXY(dblX, dblY); if (dblZ_OX > 0) //point is inside OX boundary { Point3d dblPnt = new Point3d(dblX, dblY, dblZ_OX); ObjectId idCivilPnt = dblPnt.setPoint("GRID-POINTS"); } } } TypedValue[] tvs = new TypedValue[4] { new TypedValue(1001, "BOT"), new TypedValue(1040, varLimits[0]), new TypedValue(1040, varLimits[1]), new TypedValue(1070, intInterval) }; ObjectId idDictBOT = Dict.getNamedDictionary("BOT", out exists); idDictBOT.setXData(tvs, "BOT"); return(varLimits); }
public static bool offsetSegments(string strSurfaceName, string strSurfaceNameX, ObjectId idLWPlineX, string varLayerName = "") { double dblZOff = 0; int intCase1 = 0, intCase2_1 = 0, intCase2_2 = 0, intCase2_3 = 0, intCase2_4 = 0, intCase2_5 = 0, intCase2_6 = 0, intCase2_7 = 0; int intCase2_8 = 0, intCase5_1 = 0, intCase5_2 = 0, intCase5_3 = 0, intCase5_4 = 0, intCase5_5 = 0, intCase8_5 = 0, intCase11 = 0; TinSurface objSurfaceSG = null; if (strSurfaceName == "SG") { objSurfaceSG = Surf.getTinSurface("SG", out exists); if ((objSurfaceSG == null)) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("Surface SG missing - exiting routine"); return(false); } } ObjectId id3dBrkP = ObjectId.Null, idTextB = ObjectId.Null, idTextE = ObjectId.Null; string strLayerName = varLayerName; ObjectId id3dBndry = EW_Build3dPoly.buildArea3dLimit(idLWPlineX, strSurfaceName, strSurfaceNameX, strLayerName); //returns 3D poly with surface elevations, endPnt = begPnt if (id3dBndry == ObjectId.Null) { return(false); } string strHandle = idLWPlineX.getHandle().ToString(); string strLayer = idLWPlineX.getLayer(); if (varLayerName == "") { dblZOff = EW_Utility1.getDepth(strLayer, strSurfaceNameX); //get depth for area } else { if (!varLayerName.Contains("_OX-AREA-")) { dblZOff = EW_Utility1.getDepth(varLayerName, strSurfaceNameX); } else { dblZOff = double.Parse(varLayerName.Substring(10)); } } Point3d pnt3d0 = new Point3d(0, 0, 0); Point3d pnt3dX = new Point3d(0, 0, -dblZOff); id3dBndry.moveObj(pnt3d0, pnt3dX); if (idLWPlineX == ObjectId.Null) { MessageBox.Show("idLWPlineX is null"); } List <Point3d> varPnts3dBndry0z = idLWPlineX.getCoordinates3dList(); idLWPlineX.delete(); List <Point3d> varPnts3dBndry0zForInt = varPnts3dBndry0z; varPnts3dBndry0zForInt.RemoveAt(varPnts3dBndry0z.Count - 1); //remove endPnt ==>> endPnt <> begPnt if (strSurfaceName == "CPNT-ON") { strLayerName = "CPNT-BRKLINE"; } else { strLayerName = string.Format("{0}-BRKLINE", strSurfaceName); } ObjectIdCollection ids = null; if (pub.boolDebug) { escape = Select.getSelSetFromUser(out ids); } else { ss = EW_Utility1.buildSSetCPNT_ON_SEGMENTS(strLayerName, varPnts3dBndry0z); //select triangle segments (3dPolylines) by polygon crossing } if (ss == null) { return(false); } ObjectId[] idsSegments = ss.GetObjectIds(); TypedValue[] tvs = new TypedValue[3] { new TypedValue(1001, "makeBOT"), new TypedValue(1000, varLayerName), new TypedValue(1000, "BRKLINES") }; for (int j = 0; j < idsSegments.Length; j++) { strLayer = string.Format("{0}-BRKLINE", strSurfaceNameX); ObjectId id = idsSegments[j]; ObjectId idBrk = ObjectId.Null; Entity ent = id.getEnt(); if (ent.GetType() == typeof(PolylineVertex3d)) { idBrk = id.getOwnerOfVertex2d3d(); } else if (ent.GetType() == typeof(Polyline3d)) { idBrk = id; } //ent = idBrk.getEnt(); //MessageBox.Show(ent.GetType().ToString()); ObjectId id3dBrkX = idBrk.copy(strLayer); //ent = id3dBrkX.getEnt(); //MessageBox.Show(ent.GetType().ToString()); id3dBrkX.moveObj(pnt3d0, pnt3dX); //move copy of triangle edge based on vertical offset id3dBrkX.changeProp(clr.byl, strLayer); //ent = id3dBrkX.getEnt(); //MessageBox.Show(ent.GetType().ToString()); List <Point3d> varPnts3d = id3dBrkX.getCoordinates3dList(); Point3d dblPntBeg = varPnts3d[0]; Point3d dblPntEnd = varPnts3d[1]; //end point of triangle edge (3dPoly segment) if (pub.boolDebug) { idTextB = Txt.addText("B", dblPntBeg, 0, AttachmentPoint.BottomLeft); idTextB.changeProp(color, "DEBUG-0", LineWeight.LineWeight020); } if (pub.boolDebug) { idTextE = Txt.addText("E", dblPntBeg, 0, AttachmentPoint.BottomLeft); idTextE.changeProp(color, "DEBUG-0", LineWeight.LineWeight020); } //------------------------------------------------------------------test for intersection List <Point3d> dblPntInts = Geom.getPntInts(dblPntBeg, dblPntEnd, varPnts3dBndry0zForInt, false, extend.none); //------------------------------------------------------------------test for intersection bool boolAddEnt = false; bool boolBegOnSeg = false; bool boolEndOnSeg = false; bool boolBegIn = false; bool boolEndIn = false; int intUBnd = 0; switch ((int)(dblPntInts[0].X)) { case -1: intUBnd = -1; boolBegOnSeg = (dblPntBeg.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true; boolEndOnSeg = (dblPntEnd.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true; break; case -9: intUBnd = -9; boolBegOnSeg = true; boolEndOnSeg = true; break; default: intUBnd = dblPntInts.Count; boolBegOnSeg = (dblPntBeg.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true; boolEndOnSeg = (dblPntEnd.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? false : true; break; } if (boolBegOnSeg == false) { boolBegIn = dblPntBeg.isInside(varPnts3dBndry0zForInt); } else { boolBegIn = true; } if (boolEndOnSeg == false) { boolEndIn = dblPntEnd.isInside(varPnts3dBndry0zForInt); } else { boolEndIn = true; } switch (intUBnd) { case -1: //Case -1 if (boolBegOnSeg & !boolEndIn) { boolAddEnt = false; } else if (boolEndOnSeg & !boolBegIn) { boolAddEnt = false; } else { boolAddEnt = true; intCase1 = intCase1 + 1; } break; case 1: //one intersection - one point inside and one outside //Case 2-1 if (boolBegOnSeg == true & boolEndOnSeg == true) { //both ends on the line //test midPoint to see if segment is inside or outside Point3d pnt3dMid = dblPntBeg.getMidPoint3d(dblPntEnd); //boolAddEnt = (pnt3dMid.isOn2dSegment(varPnts3dBndry0zForInt) == -1) ? true : false; boolAddEnt = pnt3dMid.isInside(varPnts3dBndry0zForInt); if (boolAddEnt) { intCase5_1 = intCase2_1 + 1; } //Case 2-2 } else if (boolBegOnSeg == true & boolEndIn == true) { boolAddEnt = true; intCase2_2 = intCase2_2 + 1; //Case 2-3 ??????????????????????????????????? } else if (boolBegOnSeg == true & boolEndIn == false) { if (dblPntInts[0].isOn2dSegment(varPnts3dBndry0zForInt) != -1) { dblPntEnd = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntEnd, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y); } dblPntEnd = dblPntEnd.addElevation(elev); boolAddEnt = true; } else { boolAddEnt = false; intCase2_3 = intCase2_3 + 1; } //Case 2-4 } else if (boolEndOnSeg == true & boolBegIn == true) { boolAddEnt = true; intCase2_4 = intCase2_4 + 1; //Case 2-5 } else if (boolEndOnSeg == true & boolBegIn == false) { if (dblPntInts[0].isOn2dSegment(varPnts3dBndry0zForInt) != -1) { dblPntBeg = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y); } dblPntBeg = dblPntBeg.addElevation(elev); boolAddEnt = true; } else { boolAddEnt = false; intCase2_5 = intCase2_5 + 1; } //Case 2-6 } else if (boolBegIn == true & boolEndIn == false) { dblPntEnd = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntEnd, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y); } dblPntEnd = dblPntEnd.addElevation(elev); boolAddEnt = true; intCase2_6 = intCase2_6 + 1; //Case 2-7 } else if (boolBegIn == false & boolEndIn == true) { dblPntBeg = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y); } dblPntBeg = dblPntBeg.addElevation(elev); boolAddEnt = true; intCase2_7 = intCase2_7 + 1; //Case2-8 } else if (boolBegIn == true & boolEndIn == true) { boolAddEnt = true; intCase2_8 = intCase2_8 + 1; } break; case 2: //Case 5-1 if (boolBegOnSeg == true & boolEndOnSeg == true) { //both ends on the line //test miPoint3d to see if segment is inside or outside Point3d pnt3dMid = dblPntBeg.getMidPoint3d(dblPntEnd); boolAddEnt = pnt3dMid.isInside(varPnts3dBndry0zForInt); if (boolAddEnt) { intCase5_1 = intCase5_1 + 1; } //Case 5-2 } else if (boolBegIn == false & boolEndIn == false) { dblPntBeg = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y); } dblPntBeg = dblPntBeg.addElevation(elev); dblPntEnd = dblPntInts[1]; elev = EW_Utility2.getElev(dblPntEnd, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y); } dblPntEnd = dblPntEnd.addElevation(elev); boolAddEnt = true; intCase5_2 = intCase5_2 + 1; //Case 5-3 } else if (boolBegOnSeg == true & boolEndIn == false) { dblPntBeg = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y); } dblPntBeg = dblPntBeg.addElevation(elev); dblPntEnd = dblPntInts[1]; elev = EW_Utility2.getElev(dblPntEnd, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y); } dblPntEnd = dblPntEnd.addElevation(elev); boolAddEnt = true; intCase5_3 = intCase5_3 + 1; //Case 5-4 } else if (boolEndOnSeg == true & boolBegIn == false) { dblPntBeg = dblPntInts[0]; double elev = EW_Utility2.getElev(dblPntBeg, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntBeg.X, dblPntBeg.Y); } dblPntBeg = dblPntBeg.addElevation(elev); dblPntEnd = dblPntInts[1]; elev = EW_Utility2.getElev(dblPntEnd, id3dBndry); if (elev == 0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntEnd.X, dblPntEnd.Y); } dblPntEnd = dblPntEnd.addElevation(elev); boolAddEnt = true; intCase5_4 = intCase5_4 + 1; //Case 5-5 } else if (boolBegIn == true & boolEndIn == true) { boolAddEnt = true; intCase5_5 = intCase5_5 + 1; } break; case 3: //Case 8 List <Point3d> dblPntInts_New = new List <Point3d>(); for (int s = dblPntInts.Count; s > 0; s--) { if (System.Math.Round(dblPntBeg.X, 3) == System.Math.Round(dblPntInts[s - 1].X, 3) && System.Math.Round(dblPntBeg.Y, 3) == System.Math.Round(dblPntInts[s - 1].Y, 3)) { dblPntInts.RemoveAt(s - 1); } } for (int s = dblPntInts.Count; s > 0; s--) { if (System.Math.Round(dblPntEnd.X, 3) == System.Math.Round(dblPntInts[s - 1].X, 3) && System.Math.Round(dblPntEnd.Y, 3) == System.Math.Round(dblPntInts[s - 1].Y, 3)) { dblPntInts.RemoveAt(s - 1); } } switch (dblPntInts.Count) { case 2: double dblDist1 = dblPntBeg.getDistance(dblPntInts[0]); double dblDist2 = dblPntBeg.getDistance(dblPntInts[1]); if (dblDist1 > dblDist2) { Point3d pnt3dTmp = dblPntInts[0]; dblPntInts[0] = dblPntInts[1]; dblPntInts[1] = pnt3dTmp; } Point3d dblPntMid = dblPntBeg + (dblPntInts[0] - dblPntBeg) / 2; if (dblPntMid.isInside(varPnts3dBndry0zForInt)) { Point3d dblPntInt = dblPntInts[0]; List <Point3d> dblPnts3dBrk = new List <Point3d>(); dblPnts3dBrk.Add(dblPntBeg); double elev = EW_Utility2.getElev(dblPntInt, id3dBndry); if (elev == 0.0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntInt.X, dblPntInt.Y); } dblPntInt.addElevation(elev); dblPnts3dBrk.Add(dblPntInt); ObjectId id3dBrkXNew = Draw.addPoly3d(dblPnts3dBrk, strSurfaceNameX + "-BRKLINE"); id3dBrkXNew.changeProp(LineWeight.ByLayer, Color.FromColorIndex(ColorMethod.ByAci, 0)); id3dBrkXNew.setXData(tvs, "makeBOT"); intCase5_1 = intCase5_1 + 1; id3dBrkX.delete(); } dblPntMid = dblPntInts[1] + (dblPntEnd - dblPntInts[1]) / 2; if (dblPntMid.isInside(varPnts3dBndry0zForInt)) { Point3d dblPntInt = dblPntInts[1]; List <Point3d> dblPnts3dBrk = new List <Point3d>(); double elev = EW_Utility2.getElev(dblPntInt, id3dBndry); if (elev == 0.0 && strSurfaceName == "SG") { elev = objSurfaceSG.FindElevationAtXY(dblPntInt.X, dblPntInt.Y); } dblPntInt.addElevation(elev); dblPnts3dBrk.Add(dblPntInt); dblPnts3dBrk.Add(dblPntEnd); ObjectId id3dBrkXNew = Draw.addPoly3d(dblPnts3dBrk, strSurfaceNameX + "-BRKLINE"); id3dBrkXNew.changeProp(LineWeight.ByLayer, Color.FromColorIndex(ColorMethod.ByAci, 0)); id3dBrkXNew.setXData(tvs, "makeBOT"); intCase8_5 = intCase8_5 + 1; id3dBrkX.delete(); } break; case 3: break; } break; case 4: //Case 11 intCase11 = intCase11 + 1; break; case -9: boolAddEnt = false; break; } if (boolAddEnt == true) { id3dBrkX.delete(); id3dBrkP = Draw.addPoly3d(dblPntBeg, dblPntEnd, strLayer); id3dBrkP.setXData(tvs, "makeBOT"); if (pub.boolDebug) { id3dBrkX.changeProp(LineWeight.LineWeight200, clr.byl); id3dBrkP = id3dBrkX; } } else { // obj3dBrkX.Delete } if (pub.boolDebug) { idTextB.delete(); idTextE.delete(); ss = EW_Utility1.buildSSet7(); ss.eraseSelectedItems(); } } //Debug.Print "Case -1 " & intCase1 //Debug.Print "Case 2-1 " & intCase2_1 //Debug.Print "Case 2-2 " & intCase2_2 //Debug.Print "Case 2-3 " & intCase2_3 //Debug.Print "Case 2-4 " & intCase2_4 //Debug.Print "Case 2-5 " & intCase2_5 //Debug.Print "Case 2-6 " & intCase2_6 //Debug.Print "Case 2-7 " & intCase2_7 //Debug.Print "Case 2-8 " & intCase2_8 //Debug.Print "Case 5-1 " & intCase5_1 //Debug.Print "Case 5-2 " & intCase5_2 //Debug.Print "Case 5-3 " & intCase5_3 //Debug.Print "Case 5-4 " & intCase5_4 //Debug.Print "Case 5-5 " & intCase5_5 //Debug.Print "Case 8-5 " & intCase8_5 //Debug.Print "Case 8-8 " & intCase8_8 //Debug.Print "Case 11 " & intCase11 //Debug.Print "Total=" & intCase1 + intCase2_1 + intCase2_2 + intCase2_3 + intCase2_4 + intCase2_5 + intCase2_6 + _ //' intCase2_7 + intCase2_8 + intCase5_1 + intCase5_2 + intCase5_3 + intCase5_4 + intCase5_5 + _ //' intCase8_5 + intCase8_8 + intCase11 return(true); }
public static void testBotElev(object[] varGridData, bool boolReTest) { bool boolProceed = false; bool isOX = false; bool isOXg = false; double dblPntXmin = (double)(varGridData[0]); double dblPntYmin = (double)(varGridData[1]); int intInterval = (int)varGridData[2]; Layer.manageLayers("BOT-POINTS"); TinSurface objSurfaceSG = Surf.getTinSurface("SG"); if (objSurfaceSG == null) { MessageBox.Show("Surface SG is missing. Exiting ......"); return; } TinSurface objSurfaceOX = Surf.getTinSurface("OX"); if (objSurfaceOX == null) { MessageBox.Show("Surface OX is missing. Exiting ......"); } TinSurface objSurfaceOXg = Surf.getTinSurface("OXg"); if (objSurfaceOXg != null) { isOXg = true; } EW_Utility1.getTableData(); TinSurface objSurfaceEXIST = null; if (p.REMOVE_REPLACE_BLDG_V == -1) { objSurfaceEXIST = Surf.getTinSurface("NATIVE"); if (objSurfaceEXIST == null) { MessageBox.Show("NATIVE surface missing while Remove and Replace values are 0. Exiting routine.........."); return; } } else { objSurfaceEXIST = Surf.getTinSurface("EXIST"); if (objSurfaceEXIST == null) { objSurfaceEXIST = Surf.getTinSurface("exist"); if (objSurfaceEXIST == null) { MessageBox.Show("Surface EXIST missing. Exiting routine......"); return; } } } SurfaceDefinitionBoundaries bndrys = objSurfaceEXIST.BoundariesDefinition; for (int i = 0; i < bndrys.Count; i++) { if (bndrys[i].BoundaryType == Autodesk.Civil.SurfaceBoundaryType.Hide) { MessageBox.Show("Surface EXIST is using HIDE Boundaries - exiting program"); return; } } try { SelectionSet objSSet = null; if (p.boolDebug) { objSSet = EW_Utility1.buildSSet2b("OX"); //GET "OX-BRKLINE* by select } else { if (isOX) { objSSet = EW_Utility1.buildSSet2a("OX"); //GET "OX-BRKLINE* } else { objSSet = EW_Utility1.buildSSet2a("SG"); //GET "SG-BRKLINE* } } //BEGIN BOUNDARY EDIT - ADD X GRID POINTS ObjectId[] ids = objSSet.GetObjectIds(); for (int i = 0; i < ids.Length; i++) { ObjectId id3dBndry_Org = ids[i]; if (p.boolDebug) { id3dBndry_Org.changeProp(LineWeight.LineWeight020, clr.c70); } ResultBuffer rb = id3dBndry_Org.getXData("makeBOT"); if (rb == null) { continue; } TypedValue[] tvs = rb.AsArray(); string strType = ""; try { strType = tvs[2].Value.ToString(); } catch (System.Exception) { strType = "K-BRACE"; } rb = id3dBndry_Org.getXData("OX"); if (rb == null) { continue; } tvs = rb.AsArray(); try { string strSource = tvs[1].Value.ToString(); switch (strSource) { case "OX1": strType = "OX1"; break; case "OX2": strType = "OX2"; break; case "OX3": strType = "OX3"; break; case "OX4": strType = "OX4"; break; } } catch (System.Exception) { } List <Point3d> varPnts3dBndry = id3dBndry_Org.getCoordinates3dList(); int k = varPnts3dBndry.Count; List <Point3d> dblPnts3dBndry = new List <Point3d>(); Point3d pnt3d = new Point3d(varPnts3dBndry[0].X, varPnts3dBndry[0].Y, 0.0); dblPnts3dBndry.Add(pnt3d); int intXCounter = 0, intYCounter = 0; for (int j = 1; j < k; j++) { Point3d pnt3dBeg = varPnts3dBndry[j - 1]; Point3d pnt3dEnd = varPnts3dBndry[j - 0]; double dblLEN = pnt3dBeg.getDistance(pnt3dEnd); if (dblLEN > 5) { double dblAngle = pnt3dBeg.getDirection(pnt3dEnd); int intXbeg = (int)((pnt3dBeg.X - dblPntXmin) / intInterval); int intXend = (int)((pnt3dEnd.X - dblPntXmin) / intInterval); if (intXend - intXbeg > 0) { intXCounter = 1; intXbeg++; boolProceed = true; } else if (intXend - intXbeg < 0) { intXCounter = -1; intXend++; boolProceed = true; } else if (intXend - intXbeg == 0) { intXCounter = -1; boolProceed = false; } if (boolProceed == true) { for (int n = intXbeg; n <= intXend; n += intXCounter) { double dblX = dblPntXmin + n * intInterval; double dblY = pnt3dBeg.Y + (dblX - pnt3dBeg.X) * System.Math.Tan(dblAngle); pnt3d = new Point3d(dblX, dblY, 0); if (p.boolDebug) { Draw.addCircle(pnt3d, 1, "DEBUG-0", (short)3); } dblPnts3dBndry.Add(pnt3d); } } pnt3d = new Point3d(pnt3dEnd.X, pnt3dEnd.Y, 0.0); dblPnts3dBndry.Add(pnt3d); if (p.boolDebug) { Draw.addCircle(pnt3d, 1, "DEBUG-0", (short)3); } } else { pnt3d = new Point3d(pnt3dEnd.X, pnt3dEnd.Y, 0.0); dblPnts3dBndry.Add(pnt3d); if (p.boolDebug) { Draw.addCircle(pnt3d, 1, "DEBUG-0", (short)2); } } } //END BOUNDARY EDIT - ADD X GRID POINTS varPnts3dBndry = dblPnts3dBndry; k = varPnts3dBndry.Count; //BEGIN BOUNDARY EDIT - ADD Y GRID POINTS dblPnts3dBndry = new List <Point3d>(); dblPnts3dBndry.Add(varPnts3dBndry[0]); //keep first point if (p.boolDebug) { Draw.addCircle(dblPnts3dBndry[0], 1, "DEBUG-0", (short)1); } for (int x = 0; x < k; x++) { Point3d pnt3dBeg = varPnts3dBndry[x - 1]; Point3d pnt3dEnd = varPnts3dBndry[x - 0]; double dblLEN = pnt3dBeg.getDistance(pnt3dEnd); if (dblLEN > 5) { double dblAngle = pnt3dBeg.getDirection(pnt3dEnd); int intYbeg = (int)((pnt3dBeg.Y - dblPntYmin) / intInterval); int intYend = (int)((pnt3dEnd.Y - dblPntYmin) / intInterval); if (intYend - intYbeg > 0) { intYCounter = (short)1; intYbeg++; boolProceed = true; } else if (intYend - intYbeg < 0) { intYCounter = (short)(-1); intYend++; boolProceed = true; } else if (intYend - intYbeg == ((short)0)) { intYCounter = (short)(-1); boolProceed = false; } if (boolProceed == true) { for (k = intYbeg; k <= intYend; k += intYCounter) { double dblY = dblPntYmin + k * intInterval; double dblX = pnt3dBeg.X + (dblY - pnt3dBeg.Y) / System.Math.Tan(dblAngle); pnt3d = new Point3d(dblX, dblY, 0.0); if (p.boolDebug) { Draw.addCircle(pnt3d, 1, "DEBUG-0", (short)2); } dblPnts3dBndry.Add(pnt3d); } } dblPnts3dBndry.Add(pnt3dEnd); if (p.boolDebug) { Draw.addCircle(pnt3dEnd, 1, "DEBUG-0", (short)3); } } else { dblPnts3dBndry.Add(pnt3dEnd); if (p.boolDebug) { Draw.addCircle(pnt3dEnd, 1, "DEBUG-0", (short)2); } } } //END BOUNDARY EDIT - ADD Y GRID POINTS //BEGIN REMOVE DUPLICATE POINTS List <Point3d> dblPnts3dBndryRev = new List <Point3d>(); dblPnts3dBndryRev.Add(dblPnts3dBndry[0]); for (int j = 1; j < dblPnts3dBndry.Count; j++) { if (System.Math.Round(dblPnts3dBndry[j - 1].X, 3) == System.Math.Round(dblPnts3dBndry[j - 0].X, 3) && System.Math.Round(dblPnts3dBndry[j - 1].Y, 3) == System.Math.Round(dblPnts3dBndry[j - 0].Y, 3)) { //do nothing } else { dblPnts3dBndryRev.Add(dblPnts3dBndry[j]); } } //END REMOVE DUPLICATE POINTS //BEGIN TEST ELEVATION ON BOUNDARY k = dblPnts3dBndryRev.Count; if (k > 3) { for (int j = 0; j < k; j++) { pnt3d = dblPnts3dBndryRev[j]; double dblZ_EXIST = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceEXIST); double dblZ_R_R = 0; if (isOX) { dblZ_R_R = dblZ_EXIST - p.REMOVE_REPLACE_BLDG_V; } else { dblZ_R_R = dblZ_EXIST - p.REMOVE_REPLACE_V; } double dblZ_SG = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceSG); double dblZ_OX = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceOX); double dblZ_OXg = 0; if (isOXg) { dblZ_OXg = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceOXg); } double dblZ_MIN = dblZ_R_R; if (dblZ_SG < dblZ_MIN) { dblZ_MIN = dblZ_SG; } if (dblZ_OX < dblZ_MIN) { dblZ_MIN = dblZ_OX; } if (isOXg) { if (dblZ_OXg < dblZ_MIN) { dblZ_MIN = dblZ_OXg; } } if (dblZ_MIN <= 0) { Draw.addCircle(pnt3d, 1, "DEBUG-0", (short)1); pnt3d = pnt3d.addElevation(dblZ_R_R); dblPnts3dBndryRev.Add(pnt3d); } else { pnt3d = pnt3d.addElevation(dblZ_MIN); dblPnts3dBndryRev.Add(pnt3d); } } ObjectId id3dBndry = Draw.addPoly3d(dblPnts3dBndryRev); if (strType == "LIM" || strType == "K-BRACE") { id3dBndry.changeProp(clr.byl, "BOT-BRKLINE-AREA"); } else if (strType == "BRKLINES") { id3dBndry.changeProp(clr.byl, "BOT-BRKLINE"); } } //END TEST ELEVATION ON BOUNDARY //BEGIN TEST ELEVATION ON GRID POINTS List <string> excludes = new List <string>() { "BRKLINES", "OX2", "OX3", "OX4" }; if (excludes.Contains(strType)) { continue; } else { k = dblPnts3dBndryRev.Count; dblPnts3dBndryRev.RemoveAt(k - 1); Point3dCollection varPnts3dBndryCol = new Point3dCollection(); foreach (Point3d pnt in dblPnts3dBndryRev) { pnt.addElevation(0.0); varPnts3dBndryCol.Add(pnt); } varPnts3dBndry = dblPnts3dBndryRev; SelectionSet objSSetX = EW_Utility1.buildSSet11(varPnts3dBndryCol); //select points by polygon crossing ids = objSSetX.GetObjectIds(); if (strType == "_XX-BUILDING ADJACENT LANDSCAPING") { //do nothing i.e. do not assign point description "BOT" } else { for (int j = 0; j < ids.Length; j++) { pnt3d = ids[j].getCogoPntCoordinates(); if (pnt3d.isInside(dblPnts3dBndryRev)) { double dblZ_EXIST = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceEXIST); double dblZ_R_R = 0; if (isOX) { dblZ_R_R = dblZ_EXIST - p.REMOVE_REPLACE_BLDG_V; } else { dblZ_R_R = dblZ_EXIST - p.REMOVE_REPLACE_V; } double dblZ_SG = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceSG); double dblZ_OX = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceOX); double dblZ_OXg = 0; if (isOXg) { dblZ_OXg = EW_Utility2.getSurfaceElev(pnt3d.X, pnt3d.Y, objSurfaceOXg); } if (dblZ_OX < 0) { dblZ_OX = dblZ_SG; } double dblZ_MIN = dblZ_R_R; if (dblZ_SG < dblZ_MIN) { dblZ_MIN = dblZ_SG; } if (dblZ_OX < dblZ_MIN) { dblZ_MIN = dblZ_OX; } if (isOXg) { if (dblZ_OXg < dblZ_MIN) { dblZ_MIN = dblZ_OXg; } } using (var tr = BaseObjs.startTransactionDb()) { CogoPoint cgPnt = (CogoPoint)tr.GetObject(ids[j], OpenMode.ForRead); cgPnt.Elevation = dblZ_MIN; cgPnt.RawDescription = "BOT"; cgPnt.Layer = "BOT-POINTS"; cgPnt.StyleId = CgPnts.getPntStyle("BOT").ObjectId; cgPnt.LabelStyleId = CgPnts.getPntLabelStyle("BOT"); } } } } } //END TEST ELEVATION ON GRID POINTS+`````````` } if (boolReTest == false) { EW_Main.viewResults("BOT", false); } } catch { } return; }