A Geometrical Tolerance is a complex structure used into PMI and Drawing representions and is known as Dtk_GeometricalTolerance into DATAKIT API.
This tutorial will try to explain you how to use Dtk_GeometricalTolerance to retrieve all relevant data.
Here is an image representing a Dtk_GeometricalTolerance :
The Dtk_GeometricalTolerance are composed of 1 or several Dtk_ToleranceSpecificationContainer defined by their types (e.g., Position and Perpendicularity).
Each Dtk_ToleranceSpecificationContainer gathers 1 or several Dtk_ToleranceSpecification .
Each Dtk_ToleranceSpecification contains the text value of the tolerance and can have 1 Dtk_ReferenceFrame if needed. It can also have 0 to several Dtk_FCFFeatureIndicator .
Each Dtk_ReferenceFrame can have 0 to 3 Dtk_ReferenceBlock .
To illustrate the use of this class, we will try to get all information concerning this Geometrical Tolerance (Shown in the exploded view):
First, we will try to retrieve the first Dtk_ToleranceSpecificationContainer , represented by this image:
TmpTolSpecCont = MyGeomTol->GetToleranceSpecificationContainer( 0 );
TolSpecContType = TmpTolSpecCont->ToleranceSpecificationContainerType();
Then we focus onto the First Dtk_ToleranceSpecification :
RefLabel = TmpReferenceFrame->FirstReference()->GetReferenceLabel( 0 );
RefLabel = TmpReferenceFrame->SecondReference()->GetReferenceLabel( 0 );
Now we process the Second Dtk_ToleranceSpecification of the Position Tolerance Specification Container :
RefLabel = SecondTolSpec->FirstReference()->GetReferenceLabel( 0 );
DTK_FDT_MODIFIER Mofidier = SecondTolSpec->FirstReference()->GetMaterialModifier( 0 );
Finally we focus onto the Second Dtk_ToleranceSpecificationContainer ...
...which only has one Dtk_ToleranceSpecification :
TmpTolSpecCont = MyGeomTol->GetToleranceSpecificationContainer( 1 );
TolSpecContType = TmpTolSpecCont->ToleranceSpecificationContainerType();
FirstTolSpec = TmpTolSpecCont->GetToleranceSpecification( 0 );
FirstTolSpecValueTexts = FirstTolSpec->GetMainValue();
RefLabel = FirstTolSpec->FirstReference()->GetReferenceLabel( 0 );
RefLabel = FirstTolSpec->FirstReference()->GetReferenceLabel( 1 );
RefLabel = FirstTolSpec->SecondReference()->GetReferenceLabel( 0 );
RefLabel = FirstTolSpec->ThirdReference()->GetReferenceLabel( 0 );
for(
Dtk_Size_t l = 0; l < FirstTolSpec->GetNumIndicators(); l++ )
{
const Dtk_Text& IndicatorSymbol = CurrentIndicator->GetSymbol();
const Dtk_Text& IndicatorDatumFeatureIdentifier = CurrentIndicator->GetDatumFeatureIdentifier();
}
Here the full sample code to retrieve this Geometrical Tolerance:
TmpTolSpecCont = MyGeomTol->GetToleranceSpecificationContainer( 0 );
TolSpecContType = TmpTolSpecCont->ToleranceSpecificationContainerType();
RefLabel = TmpReferenceFrame->FirstReference()->GetReferenceLabel( 0 );
RefLabel = TmpReferenceFrame->SecondReference()->GetReferenceLabel( 0 );
RefLabel = SecondTolSpec->FirstReference()->GetReferenceLabel( 0 );
DTK_FDT_MODIFIER Mofidier = SecondTolSpec->FirstReference()->GetMaterialModifier( 0 );
TmpTolSpecCont = MyGeomTol->GetToleranceSpecificationContainer( 1 );
TolSpecContType = TmpTolSpecCont->ToleranceSpecificationContainerType();
FirstTolSpec = TmpTolSpecCont->GetToleranceSpecification( 0 );
FirstTolSpecValueTexts = FirstTolSpec->GetMainValue();
RefLabel = FirstTolSpec->FirstReference()->GetReferenceLabel( 0 );
RefLabel = FirstTolSpec->FirstReference()->GetReferenceLabel( 1 );
RefLabel = FirstTolSpec->SecondReference()->GetReferenceLabel( 0 );
RefLabel = FirstTolSpec->ThirdReference()->GetReferenceLabel( 0 );
for(
Dtk_Size_t l = 0; l < FirstTolSpec->GetNumIndicators(); l++ )
{
const Dtk_Text& IndicatorSymbol = CurrentIndicator->GetSymbol();
const Dtk_Text& IndicatorDatumFeatureIdentifier = CurrentIndicator->GetDatumFeatureIdentifier();
}