algorithmic modeling for Rhino
Hi everybody,
I am using the next script to select objects from specific layers but I didn´t manage to select objects from hidden layers. I am selecting and baking a huge bunch of objects and it´s quite cumbersome to have those layers on. Any help?
Cheers
private void RunScript(bool start, string layer, ref object A, ref object done, ref object layer_name)
{
if (start)
{
for (int i = 0; i <= 1; i++)
{
int layer_index = doc.Layers.Find(layer, true);
if (layer_index < 0)
{
continue;
}
Rhino.DocObjects.Layer lay = new Rhino.DocObjects.Layer();
lay = doc.Layers[layer_index];
List<Rhino.DocObjects.RhinoObject> objs = new List<Rhino.DocObjects.RhinoObject>(doc.Objects.FindByLayer(lay));
if (objs.Count < 0)
{
continue;
}
List<GeometryBase> geo = new List<GeometryBase>();
foreach (Rhino.DocObjects.RhinoObject obj in objs)
{
geo.Add(obj.Geometry);
}
A = geo;
bool ok = false;
if (geo.Count > 0)
{
ok = true;
}
done = ok;
layer_name = layer;
}
}
}
Tags:
private void RunScript(bool start, string layer, ref object A, ref object done)
{
if (!start) { return; }
Rhino.DocObjects.RhinoObject[] objs = doc.Objects.FindByLayer(layer);
if (objs == null) { return; }
if (objs.Length == 0) { return; }
List<IGH_Goo> geo = new List<IGH_Goo>();
foreach (Rhino.DocObjects.RhinoObject obj in objs)
{
IGH_Goo goo = GH_Convert.ToGeometricGoo(obj.Id);
if (goo != null) { geo.Add(goo); }
}
A = geo;
done = (geo.Count > 0);
}
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by