Grasshopper

algorithmic modeling for Rhino

Hi everyone -

 

I'm looking to generate a list of all object GUIDs in a 3dm file.  The following script works for any object that's visible in my file:

 

Dim guid_set As New List(Of Guid)

Dim layer_idx_set As New List(Of Int32)

Dim obj_type_set As New List(Of String)

 

Dim obj_set As Rhino.DocObjects.RhinoObject

 

For Each obj_set In doc.Objects

guid_set.Add(obj_set.Id)

layer_idx_set.Add(obj_set.Attributes.LayerIndex)

obj_type_set.Add(obj_set.ObjectType.ToString)

Next

 

However, I'm looking to create a list of ALL the objects in my file for regular reference, not just the ones currently visible and on active layers.  The idea is to dynamically reference objects in GH without necessarily having them be visible in rhino.  Any help as to where I can access a list of all rhino objects in a 3dm file?

 

thanks!

 

Dave

Views: 807

Replies to This Discussion

Hilarious.  After looking for the last hour, just after posting I find in the SDK the right help:

 

Dim guid_set As New List(Of Guid)

Dim layer_idx_set As New List(Of Int32)

Dim obj_type_set As New List(Of String)


Dim settings As New Rhino.DocObjects.ObjectEnumeratorSettings()

settings.HiddenObjects = True


For Each obj_set As Rhino.DocObjects.RhinoObject In doc.Objects.GetObjectList(settings)

guid_set.Add(obj_set.Id)

layer_idx_set.Add(obj_set.Attributes.LayerIndex)

obj_type_set.Add(obj_set.ObjectType.ToString)

Next


guid_out = guid_set

layer_idx_out = layer_idx_set

obj_type_out = obj_type_set

 

All set here.

Hi Dave,

 

I agree that Objects should include hidden objects in addition to normal and locked objects. But it doesn't, so you'll need to use some EnumeratorSettings to specifically define the collection of objects you're interested in:

 

Dim enumerator As New Rhino.DocObjects.ObjectEnumeratorSettings ()   

enumerator.ActiveObjects = True   

enumerator.LockedObjects = True   

enumerator.HiddenObjects = True   

enumerator.NormalObjects = True   

enumerator.DeletedObjects = False   

enumerator.IncludeGrips = False   

enumerator.IncludePhantoms = False

Dim ids As New List(Of Guid)

For Each obj As Rhino.DocObjects.RhinoObject in doc.Objects.GetObjectList(enumerator)

  ids.Add(obj.Id)

Next


--

David Rutten

david@mcneel.com

Poprad, Slovakia

Ah, that's a more thorough list of enumerators I need to consider!  Thanks, David...sorry to trouble you!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service