diff --git a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py index b25b1aea..f9ccffc0 100644 --- a/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py +++ b/csaxs_bec/bec_widgets/widgets/tomo_params/tomo_params.py @@ -2193,12 +2193,19 @@ class CommandJobBuilderDialog(QDialog): """Live, advisory-only OSA-collision warning for move_foptz_with_shift's foptz_target field. + Checked against fosaz's *defined* IN position (its "in" + user_parameter), not wherever fosaz happens to be reading right + now -- fosaz is normally parked safely OUT except when actually in + use, so checking the live position would almost never warn. The + real question is "if the OSA were swapped in at its nominal + position while foptz is at this target, would it collide", which + is also exactly what FlomniOpticsMixin.fosa_in() itself checks + (and refuses on) for fosaz moves -- this surfaces the same check + here, at data-entry time, for foptz instead. + The move itself stays a plain absolute move (see - _queue_action_move_foptz_with_shift's docstring) -- this just - surfaces, at data-entry time, the same clearance check - FlomniOpticsMixin.fosa_in() enforces (by refusing) for fosaz moves, - so an operator can see a likely OSA collision before queuing a - foptz target, without the queue action itself blocking on it. + _queue_action_move_foptz_with_shift's docstring) -- this is + advisory only, the queue action itself doesn't block on it. """ from csaxs_bec.bec_ipython_client.plugins.flomni.flomni_optics_mixin import ( compute_osa_remaining_space, @@ -2217,14 +2224,17 @@ class CommandJobBuilderDialog(QDialog): if fosaz is None: return try: - fosaz_val = fosaz.readback.get() + fosaz_in = (fosaz.user_parameter or {}).get("in") except Exception: return - clearance = compute_osa_remaining_space(foptz_widget.value(), fosaz_val) + if fosaz_in is None: + return + clearance = compute_osa_remaining_space(foptz_widget.value(), fosaz_in) if clearance <= 0: lbl.setText( - f"Warning: at this foptz target, OSA clearance would be " - f"{clearance:.2f} mm (<=0 = collision risk with a normal OMNY pin)." + f"Warning: at this foptz target, OSA clearance at its defined " + f"IN position ({fosaz_in:.2f} mm) would be {clearance:.2f} mm " + "(<=0 = collision risk with a normal OMNY pin)." ) lbl.setVisible(True) else: