Message 1 of 3
Find All Data Shortcuts with a .NET API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is it possible to find all Data Shortcuts in the document?
I would like to get a list of all Data Shortcuts that includes Alignments, Surfaces, Pipe Networks, Pressure Networks and Corridors.
I know I can go group by group and traverse all entities in a group to find out which are references, like the below example for Surfaces.
Editor _ed = Application.DocumentManager.MdiActiveDocument.Editor;
CivilDocument _civilDoc = CivilApplication.ActiveDocument;
Database _db = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Database;
var surfaceIds = _civilDoc.GetSurfaceIds();
using (var tr = _db.TransactionManager.StartTransaction())
{
foreach (ObjectId surfaceId in surfaceIds)
{
var surf = tr.GetObject(surfaceId, OpenMode.ForRead) as Entity;
if (surf.IsReferenceObject)
{
var dsInfo = surf.GetReferenceInfo();
_ed.WriteMessage("IsSourceDrawingExistent: " + dsInfo.IsSourceDrawingExistent + "\n");
_ed.WriteMessage("SourceDrawing: " + dsInfo.SourceDrawing + "\n");
_ed.WriteMessage("HandleHigh: " + dsInfo.HandleHigh + "\n");
_ed.WriteMessage("HandleLow: " + dsInfo.HandleLow + "\n");
_ed.WriteMessage("Type: " + dsInfo.Type + "\n");
}
}
tr.Commit();
}
But this does not feel very efficient.
Is there a better way?