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);
        }
Exemple #3
0
 public CivilTinSurface(string surfaceName, string surfaceStyleName)
 {
     using (Transaction tr = CivilApplicationManager.StartTransaction())
     {
         m_TheSurfaceId = C3DLandDb.TinSurface.Create(CivilApplicationManager.WorkingDatabase, surfaceName);
         C3DLandDb.TinSurface surface = m_TheSurfaceId.GetObject(OpenMode.ForWrite) as C3DLandDb.TinSurface;
         surface.Layer = surfaceStyleName;
         ObjectId styleId = SurfaceStyleManager.GetStyleId(surfaceStyleName);
         if (styleId == ObjectId.Null)
         {
             throw new CreateSurfaceException("Unable to create Surface object.");
         }
         surface.StyleId = styleId;
         tr.Commit();
     }
 }
Exemple #4
0
 public void AddPointCloudObjects()
 {
     using (Transaction tr = CivilApplicationManager.StartTransaction())
     {
         string surfaceName           = "";
         var    m_TheSurfaceId        = C3DLandDb.TinSurface.Create(CivilApplicationManager.WorkingDatabase, surfaceName);
         C3DLandDb.TinSurface surface = m_TheSurfaceId.GetObject(OpenMode.ForRead) as C3DLandDb.TinSurface;
         string   surfaceStyleName    = "";
         ObjectId styleId             = SurfaceStyleManager.GetStyleId(surfaceStyleName);
         if (styleId == ObjectId.Null)
         {
             throw new CreateSurfaceException("Unable to create Surface object.");
         }
         surface.StyleId = styleId;
         tr.Commit();
     }
 }