Hi all,
When I for example have 3 objects named A,B and C. Put them in a block and get doc.Objects. None are found because they are in doc.InstanceDefinitions - getobjects.
But when I EditBlock Rename object A with D, A is still found when I loop doc.Objects until I leave EditBlock. Why? Because A doesn’t exist anymore.
Example Code (all items found are in the list called Names):
Dim Names As New List(Of String)
Dim Obj = doc.Objects
For Each o In Obj
If o.ObjectType <> DocObjects.ObjectType.InstanceDefinition And o.ObjectType <> DocObjects.ObjectType.InstanceReference Then
If Names.Contains(o.Attributes.Name) = False And o.Attributes.Name <> "" Then
Names.Add(o.Attributes.Name)
End If
End If
Next
For Each Block As Rhino.DocObjects.InstanceDefinition In doc.InstanceDefinitions
For Each o As DocObjects.RhinoObject In Block.GetObjects
If o.ObjectType <> DocObjects.ObjectType.InstanceDefinition And o.ObjectType <> DocObjects.ObjectType.InstanceReference Then
If Names.Contains(o.Attributes.Name) = False And o.Attributes.Name <> "" Then
Names.Add(o.Attributes.Name)
End If
End If
Next
Next