Repository navigation
Description
What happens
ReadFromD2P reads the CSC pieces of the Rhino document and outputs their ComponentPassport, but the Component output (the D2P component, .NET IComponentBase) is null for every piece, also for pieces that are D2P components written by PassportToD2P.
Likely cause (from reading the code, not yet reproduced)
In grasshopper_userobjects_src/DDU_CSC_ReadFromD2P.py, RunScript passes d2p_plane(entry) to read_document (grasshopper_lib/csc_gh/doc.py:307). d2p_plane assumes that the tagged object is the label of the D2P component:
- it returns
Noneat once whenentry['object'].Attributes.Nameis empty ("a plain tag of BakeComponents has no name and is not asked"); - otherwise it calls
instance_from_object(entry['object'])and swallows every exception (except Exception: component = None), without a message.
But PassportToD2P no longer puts the convention user text on the label: "D2P commits its label without user text", so the ids are written on the geometry objects of the component, with fresh ObjectAttributes() and no name (see the docstring around DDU_CSC_PassportToD2P.py:94 and _base_object). The tagged objects that tagged_objects(doc) finds are therefore member geometry, not labels: d2p_plane returns None for them, nothing is put into found, and Component.Add(found.get(...)) adds null.
A side effect, if this is right: the placement is then taken from the tag plane (the stored csc_placement), not from the current plane of the D2P component, so a D2P component moved in Rhino after PassportToD2P is read back at its old placement.
Expected
- For a piece that belongs to a D2P component,
Componentcarries that component andcsc_placementfollows its current plane. - Null only for a plain tag (a piece baked by
BakeComponents), as the output description says. - A failure to resolve the D2P component is a warning naming the piece, not silent.
Fix sketch
- Resolve the D2P component from a tagged member object (its parent component / label, as D2P's own member lookup does), not only from a named label; keep the label path for documents written by older releases.
- Report the exception of
instance_from_objectas a warning instead of swallowing it. - Check whether
SyncWithRhinoDochas the same assumption.
Done when
- A document written by the current
PassportToD2Pgives a non-nullComponentper piece, and moving a D2P component in Rhino changes thecsc_placementthat is read back. - A plain
BakeComponentstag still gives null without a warning. - Tests in
tests/grasshopperfor the resolution (member object, label, plain tag), with D2P stubbed; a live check in Rhino 8. - Re-exported user object with the next Grasshopper release.
Activity
fix(gh): missing inputs warn, no result is an empty tree or a null sl…
fstwn commentedon Nov 4, 2026
Fixed in 0.6.4.4 (#53). A component made by PassportToD2P and committed with D2P now comes back in the Component output. An element baked by BakeComponents is no D2P component and gives null by design; the null in this report came from such a bake (decision 8.185).