DATAKIT API  V2025.2
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
How to find Fdt semantic data

You can access several kind of semantic data for Dtk_Dimension.


Using Dtk_Text_subtype

Each Dtk_Text of Dtk_Dimension has a DTK_Text_subtype.
DTK_Text_subtype lets you flag each text with one or more subtype(s) to semantically define the Dtk_Text.

On this picture, you can see the easiest cases:

  • The first Dtk_Dimension is a really basic case:
    The only text provided is '69.76'.
    It is flagged 'Mainvalpart' - because it is a part of the main value part of the dimension -, and 'basisval' - because it is the basisval of this part -.
  • The second Dtk_Dimension contains 2 texts : '2.75' and ' " '.
    Each text is a part of main value part, so they are both flagged 'Mainvalpart'.
    The first one is also flagged 'basisval' whereas the other is flagged 'pow'.
  • You can see on the third Dtk_Dimension some others subtypes not included into the mainvalpart - Up/Left/Right/Down/Prefix -.

This second picture shows you others DTK_Text_subtype:

  • The first Dtk_Dimension is a dual dimension.
    You can see that all texts in the second part of the dual are flagged 'dual'.
  • The second Dtk_Dimension is a fraction form.
    The fraction is a part of the mainval, so all the texts are flagged 'Mainvalpart'.
    You have the 'basisval', and the 'fraction' part.
    You still have the 'pow'.

Most complex cases follow on the 2 next pictures:


Using Dtk_Info

Each Dtk_Text has also a Dtk_Info giving you additionnal information.
You can access it using method Dtk_Info::FindAttribute (see sample below).

  • DtkUnit gives the unit (as string) of the displayed value in the Dtk_Text
    UnitType should be one of theses values :
    DTK_UNIT_MM,
    DTK_UNIT_MICRON
    DTK_UNIT_CM
    DTK_UNIT_M
    DTK_UNIT_KM
    DTK_UNIT_INCH
    DTK_UNIT_RADIAN
    DTK_UNIT_DMS
    DTK_UNIT_GRADE
    DMS (degree minuts seconds)
  • DtkOriginalValue gives the semantic numerical value corresponding to main value of dimension.
  • DtkOriginalTolMin gives the semantic numerical value corresponding to the minimum tolerance
  • DtkOriginalTolMax gives the semantic numerical value corresponding to the maximum tolerance
  • DtkOriginalTolMinSign gives the sign of the minimum tolerance
  • DtkOriginalTolMaxSign gives the sign of the maximum tolerance
  • DtkOriginalTolAbsolute gives a boolean to tell if tolerances values are relative to the original value or absolute
  • DtkOriginalDataUnit gives unit of semantic numerical value as string like DtkUnit
  • DtkSeparator gives the separator character for number '.' or ','
  • DtkDisplayFinalZeros gives a boolean for Final Zero display
  • DtkDisplayLeadingZeros gives a boolean for Leading Zero display
  • DtkPrecision gives a double for precision to display


Following reader, theses information can also be set on the Dtk_CompositeText.


Library Use

//First, consider the Dtk_Dimension
Dtk_DimensionPtr MyDimension;
//Retrieving the array of texts
const Dtk_CompositeText& MyCompositeText = MyDimension->GetTexts();
//Retrieving the unit of the Dtk_Dimension texts - every texts -.
const Dtk_InfoPtr& CompositeTextInfo = MyCompositeText.GetInfo();
Dtk_Val TmpVal;
CompositeTextInfo->FindAttribute( "DtkUnit", TmpVal );
// UnitType should be one of theses values ::
// "DTK_UNIT_MM", "DTK_UNIT_MICRON", "DTK_UNIT_CM", "DTK_UNIT_M", "DTK_UNIT_KM", "DTK_UNIT_INCH"
// "DTK_UNIT_RADIAN", "DTK_UNIT_DMS", "DTK_UNIT_GRADE"
// *DMS = degree minuts seconds
Dtk_string UnitType = TmpVal.GetString();
//Reading each text :
Dtk_Size_t NumTexts = MyCompositeText.GetNumTexts();
for( Dtk_Size_t i = 0; i < NumTexts; ++i )
{
//We retrieve the Dtk_Text
const Dtk_Text& IthText = MyCompositeText[ i ];
//Retrieving the unit of the Dtk_Dimension text.
const Dtk_InfoPtr& TextInfo = IthText.GetInfo();
Dtk_Val TmpVal;
TextInfo->FindAttribute( "DtkUnit", TmpVal );
// UnitType should be one of theses values ::
// "DTK_UNIT_MM", "DTK_UNIT_MICRON", "DTK_UNIT_CM", "DTK_UNIT_M", "DTK_UNIT_KM", "DTK_UNIT_INCH"
// "DTK_UNIT_RADIAN", "DTK_UNIT_DMS", "DTK_UNIT_GRADE"
// *DMS = degree minuts seconds
Dtk_string UnitType = TmpVal.GetString();
//Retrieving the Numeric value of the Dtk_Dimension text.
Dtk_Val val;
Dtk_ErrorStatus st = inf->FindAttribute("DtkOriginalValue",val);
if (st==dtkNoError)
{
double r = val.GetDouble();
}
}
//Retrieving the subtypes:
//Here is the new method to read the subtypes by DTK_Text_subtype, to have each Dtk_Text semantic data:
const DTK_Text_subtype& MyTextSubType = IthText.TextSubType();
//Here, you retrieve a DTK_Text_subtype instance.
//Using subtype
if( MyTextSubType.IsTolBloc() )
{
// entering into tolerance bloc
if( MyTextSubType.IsTolUpperTol() )
{
//doing some stuff...
}
}
}
Dtk_Info::FindAttribute
Dtk_ErrorStatus FindAttribute(const Dtk_string &name, Dtk_Val &val) const
Dtk_Text::TextSubType
DTK_Text_subtype & TextSubType()
Retrieves the text subtype - get/set -.
Dtk_CompositeText::GetNumTexts
Dtk_Size_t GetNumTexts() const
Retrieves the texts number.
DTK_Text_subtype::IsTolBloc
Dtk_bool IsTolBloc() const
Tell if the associated Dtk_text is part of Tolerance Block group - into Dtk_Dimension -.
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
Dtk_Text::GetInfo
const Dtk_InfoPtr & GetInfo() const
Retrieves the text infos - read only -.
Dtk_Text
This is the base text class. It's part of Dtk_CompositeText. It's used into a lot of 2D Entities It c...
Definition: util_draw_dtk.hpp:1126
Dtk_Val
Definition: dtk_val.hpp:67
DTK_Text_subtype::IsTolUpperTol
Dtk_bool IsTolUpperTol() const
Tell if the associated Dtk_text is part of Tolerance Upper Value group - into Dtk_Dimension -.
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Dtk_Val::GetString
Dtk_string GetString(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
DTK_Text_subtype
This is the DTK_Text_subtype class. It's used to provide semantic data about Dtk_Text type....
Definition: util_draw_dtk.hpp:1012
Dtk_CompositeText
This is the composite text class. It's basically a Dtk_Text Container. This class represents a group ...
Definition: util_draw_dtk.hpp:1557
Dtk_Val::GetDouble
double GetDouble(Dtk_status &st=Dtk_status::GetDefaultStatus()) const
Dtk_CompositeText::GetInfo
const Dtk_InfoPtr & GetInfo() const
Retrieves the infos.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:140