FeatureSource using ReadDwgFile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Our busines case is to get a list of all .SHP file references within a .DWG file and report on these, as we are looking at moving where the DWG files and .SHP files are located.
we are having some issues getting the information out if the DWG is open via Datadase.ReadDwgFile, if we open the DWG via the interface the below code works fine, interesting though if we open the DWG via the interface and then also run this command, then it works as well! , any suggestion on who to get the FeatureSource information without opening the DWG via the interface
[CommandMethod("getFeatureSource")]
publicvoid xx()
{
string dbPath = @"C:\anydwgwithShapeFile.dwg";
Database db = newDatabase(false, true);
db.ReadDwgFile(dbPath,
FileOpenMode.OpenForReadAndAllShare, true, "");
MgResourceService rs = AcMapServiceFactory.GetService(MgServiceType.ResourceService) asAcMapResourceService;
MgResourceIdentifier ri = newMgResourceIdentifier(@"Library://");
MgByteReader reader = rs.EnumerateResources(ri, -1, MgResourceType.LayerDefinition);
MgByteReader reader2 = rs.EnumerateResources(ri, -1, MgResourceType.FeatureSource);
MessageBox.Show(reader.ToString());
MessageBox.Show(reader2.ToString());
db.Dispose();
}
Cheers
Warrick