Thu, 02/26/2026 - 11:18
Hello everyone,
When using OCCT to read a STEP242 file exported from NX, how can I obtain information about the dimension arrow types, annotation positions, etc.? I used the following code to read the file but only managed to extract the dimension type and value. XCAFDimTolObjects_DimensionObject doesn’t seem to provide methods for accessing annotation attributes. Is there something wrong with my process? Looking forward to your response.
for (int i = 1; i <= dimLabels.Length(); i++)
{
TDF_Label dimLabel = dimLabels.Value(i);
Handle(XCAFDoc_Dimension) dimAttr;
if (dimLabel.FindAttribute(XCAFDoc_Dimension::GetID(), dimAttr)) {
if (!dimAttr.IsNull()) {
Handle(XCAFDimTolObjects_DimensionObject) dimObj = dimAttr->GetObject();
if (!dimObj.IsNull()) {
//
XCAFDimTolObjects_DimensionType type = dimObj->GetType();
Handle(TCollection_HAsciiString) sematicname = dimObj->GetSemanticName();
Handle(TCollection_HAsciiString) prename = dimObj->GetPresentationName();
TopoDS_Shape presantation = dimObj->GetPresentation();
if (!presantation.IsNull())// it is null
{
TopAbs_ShapeEnum shapetyep = presantation.ShapeType();
if (shapetyep == TopAbs_COMPOUND)
int a = 1;
}
Handle(TCollection_HAsciiString) discription = dimObj->GetDescription(1);
double value = dimObj->GetValue();
double b = value;
// ...
}
}
}
}