Hi all. I do need to get the GUID of Details from my Layouts and I can’t find any way to do so in Grasshopper. Do know somebody a component or a script that can retrieve this information? Best regards.
GetAllDetails_00.gh (11.5 KB)
does this help ?
the script missing further error handling.
kind regards -tom
Looks like this is for Rhino8 and unfortunately I can’t test as still didn’t upgraded.
private void RunScript(ref object details, ref object guids)
{
details = null;
guids = null;
RhinoDoc doc = RhinoDoc.ActiveDoc;
if (doc == null)
{
return;
}
// Create a filter for all Detail Objects
ObjectEnumeratorSettings filterSettings = new ObjectEnumeratorSettings();
filterSettings.ObjectTypeFilter = ObjectType.Detail;
// Get objects that match the filter
RhinoObject[] detailObjects = doc.Objects.FindByFilter(filterSettings);
details = detailObjects;
// Linq
Guid[] objectIds = detailObjects.Select(obj => obj.Id).ToArray();
guids = objectIds;
}
}
It is possible to add another output for the ID of the Layouts, so I can easily group the Details GUID with the corresponding Layouts? I do need this to use in conjunction with the Drafthorse components to further manipulate some of the Details.
if you need this additional info
loop through all Pages (called PageViews in Rhinocommon)
doc.Views.GetPageViews()
and then for each PageView loop through the Details (called DetailViews in Rhinocommon)
page.GetDetailViews()
I am not sure, if DetailViewObject
knows about the pageView it is placed on / into.