Grasshopper

algorithmic modeling for Rhino

ciao,

 I'm trying to understand why RhinoDocument.Objects doesn't contain hidden rhino objects.

but here's the weird thing: if I use RhinoDocument.Objects.Find() with an guid of an hidden object it works.

anyone know any way to get ALL the objects, including the hiddens, from the RhinoDoc?  

private void RunScript( ref object GO )
{

List<IGH_GeometricGoo> allGoo = new List<IGH_GeometricGoo>();

foreach (RhinoObject obj in RhinoDocument.Objects)
{
IGH_GeometricGoo goo = Grasshopper.Kernel.GH_Convert.ToGeometricGoo(obj.Id);
if (goo != null)
allGoo.Add(goo);
}

GO = allGoo;

}

private void RunScript(List<Guid> IDin, ref object GO)
{

List<IGH_GeometricGoo> allGoo = new List<IGH_GeometricGoo>();
List<RhinoObject> MyListOfObj = new List<RhinoObject>();


for (int i = 0 ; i < IDin.Count ;i++){
MyListOfObj.Add(RhinoDocument.Objects.Find(IDin[i]));
}

foreach (RhinoObject obj in MyListOfObj)
{
IGH_GeometricGoo goo = Grasshopper.Kernel.GH_Convert.ToGeometricGoo(obj.Id);
if (goo != null)
allGoo.Add(goo);
}

GO = allGoo;

}

Views: 848

Replies to This Discussion

ciao Tom, 

thanks a lot it works perfectly...

I changed only some little part in order to get out with RhinoObject as I did in the original script.

var object_enumerator_settings = new ObjectEnumeratorSettings();
object_enumerator_settings.IncludeLights = false;
object_enumerator_settings.IncludeGrips = false;
object_enumerator_settings.NormalObjects = true;
object_enumerator_settings.LockedObjects = true;
object_enumerator_settings.HiddenObjects = true;
object_enumerator_settings.ReferenceObjects = true;
object_enumerator_settings.SelectedObjectsFilter = false;
var selected_objects = RhinoDocument.Objects.GetObjectList(object_enumerator_settings).ToList();

List<RhinoObject> geom = new List<RhinoObject>();


for (int i = 0; i < selected_objects.Count; i++)
{
geom.Add(selected_objects[i]);
}

I wondered how to apply the selectionFilter on this.

Cant understand it.

something like that?

Thanks!

object_enumerator_settings.ObjectTypeFilter = Rhino.DocObjects.ObjectType.Curve;

thanks a lot David!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service