Annotative scales

Annotative scales

Anonymous
Not applicable
578 Views
1 Reply
Message 1 of 2

Annotative scales

Anonymous
Not applicable

I am trying to extract all of the annotative scales in a drawing, I have found some code which will extract the current annotative scale, but not all.

 

Dim doc AsDocument = Application.DocumentManager.MdiActiveDocument

 

Dim db AsDatabase = doc.Database

 

Dim ed AsEditor = doc.Editor

 

Dim ocm AsObjectContextManager = db.ObjectContextManager

 

Dim occ As ObjectContextCollection = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES")

 

Thanks inadvanced

 

Steven Houghton

 

0 Likes
579 Views
1 Reply
Reply (1)
Message 2 of 2

SENL1362
Advisor
Advisor

The code in c# gives me all the Annotative scales defined, and is equal to the number of scales in the "Acad_Scalelist".

Unfortunately i could not found a way to decode the result from Acad_Scalelist.

                foreach (DBDictionaryEntry sle in scaleListDict)
                {
                    ed.WriteMessage("\n\t{0}={1}", sle.Key, sle.Value);
                    var x = tr.GetObject(sle.Value, OpenMode.ForRead);
                     // Cannot cast from ImpDbObject to AcDbScale or AnnotationScale

 

            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db = doc.Database;
            Editor ed = doc.Editor;

            ed.WriteMessage("\nCurrent AnnotationScale: Name={0}, PaperUnits={1}, DrawingUnits={2}", db.Cannoscale.Name, db.Cannoscale.PaperUnits, db.Cannoscale.DrawingUnits);
            ObjectContextManager ocm = db.ObjectContextManager;
            ObjectContextCollection occ = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES");
            foreach (AnnotationScale asc in occ)
            {
                ed.WriteMessage("\nAnnScale: Name={0}, PaperUnits={1}, DrawingUnits={2}, Scale={3}", asc.Name, asc.PaperUnits, asc.DrawingUnits, asc.Scale);
            }

 

 

0 Likes