A workcell review tool can report different tool positions before and after reloading an OpenUSD scene, even when it reads the same prim at the same time code. If the reviewer has edited the stage and the tool reuses a transform cache, a computed world transform from before the edit can remain in that cache. This is especially easy to miss when the edited property belongs to a parent and the report is checking one of its children.
OpenUSD documents that UsdGeomXformCache does not automatically invalidate its values when the underlying stage changes. Reusing it is useful when querying multiple transforms in a stable scene. If the tool edits or recomposes the scene between queries, explicitly retire or clear the affected cache before collecting another set of results.
Reproduce the discrepancy with two prims
This fixture creates a cell with one target. The target always has a local X offset of one stage unit. The cell starts with an X offset of two, so the initial world X position is three. After the first query, the cell translation changes to seven. All queries use the default time code. No motion controller, hardware or calibration file is involved.
from pxr import Gf, Usd, UsdGeom
stage = Usd.Stage.CreateInMemory()
base = UsdGeom.Xform.Define(stage, "/Cell")
base_op = base.AddTranslateOp()
assert base_op.Set(Gf.Vec3d(2, 0, 0))
target = UsdGeom.Xform.Define(stage, "/Cell/Target")
assert target.AddTranslateOp().Set(Gf.Vec3d(1, 0, 0))
t = Usd.TimeCode.Default()
prim = target.GetPrim()
cache = UsdGeom.XformCache(t)
def x_position(matrix):
return matrix.ExtractTranslation()[0]
first = x_position(cache.GetLocalToWorldTransform(prim))
assert first == 3
assert base_op.Set(Gf.Vec3d(7, 0, 0))
stale = x_position(cache.GetLocalToWorldTransform(prim))
direct = x_position(target.ComputeLocalToWorldTransform(t))
assert stale == 3
assert direct == 8
cache.SetTime(t)
assert x_position(cache.GetLocalToWorldTransform(prim)) == 3
cache.Clear()
refreshed = x_position(cache.GetLocalToWorldTransform(prim))
assert refreshed == direct == 8
The warmed cache still returns three after the parent edit in this fixture. The separate direct query returns eight using the current stage. Setting the same time code leaves the cached result at three. Clearing the cache and querying again makes both results agree at eight. The target's own authored value did not change. The discrepancy comes from the earlier parent transform that the cached world result had already incorporated.
Keep time selection and stage edits explicit
Time selection matters when the stage contains animated transforms. The cache uses its configured time to evaluate the relevant values, and changing to a different time can clear computed transforms from the previous time. That behavior is separate from a same-time change to the stage. Keep an explicit cache lifecycle around the operation that changes the scene instead of using a time toggle as a signal that the stage was edited. An inspection job can use a fresh cache for each stable review pass or clear the cache before reading identifiers from an edited stage.
The scope of the edit matters. A change to a parent can affect the world transforms of many descendants, including a sensor, a mounting plate and a point used for inspection. Clearing only a list of directly edited prim paths in the report would leave indirect effects unaccounted for. For a small review pass, a full cache clear is easy to test. A larger system with selective invalidation needs to track which matrices and authored data each result depends on.
Validate a review at the same stage and time
Record the stage identity, the time code and the scene version or edit sequence associated with a report. When an exported position disagrees with a live viewport, compare the same prim and time after refreshing the cache. Also confirm that one tool is comparing world transforms to world transforms. A target can keep its local offset while its world position changes due to the parent, which is the distinction this fixture isolates.
Keep a regression case that warms the cache, edits an ancestor and checks the child at the original time. Compare the refreshed result against a separately computed transform and include the expected values using stage units. If the review tool queries in parallel, use a separate cache per thread, as the OpenUSD documentation describes. This keeps the cached calculations tied to a known stage state and lets another reviewer reproduce the export after edits.
Sources
OpenUSD API reference, UsdGeomXformCache
https://openusd.org/release/api/class_usd_geom_xform_cache.html
OpenUSD API reference, UsdGeomXformable
https://openusd.org/release/api/class_usd_geom_xformable.html