diff --git a/src/simplecadapi/_glue/session.py b/src/simplecadapi/_glue/session.py index 7d5cd9d3..68072723 100644 --- a/src/simplecadapi/_glue/session.py +++ b/src/simplecadapi/_glue/session.py @@ -89,8 +89,7 @@ def walk_values(value: Any, *, deep: bool, seen: Optional[Set[int]] = None) -> I for item in value: yield from walk_values(item, deep=deep, seen=seen) elif deep: - # a result wrapped in the caller's own dataclass (the product values have their own children: a multi-body Part's - # `body` field refuses to name one body) + # a result wrapped in the caller's own dataclass (the product values have their own children, listed in _children) if dataclasses.is_dataclass(value) and not isinstance(value, type) and type(value).__name__ not in _PRODUCT_KINDS: for field in dataclasses.fields(value): if not field.name.startswith("_"): diff --git a/src/simplecadapi/product/packages.py b/src/simplecadapi/product/packages.py index 4ba0152f..90a19617 100644 --- a/src/simplecadapi/product/packages.py +++ b/src/simplecadapi/product/packages.py @@ -212,19 +212,9 @@ def _definition_refs(definition: Definition) -> list[Mapping[str, Any]]: f"definition blob path {path!r} outside its semantic domain {role.path_prefix!r}" ) refs.append(ref.to_dict()) - for body in getattr(definition, "bodies", ()) or (): # every body of a multi-body part has its own BRep and snapshot - refs.extend(_checked_body_refs((body.body_ref.to_dict(), body.topology_snapshot_ref.to_dict()))) return refs -def _checked_body_refs(refs: tuple[Mapping[str, Any], ...]) -> list[Mapping[str, Any]]: - for ref, prefix in zip(refs, ("body/", "topology/")): - path = str(ref["path"]) - if not path.startswith(prefix): - raise ProductPackageError(f"definition blob path {path!r} outside its semantic domain {prefix!r}") - return list(refs) - - def _definition_closure(root: Definition) -> dict[str, Definition]: definitions: dict[str, Definition] = {} active: set[str] = set() diff --git a/src/simplecadapi/scene/preview.py b/src/simplecadapi/scene/preview.py index edaa6e2c..53f6b68a 100644 --- a/src/simplecadapi/scene/preview.py +++ b/src/simplecadapi/scene/preview.py @@ -426,8 +426,8 @@ def encode_preview(scene: PreviewScene, omit: Collection[str] = ()) -> bytes: continue definition = scene.definitions[key] body_id = scene.bodies.get(key) - # entity///; a body of a multi-body part: entity//body:// (as in - # the package's scene, scene/product_scene.py) + # entity///; an open solid of a notebook (compile_open_bodies): + # entity//body:// prefix = f"entity/{definition}/" if body_id is None else f"entity/{definition}/body:{body_id}/" parts.append( { @@ -521,15 +521,15 @@ def decode_preview_header(data: bytes) -> dict[str, Any]: def entity_info(scene: PreviewScene, entity_id: str) -> dict[str, Any] | None: """The geometric properties of the entity *entity_id* of a part of *scene*. - ``entity///`` (``entity//body:/...`` for a body of a - multi-body part); returns what the package's entity + ``entity///`` (``entity//body:/...`` for an open solid of a + notebook); returns what the package's entity sidecar holds for it (``properties``, ``geometry``, ``tags``) except the ``source`` links into the feature graph, or ``None`` if there is no such entity. """ _, _, rest = entity_id.partition("entity/") definition, _, tail = rest.partition("/") body_id = "" - if tail.startswith("body:"): # a body of a multi-body part + if tail.startswith("body:"): # an open solid of a notebook segment, _, tail = tail.partition("/") body_id = segment[len("body:") :] kind, _, topo_id = tail.partition("/")