.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Annotative scales

1 REPLY 1
Reply
Message 1 of 2
sjhoughton
385 Views, 1 Reply

Annotative scales

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

 

1 REPLY 1
Message 2 of 2
SENL1362
in reply to: sjhoughton

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);
            }

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost