Storing breps in a list as plugin user data


Is it possible to store breps/extrusions in a document user data as a list?
Currently I use:

ArchivableDictionary.Set Method (String, IEnumerable < ObjRef > )

but I would like to be able to import the document user data between rhino files and create sections through breps, as well as to keep breps that user deleted in the UI. Please note that I have to use a list and I know I can make a hack and do it with ArchivableDictionary and then change it to a list but I would rather not do it if possible.

My understanding is that ObjRef does not contain the geometry itself so it would not work. Is it correct?

(Dale Fugier) #2

Yes, this should be possible. But you won’t want to hold on to an ObjRef, as this is just a reference to what was once picked. Better to hold on to the geometry - Rhino.Geometry.Brep.


Hello Dale
Thank you for your reply. Could you please let me know how can I do it?
This approach works for ObjRef but does not for brep:

GetObject gh = new GetObject();
gh.GeometryFilter = ObjectType.Surface | ObjectType.PolysrfFilter | ObjectType.Extrusion;

if (gh.ObjectCount != 0)
    foreach (ObjRef entry in gh.Objects())
ArchivableDictionary tempDict = new ArchivableDictionary();
tempDict.Set(secKey, (List<ObjRef>)entryValue);
 _docGlobalDatabase.Set("entryKey", tempDict);

when I change
tempDict.Set(secKey, (List<ObjRef>)entryValue);

tempDict.Set(secKey, (List<Brep>)entryValue);

I get an error:
Error CS1503 Argument 2: cannot convert from ‘System.Collections.Generic.List<Rhino.Geometry.Brep>’ to ‘bool’