David,
For Automation, here are 2 ways to make Ruler and similar objects get drawn in a specific unit, such as Centimeter:
1. Right after calling _automationManager.CreateDefaultObjects(), call the following code:
foreach(AnnAutomationObject autObj in _automationManager.Objects)
{
if(autObj.Object is AnnPolyRulerObject)
{
AnnPolyRulerObject PolyRulerObj = autObj.Object as AnnPolyRulerObject;
PolyRulerObj.MeasurementUnit = AnnUnit.Centimeter;
}
if(autObj.Object is AnnRulerObject)
{
AnnRulerObject RulerObj = autObj.Object as AnnRulerObject;
RulerObj.MeasurementUnit = AnnUnit.Centimeter;
}
if(autObj.Object is AnnCrossProductObject)
{
AnnCrossProductObject CrossProductObj = autObj.Object as AnnCrossProductObject;
CrossProductObj.MeasurementUnit = AnnUnit.Centimeter;
}
}
2. In the automation.CurrentDesignerChanged event handler, do the following:
if(automation.CurrentDesigner != null && automation.CurrentDesigner is AnnCrossProductDrawDesigner)
{
AnnCrossProductDrawDesigner DrawDes = automation.CurrentDesigner as AnnCrossProductDrawDesigner;
AnnCrossProductObject tmplObj = DrawDes.ObjectTemplate as AnnCrossProductObject;
tmplObj.MeasurementUnit = AnnUnit.Centimeter;
}
if(automation.CurrentDesigner != null && automation.CurrentDesigner is AnnLineDrawDesigner)
{
AnnLineDrawDesigner DrawDes = automation.CurrentDesigner as AnnLineDrawDesigner;
if(DrawDes.ObjectTemplate is AnnRulerObject)
{
AnnRulerObject tmplObj = DrawDes.ObjectTemplate as AnnRulerObject;
tmplObj.MeasurementUnit = AnnUnit.Centimeter;
}
}
In non-automated mode, you set the Object property of the
AnnDrawDesigner manually, so when you initialize the designer, set its
MeasurementUnit to the value you want.
Amin Dodin
Senior Support Engineer
LEAD Technologies, Inc.