algorithmic modeling for Rhino
I'm having trouble using the code segment "doc.Objects.FindByLayer" in Visual Studio. The code worked perfectly in the native c# component environment.
Help is certainly welcome.
// Working code in native c# component
Rhino.DocObjects.Layer lyr = doc.Layers[index];
Rhino.DocOjbects.RhinoObject[] objs = doc.Objects.FindByLayer(lyr);
// Code that was attempted in Visual Studio, c# (namespace errors)
Rhino.DocObjects.Layer lyr = Rhino.DocObjects.ActiveDoc.Layers[index];
Rhino.DocOjbects.RhinoObject[] objs = Rhino.DocObject.Tables.ObjectTable.FindByLayer(lyr);
Tags:
Maybe try to define "doc" first...
var doc = RhinoDoc.ActiveDoc;
In the component its defined within the Script_Instance class
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by