Ejemplo n.º 1
0
        buildArea3dLimit(ObjectId idPoly, string nameSurface, string nameSurfaceX, string nameLayer = "")
        {
            //3d Boundary
            bool exists;

            idPoly.checkIfClosed();

            List <Point3d> pnts3dPoly = idPoly.getCoordinates3dList();

            string strLayName = idPoly.getLayer();

            List <Point3d> pnts3dBNDY = new List <Point3d>();

            Color color = new Color();

            color = Color.FromColorIndex(ColorMethod.ByBlock, 5);

            //each polyline segment
            TinSurface tinSurf = Surf.getTinSurface(nameSurface, out exists);

            for (int j = 1; j < pnts3dPoly.Count; j++)
            {
                Point3d pnt3dBEG = pnts3dPoly[j - 1];
                Point3d pnt3dEND = pnts3dPoly[j];

                ObjectId idLine = Draw.addLine(pnt3dBEG, pnt3dEND);

                Point3dCollection pnts3d = tinSurf.SampleElevations(idLine);

                if (pnts3d.Count > 0)
                {
                    for (int k = 0; k < pnts3d.Count; k++)
                    {
                        if (pnts3d[k].Z > 0)
                        {
                            pnts3dBNDY.Add(pnts3d[k]);
                        }
                        else
                        {
                            string mess = string.Format("Area Limit outside surface at X={0}, Y={1}\n EXITING PROGRAM", pnts3d[k].X, pnts3d[k].Z);
                            Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(mess);
                        }
                    }

                    idLine.delete();
                }
                else
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("intUBnd not > 0 at: " + j + " -See Blue lines where boundary is outside surface limit");
                    idLine.changeProp(color, "DEBUG-0", LineWeight.LineWeight211);
                }
            }

            ObjectId id3dPline = pnts3dBNDY.addPoly3d();

            id3dPline.changeProp(color, nameSurfaceX + "-BRKLINE-AREA");

            TypedValue[] tvs = new TypedValue[3] {
                new TypedValue(1001, "makeBOT"),
                new TypedValue(1000, nameLayer),
                new TypedValue(1000, "LIM")
            };

            id3dPline.setXData(tvs, "makeBOT");

            return(id3dPline);
        }