Exemple #1
0
 updatePntGroups()
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 foreach (ObjectId id in _pointGroups)
                 {
                     PointGroup pg = (PointGroup)tr.GetObject(id, OpenMode.ForWrite);
                     pg.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 367", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 374", ex.Message));
     }
 }
Exemple #2
0
 addPntRawDescToGroup(string namePnt, string nameGroup)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 if (_pointGroups.Contains(nameGroup))
                 {
                     ObjectId   grpId              = _pointGroups[nameGroup];
                     PointGroup pntGrp             = (PointGroup)tr.GetObject(grpId, OpenMode.ForWrite);
                     StandardPointGroupQuery query = new StandardPointGroupQuery();
                     query.IncludeRawDescriptions = string.Format("{0}*", nameGroup);
                     pntGrp.SetQuery(query);
                     pntGrp.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 243", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 250", ex.Message));
     }
 }
Exemple #3
0
 updatePntGroup(string strGroupName)
 {
     try
     {
         using (Transaction tr = BaseObjs.startTransactionDoc())
         {
             try
             {
                 if (_pointGroups.Contains(strGroupName))
                 {
                     ObjectId   grpId  = _pointGroups[strGroupName];
                     PointGroup pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForWrite);
                     pntGrp.Update();
                 }
             }
             catch (System.Exception ex)
             {
                 BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 339", ex.Message));
             }
             tr.Commit();
         }
     }
     catch (System.Exception ex)
     {
         BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 346", ex.Message));
     }
 }
Exemple #4
0
        getSurface(string strName, out bool exists)
        {
            ObjectId idSurface = ObjectId.Null;

            exists = false;
            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection surfaceIDs = BaseObjs._civDoc.GetSurfaceIds();

                    foreach (ObjectId surfaceID in surfaceIDs)
                    {
                        var objSurface = (Autodesk.Civil.DatabaseServices.Surface)surfaceID.GetObject(OpenMode.ForRead);
                        if (objSurface.Name == strName)
                        {
                            idSurface = surfaceID;
                            exists    = true;
                            tr.Commit();
                            break;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 63", ex.Message));
            }
            return(idSurface);
        }
Exemple #5
0
        getTinVolumeSurface(string nameSurf)
        {
            TinVolumeSurface objSurface = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection idsSurface = BaseObjs._civDoc.GetSurfaceIds();

                    foreach (ObjectId idSurface in idsSurface)
                    {
                        Autodesk.Civil.DatabaseServices.Surface surf = (Autodesk.Civil.DatabaseServices.Surface)tr.GetObject(idSurface, OpenMode.ForRead);
                        if (surf is TinVolumeSurface)
                        {
                            Autodesk.Civil.DatabaseServices.TinVolumeSurface objTinSurface = (TinVolumeSurface)surf;
                            if (objTinSurface.Name == nameSurf)
                            {
                                objSurface = objTinSurface;
                            }
                        }
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 189", ex.Message));
            }
            return(objSurface);
        }
Exemple #6
0
        getTinSurface(string nameSurf)
        {
            TinSurface objSurface = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection surfaceIDs = BaseObjs._civDoc.GetSurfaceIds();

                    foreach (ObjectId surfaceID in surfaceIDs)
                    {
                        Autodesk.Civil.DatabaseServices.TinSurface objTinSurface = (TinSurface)surfaceID.GetObject(OpenMode.ForRead);
                        if (objTinSurface.Name == nameSurf)
                        {
                            objSurface = objTinSurface;
                            break;
                        }
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 143", ex.Message));
            }
            return(objSurface);
        }
Exemple #7
0
        getTinSurface(string nameSurf, out bool exists)
        {
            TinSurface objSurface = null;
            ObjectId   idStyle    = ObjectId.Null;

            exists = false;
            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection surfaceIDs = BaseObjs._civDoc.GetSurfaceIds();

                    foreach (ObjectId surfaceID in surfaceIDs)
                    {
                        Autodesk.Civil.DatabaseServices.TinSurface objTinSurface = (TinSurface)surfaceID.GetObject(OpenMode.ForRead);
                        if (objTinSurface.Name == nameSurf)
                        {
                            objSurface = objTinSurface;
                            exists     = true;
                            tr.Commit();
                            return(objSurface);
                        }
                    }
                    foreach (ObjectId idSty in BaseObjs._civDoc.Styles.SurfaceStyles)
                    {
                        SurfaceStyle style = (SurfaceStyle)tr.GetObject(idSty, OpenMode.ForRead);
                        if (style.Name == nameSurf)
                        {
                            idStyle = idSty;
                            break;
                        }
                    }
                    if (idStyle == ObjectId.Null)
                    {
                        idStyle = BaseObjs._civDoc.Styles.SurfaceStyles[0];
                    }
                    ObjectId idSurf = TinSurface.Create(nameSurf, idStyle);
                    objSurface = (TinSurface)tr.GetObject(idSurf, OpenMode.ForWrite);
                    Layer.manageLayers(string.Format("{0}_SURFACE", nameSurf));
                    objSurface.Layer = string.Format("{0}_SURFACE", nameSurf);
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 143", ex.Message));
            }
            return(objSurface);
        }
