[CONNECT C++] Reading dimension text size with annotation scale present

Hi folks,

I'm getting inconsistent results between V8i and Connect when reading the same DGN using similar SDK functions. I've attached the DGN. Both dimensions have a text size of 2.5mm, however, I get different results when using the dimensioning API.

Annotation scale does not appear to be set on the elements. I read annotation scale using this code. It seems to work, happy to be informed if this isn't the correct way to get this info from a dimension:

EditElementHandle elHnd ( elRef, modelRef );

auto ah = dynamic_cast<IAnnotationHandler*>( &elHnd.GetHandler () );

if ( nullptr != ah )
{
if ( ah->HasAnnotationScale ( dScaleP, elHnd ) )
{
iRet=BSISUCCESS;
}
}

I am guessing this type of annotation is stored as an XAttribute (XATTRIBUTEID_AnnotationScale) on the element, rather than in the dimension style. I'm also guessing this overrides the one in the dimension style?

In any case, for both dimensions in my file I get no annotation scale set. Then I read the text size from the dimension style using this code:

if ( dgnDimStyleP->GetBooleanProp ( biProp, DIMSTYLE_PROP_Text_OverrideHeight_BOOLINT ) == BSISUCCESS )
{
if ( biProp )
{
/*--- The text height is overridden from the textstyle ---*/
dgnDimStyleP->GetDistanceProp ( dRet, DIMSTYLE_PROP_Text_Height_DISTANCE, dgnModelCacheP );
}
else
{
/*--- The text height is defined by the textstyle ---*/
textStylePtr->GetProperty ( Bentley::DgnPlatform::TextStyle_Height, dTextStyleHeight );
}
}

Programmatically, on the dimension on the left, I get a height of 2500 UORs (2.5mm) and on the left I get a height of 1,250 UORs (1.25mm). Clearly this is wrong, because the terminators seem to be the same size. If I use "ANALYZE ELEMENT", it tells me that left is 2.5mm and right is 1.25mm text size. Similarly, the Match Dimension Attributes tool gives me the same results. If I check the annotation scale according to the dimension style, like this:

dgnDimStyleP->GetBooleanProp ( biUseAnnoScale, DIMSTYLE_PROP_Placement_UseStyleAnnotationScale_BOOLINT );

dgnDimStyleP->GetDoubleProp ( dAnnoScale, DIMSTYLE_PROP_Placement_AnnotationScale_DOUBLE );

Then I get biUseAnnoScale as TRUE and dAnnoScale as 100.0 for both dimensions.

So I can't see why one has the annotation scale already applied in the text size and one doesn't. Looking at the dimensions, the terminator arrow looks the same size. If I adjust the dimension text size on the right dimension to match the text size on the left, then it is 50 times too big, which is the model's annotation scale (which should be ignored according to the property DIMSTYLE_PROP_Placement_UseStyleAnnotationScale_BOOLINT).

It seems like there are some order of rules as to how to read and apply annotation scale in Connect, but I can't figure it out. In V8i, annotation scale was automatically applied to the dimension text size as I read it, so I didn't need to think about it. In Connect, it seems that sometimes it is and sometimes it is not, and I can't figure out how or why. What am I missing?

Cheers.

850-m-12315_0-dims-4.dgn

Parents Reply Children
No Data