From 9ec2de8e4aa602b36efd4a1534f9ce438f7284c1 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Fri, 11 Jul 2025 09:00:35 -0700 Subject: [PATCH] Don't add location-like objects to Compound() The stack scan likes to look at iterables like lists for objects, but unlike the way it treats local variables, it tries to put them in a Compound() object. That doesn't work for elements like build123d Location/Pos/Rot which aren't shapes. Just skip them in those contexts. --- yacv_server/cad.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yacv_server/cad.py b/yacv_server/cad.py index 1d576c4..fd06fd9 100644 --- a/yacv_server/cad.py +++ b/yacv_server/cad.py @@ -77,8 +77,8 @@ def get_shape(obj: CADLike, error: bool = True) -> Optional[CADCoreLike]: if len(shapes_raw_filtered) > 0: # Continue if we found at least one shape # Sorting is required to improve hashcode consistency shapes_raw_filtered_sorted = sorted(shapes_raw_filtered, key=lambda x: _hashcode(x)) - # Build a single compound shape - shapes_bd = [Compound(shape) for shape in shapes_raw_filtered_sorted if shape is not None] + # Build a single compound shape (skip locations/axes here, they can't be in a Compound) + shapes_bd = [Compound(shape) for shape in shapes_raw_filtered_sorted if shape is not None and not isinstance(shape, TopLoc_Location)] return get_shape(Compound(shapes_bd), error) except TypeError: pass