Hi all again,
Can I access the units of the CANNOSCALE scale rather than the string value?
Each new scale needs a Paper Scale and Drawing Units input values and I'd like to be able to adjust a block insert based on this ratio. TBH I don't understand why paper scale isn't always 1 but probably irelevant.
Here is a code snippet to obtain the paperunits and drawingunits corresponding to the scale :
<code>
Database db = HostApplicationServices.WorkingDatabase;
try
{
ObjectContextManager contextManager = db.ObjectContextManager;
if (contextManager != null)
{
ObjectContextCollection contextCollection =
contextManager.GetContextCollection("ACDB_ANNOTATIONSCALES");
if (contextCollection != null)
{
foreach (ObjectContext oc in contextCollection)
{
AnnotationScale annoscale = oc as AnnotationScale;
if(annoscale != null)
{
// annoscale.Name;
// annoscale.PaperUnits;
// annoscale.DrawingUnits;
}
}
}
}
}
catch (System.Exception ex)
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage(ex.ToString());
}
</code>
Also, the paper units need not be always 1. This is because, 1 drawing unit may be represented by X paper units. It is sometimes simpler to use x:1 rather than 1:(1/X).
Thank Balaji !
I changed this line to check the current scale.
if (annoscale != null & annoscale.Name == db.Cannoscale.Name) {