Exemple #1
0
        public CivilTinSurface CreateSelectedSurface(Autodesk.AutoCAD.DatabaseServices.ObjectId oid)
        {
            try
            {
                ACADLogging.LogMyExceptions("Start CreateSelectedSurface Method");
                string surfaceName      = GetPolyLayerFromOid((oid));
                string surfaceStyleName = GetPolyLayerFromOid((oid)); //layer and style name are the same name.
                // m_polylinesurfaces = new Dictionary<ObjectId, string>();

                int i = 0;
                //string tempSurface = "s-" + surfaceName.ToLower();
                string tempSurface = surfaceName.ToUpper();
                while (CivilTinSurface.FindCivilTinSurfaceByName(tempSurface, ""))
                {
                    tempSurface = string.Format("{0}-{1}", surfaceName, i++);
                }
                surfaceName = tempSurface;
                if (!SurfaceStyleManager.Exists(surfaceStyleName))
                {
                    string msg = String.Format("\nSurface Style '{0}' doesn't exist. Creating it with default values.",
                                               surfaceStyleName);
                    //EditorUtils.Write(msg);
                    SurfaceStyleManager.CreateDefault(surfaceStyleName);
                }
                CivilTinSurface surface = new CivilTinSurface(surfaceName, surfaceStyleName);
                m_polylinesurfaces.Add(CivilTinSurface.FindCivilTinSurfaceByName(surface.Name), surfaceName);
                m_polylinesonly.Add(oid, surfaceName);
                return(surface);
            }
            catch (System.Exception ex)
            {
                ACADLogging.LogMyExceptions("CreateSelectedSurface" + ex.Message);
            }
            return(null);
        }
Exemple #2
0
        public bool CreateOverallSurface()
        {
            string surfaceName = EditorUtils.PromptForString("\nEnter surface name: ");

            if (String.IsNullOrEmpty(surfaceName))
            {
                surfaceName = "OVERALLSURFACE";
            }
            // if (surfaceName == String.Empty) EditorUtils.Write("\nERROR: Invalid name for surface.");


            string surfaceStyleName = EditorUtils.PromptForString("\nEnter surface style name: ");

            // if (surfaceStyleName == String.Empty) EditorUtils.Write("\nERROR: Invalid style name for surface style.");


            if (!SurfaceStyleManager.Exists(surfaceStyleName))
            {
                string msg = String.Format("\nSurface Style '{0}' doesn't exist. Creating it with default values.",
                                           surfaceStyleName);
                //  EditorUtils.Write(msg);
                SurfaceStyleManager.CreateDefault(surfaceStyleName);
            }
            CivilTinSurface surface = new CivilTinSurface(surfaceName, surfaceStyleName);

            surface.AddPoints(SurfaceDataProvider.GenerateRandomPoints(100, 100, 100, 10));
            return(true);
        }