I was wondering if there was a better way of doing this then using the ' HasContext ' method on each entity per each scale. I tried to step through the extension dictionary, but can't seem to figure out the final step with .Net. I can get there with lisp, to see the scales, but not with .Net. Here is the section of code I'm talking about. The objects that are returned in the spot marked are ' ACDBBLOCKREFOBJECTCONTEXTDATACLASS ' and I can see no way to use them, and they reference the annotation scale, so I need to get some information from them.
I can't cast them to an AnnotationScale or ObjectContext, as they are not from the DBObject class.
foreach ( ObjectId id in btr ) {
Entity Ent = Trans.GetObject( id, OpenMode.ForRead ) as Entity;
if ( Ent.Annotative == AnnotativeStates.False ) continue;
List<AnnotationScale> tempScList = new List<AnnotationScale>();
//foreach ( AnnotationScale asc in ScList ) {
// if ( Ent.HasContext( asc ) ) tempScList.Add( asc );
//}
ObjectId ExId = Ent.ExtensionDictionary;
if ( ExId.IsNull ) continue;
DBDictionary ExDict = Trans.GetObject( ExId, OpenMode.ForRead ) as DBDictionary;
if ( !ExDict.Contains( "AcDbContextDataManager" ) ) continue;
DBDictionary CdmDict = Trans.GetObject( ExDict.GetAt( "AcDbContextDataManager" ), OpenMode.ForRead ) as DBDictionary;
if ( !CdmDict.Contains( "ACDB_ANNOTATIONSCALES" ) ) continue;
DBDictionary AnsDict = Trans.GetObject( CdmDict.GetAt( "ACDB_ANNOTATIONSCALES" ), OpenMode.ForRead ) as DBDictionary;
foreach ( DBDictionaryEntry de in AnsDict ) {
// this is the problem area
}
foreach ( AnnotationScale asc in tempScList ) ScList.Remove( asc );
}