Simultaneously extracting GD&T data and correct Location data from STEP AP242 file

Dear fellow OCC users,

I am trying to simultaneously extract GD&T data and the location of this GD&T data from a STEP AP242 file, to reproduce the following scientific paper: https://doi.org/10.1080/0951192X.2022.2145017. Essentially I need to extract not just the GD&T data, but also the location data for the local coordinate frames of each of the toleranced shapes. I can do each of these things separately, but I do not know how to relate the information to one another.

Using the methods `XCAFDimTolObjects_Tool.GetGeomTolerances` and `XCAFDimTolObjects_Tool.GetDimensions` of the`XCAFDimTolObjects_Tool` object I have been able to extract the `TopoDS_Shape` objects that have `XCAFDimTolObjects_DimensionObject`, `XCAFDimTolObjects_GeomToleranceObject`, or `XCAFDimTolObjects_DatumObject` associated with them, so far so good. (Typically these are `TopoDS_Face` for my particular STEP file.) But the problem is that the toleranced `TopoDS_Shape` instances do not have the correct local coordinate frame. Instead, a call to `TopoDS_Shape.Location` always returns the identity matrix for all of them.

If I instead recursively iterate over the entire shape using `TopoDS_Iterator`, then suddenly I get non-trivial coordinate frames, as expected. However, if I ask for the GD&T data associated with each shape we iterate over, using `XCAFDimTolObjects_Tool.GetRefGeomTolerances` or `XCAFDimTolObjects_Tool.GetRefDimensions`, then nothing is found at all, even though I recursively iterated over the entire shape, and even though calls to `XCAFDimTolObjects_Tool.GetGeomTolerances` and `XCAFDimTolObjects_Tool.GetDimensions` did yield results in the steps above.

So how can I identify the locations for every `TopoDS_Shape` that has GD&T info associated with it? If it would help I can prepare a MWE, but I suspect I am simply not understanding something about the internal workings of OCC, so I hope that somebody can point me in the right direction. (I also tried a similar workflow based on `XCAFDimTolObjects_Tool` instead, but the results are the same.)

Kind regards,

Martin

p.s. I am using Python-OCC, but I suspect the behavior I am seeing here is not related with that?