From 36eac713f455f1afd0f8e6e30ae0dbc325e9b5cf Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 06:53:35 +0000 Subject: [PATCH] simulation: refresh the stepper latch only when a moving body is added or removed Keeps the stationary add/remove path unchanged (test_surface_actuation builds a Simulation without a stepper). Co-Authored-By: Claude Opus 5.5 --- src/CelerisLab/simulation.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/CelerisLab/simulation.py b/src/CelerisLab/simulation.py index b1e0327..7fbdc8a 100644 --- a/src/CelerisLab/simulation.py +++ b/src/CelerisLab/simulation.py @@ -172,7 +172,8 @@ class Simulation: self.bodies.stage_add(obj) return -1 body_id = self.bodies.add(obj) - self._refresh_stepper_block() + if translation is not None: + self._refresh_stepper_block() return body_id def add_jet(self, jet) -> int: @@ -273,8 +274,10 @@ class Simulation: if self._initialized: self.bodies.stage_remove(id) else: + moving = self.bodies.get(id).motion is not None self.bodies.remove(id) - self._refresh_stepper_block() + if moving: + self._refresh_stepper_block() # -- Legacy convenience (keep for backward compat) ----------------------- def add_cylinder(self, center: Tuple[float, ...],