Exemple #8
0
        addPntGroup(string nameGroup, out bool exists)
        {
            exists = false;
            PointGroup pntGrp = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    try
                    {
                        if (_pointGroups.Contains(nameGroup))
                        {
                            ObjectId grpId = _pointGroups[nameGroup];
                            pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                            exists = true;
                        }
                        else
                        {
                            exists = false;
                            ObjectId grpId = _pointGroups.Add(nameGroup);
                            pntGrp = (PointGroup)tr.GetObject(grpId, OpenMode.ForRead);
                        }
                        StandardPointGroupQuery query = new StandardPointGroupQuery();
                        query.IncludeRawDescriptions = string.Format("{0}*", nameGroup);
                        pntGrp.SetQuery(query);
                        pntGrp.Update();
                    }
                    catch (System.Exception ex)
                    {
                        BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 210", ex.Message));
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Pnt_Group.cs: line: 217", ex.Message));
            }
            return(pntGrp);
        }
Exemple #9
0
        removeProfileLabelGroup(ObjectId pViewID, ObjectId profileID)
        {
            ObjectIdCollection ids = ProfileLabelGroup.GetAvailableLabelGroupIds(RXClass.GetClass(typeof(ProfileLabelGroup)), pViewID, profileID, false);

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    foreach (ObjectId id in ids)
                    {
                        ProfileLabelGroup group = (ProfileLabelGroup)tr.GetObject(id, OpenMode.ForWrite);
                        group.Erase();
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 318", ex.Message));
            }
        }
Exemple #10
0
        RBA()
        {
            Surface surface = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection ids = BaseObjs._civDoc.GetSurfaceIds();
                    if (ids.Count == 0)
                    {
                        return;
                    }
                    foreach (ObjectId id in ids)
                    {
                        try
                        {
                            surface = (Surface)tr.GetObject(id, OpenMode.ForRead);
                            if (surface is TinSurface)
                            {
                                TinSurface tinSurface = (TinSurface)surface;
                                tinSurface.UpgradeOpen();
                                tinSurface.Rebuild();
                                tinSurface.DowngradeOpen();
                            }
                        }
                        catch (System.Exception ex)
                        {
                            BaseObjs.writeDebug(ex.Message + " cmdRB.cs: line: 71");
                        }
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(ex.Message + " cmdRB.cs: line: 79");
            }
        }
Exemple #11
0
        getSurfaces()
        {
            List <string> surfaces = new List <string>();
            TinSurface    surface  = null;

            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection ids = BaseObjs._civDoc.GetSurfaceIds();
                    if (ids == null || ids.Count == 0)
                    {
                        return(null);
                    }
                    foreach (ObjectId id in ids)
                    {
                        try
                        {
                            Entity ent = (Entity)tr.GetObject(id, OpenMode.ForRead);
                            if (ent is TinSurface)
                            {
                                surface = (TinSurface)ent;
                                surfaces.Add(surface.Name);
                            }
                        }
                        catch (System.Exception ex)
                        {
                            BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 90", ex.Message));
                        }
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 97", ex.Message));
            }
            return(surfaces);
        }
Exemple #12
0
        addTinSurface(string nameSurf, out bool exists)
        {
            TinSurface surfTin = null;
            Surface    surf    = null;

            exists = false;
            try
            {
                using (Transaction tr = BaseObjs.startTransactionDoc())
                {
                    ObjectIdCollection ids = BaseObjs._civDoc.GetSurfaceIds();
                    foreach (ObjectId id in ids)
                    {
                        surf = (Surface)tr.GetObject(id, OpenMode.ForRead);
                        if (surf is TinSurface)
                        {
                            surfTin = (TinSurface)surf;
                            if (surfTin.Name == nameSurf)
                            {
                                exists = true;
                                break;
                            }
                        }
                    }
                    if (!exists)
                    {
                        ObjectId idSurf = TinSurface.Create(BaseObjs._db, nameSurf);
                        surfTin       = (TinSurface)tr.GetObject(idSurf, OpenMode.ForWrite);
                        surfTin.Layer = string.Format("{0}-SURFACE", nameSurf);
                    }
                    tr.Commit();
                }
            }
            catch (System.Exception ex)
            {
                BaseObjs.writeDebug(string.Format("{0} Surf.cs: line: 32", ex.Message));
            }
            return(surfTin);
        }