This is almost 18 y.o. question ( it's almost allowed to buy the alcohol drinks :) ), but it still remains unanswered. As was looking for the same code sample too and have just found something on GitHub. So I leave the answer here. Maybe it will help someone else.
Handle(AIS_Dimension) aDim;
if (myIsDiameterDimension)
{
aDim = new AIS_DiameterDimension (aCircle);
Handle(AIS_DiameterDimension)::DownCast(aDim)->SetFlyout (aDimDlg->GetFlyout());
}
else
{
aDim = new AIS_RadiusDimension (aCircle);
Handle(AIS_RadiusDimension)::DownCast(aDim)->SetFlyout (aDimDlg->GetFlyout());
}
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect();
anAspect->MakeArrows3d (Standard_False);
anAspect->MakeText3d (/* Text goes here */);
anAspect->TextAspect()->SetHeight (/* Font height goes here */);
anAspect->MakeTextShaded (/* Shall we select text? */);
anAspect->SetCommonColor (/* Color? */);
anAspect->MakeUnitsDisplayed (/* Display Units? */);
if (/* Display Units? */)
{
aDim->SetDisplayUnits (/* Which Units? */);
}
aDim->SetDimensionAspect (anAspect);
// Display dimension in the neutral point
myAISContext->Display (aDim, Standard_True);
-Yuriy