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);
Maybe try to define "doc" first...
var doc = RhinoDoc.ActiveDoc;
In the component its defined within the Script_Instance class
Defining "doc" did the trick - thanks!