public static List <BaseC3dObject> GetLayers() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; CivilDocument civilDoc = CivilApplication.ActiveDocument; List <BaseC3dObject> layers = new List <BaseC3dObject>(); using (Transaction ts = db.TransactionManager.StartTransaction()) { try { LayerTable lyrTable = ts.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable; foreach (ObjectId item in lyrTable) { LayerTableRecord lyrTabRec = item.GetObject(OpenMode.ForRead) as LayerTableRecord; BaseC3dObject bObject = new BaseC3dObject(); bObject.Id = lyrTabRec.ObjectId; bObject.Name = lyrTabRec.Name; layers.Add(bObject); } ts.Commit(); } catch (System.Exception) { ts.Abort(); throw; } } return(layers); }
public static BaseC3dObject CreateAlignment( string alName, string layerName, string stil, string labelSet, string desc) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; CivilDocument civilDoc = CivilApplication.ActiveDocument; ObjectId al = Alignment.Create(civilDoc, alName, null, layerName, stil, labelSet); BaseC3dObject alObject = new BaseC3dObject(); using (Transaction ts = db.TransactionManager.StartTransaction()) { try { Alignment alignment = al.GetObject(OpenMode.ForWrite) as Alignment; alignment.Layer = layerName; alignment.Description = desc; alObject.Name = alignment.Name; alObject.Id = alignment.ObjectId; ts.Commit(); } catch (System.Exception) { throw; } } return(alObject); }
public static List <BaseC3dObject> GetSites() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; CivilDocument civilDoc = CivilApplication.ActiveDocument; ObjectIdCollection sitesID = civilDoc.GetSiteIds(); List <BaseC3dObject> sites = new List <BaseC3dObject>(); if (sitesID.Count == 0) { return(null); } else { using (Transaction ts = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId item in sitesID) { Site site = item.GetObject(OpenMode.ForRead) as Site; BaseC3dObject bObject = new BaseC3dObject(); bObject.Name = site.Name; bObject.Id = site.ObjectId; sites.Add(bObject); } } catch (System.Exception) { throw; } } return(sites); } }
public List <BaseC3dObject> GetAlignmentIds() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; CivilDocument civilDoc = CivilApplication.ActiveDocument; ObjectIdCollection alignIds = civilDoc.GetAlignmentIds(); List <BaseC3dObject> alignList = new List <BaseC3dObject>(); if (alignIds.Count == 0) { return(null); } else { using (Transaction ts = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId id in alignIds) { Alignment align = ts.GetObject(id, OpenMode.ForRead) as Alignment; BaseC3dObject bObject = new BaseC3dObject(); bObject.Id = align.ObjectId; bObject.Name = align.Name; alignList.Add(bObject); } } catch (System.Exception) { throw; } } return(alignList); } }
public static List <BaseC3dObject> GetAlignmentLabelSets() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; CivilDocument civilDoc = CivilApplication.ActiveDocument; Autodesk.Civil.DatabaseServices.Styles.AlignmentLabelSetStyleCollection aliLabelSetIds = civilDoc.Styles.LabelSetStyles.AlignmentLabelSetStyles; List <BaseC3dObject> aliLabelSetList = new List <BaseC3dObject>(); if (aliLabelSetIds.Count == 0) { return(null); } else { using (Transaction ts = db.TransactionManager.StartTransaction()) { try { foreach (ObjectId id in aliLabelSetIds) { Autodesk.Civil.DatabaseServices.Styles.AlignmentLabelSetStyle aliLabelSet = id.GetObject(OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Styles.AlignmentLabelSetStyle; BaseC3dObject bObject = new BaseC3dObject(); bObject.Name = aliLabelSet.Name; bObject.Id = aliLabelSet.ObjectId; aliLabelSetList.Add(bObject); } } catch (System.Exception) { throw; } } return(aliLabelSetList); } }
public List <BaseC3dObject> GetObjects(string question) { Ed.WriteMessage(question); //Objeleri Seçmece ve Listeye Atmaca PromptSelectionOptions opt = new PromptSelectionOptions(); PromptSelectionResult res = Ed.GetSelection(opt); SelectionSet SS = res.Value; List <BaseC3dObject> oList = new List <BaseC3dObject>(); ////////////////////////////////////////----OBJE SEÇMECE ----- /////////////////////////////// // seçilmiş objeleri BASEC3D objesine çevir if (res.Status == PromptStatus.OK) { foreach (SelectedObject item in SS) { BaseC3dObject bobject = new BaseC3dObject(); bobject.Id = item.ObjectId; bobject.Name = item.ObjectId.ObjectClass.DxfName; oList.Add(bobject); } } return(oList); }