The following compiler error happens, when trying to use the Item property of File3dmObjectTable. In the documentation
Item property returns a array object, type File3dmObject. What am I missing?
Jim
using Rhino;
using Rhino.Geometry;
using Rhino.FileIO;
using Rhino.DocObjects;
using Rhino.DocObjects.Tables;
path = String.Format("{0}BullFallsPlugin\\BullFallsProfiles\\Ring\\{1}3dm", BullFallsPlugIn.localRhinoDirectory, currentRingProfile);
Rhino.FileIO.File3dm file3Dm = new Rhino.FileIO.File3dm();
file3Dm = Rhino.FileIO.File3dm.Read( path );
File3dmObjectTable table = file3Dm.Objects;
var count = table.Count;
var obj = table.Item[0];
Severity Code Description Project File Line Suppression State
Error CS1061 ‘File3dmObjectTable’ does not contain a definition for ‘Item’ and no extension method ‘Item’ accepting a first argument of type ‘File3dmObjectTable’ could be found (are you missing a using directive or an assembly reference?) BullFalls C:\Users\jim\Documents\RhinoPlugin\C#\BullFalls\BullFalls\Operations.cs 357 Active
Changed the code to your suggestion and now get the following error message.
Jim
.
|Error|CS0021|Cannot apply indexing with [] to an expression of type ‘File3dmObjectTable’|BullFalls|C:\Users\jim\Documents\RhinoPlugin\C#\BullFalls\BullFalls\Operations.cs|356|Active|
Here is the function that is called from a tabbed panel.
The expanded path, String.Format, is listed in the code. This is the file location on my machine.
File3dmObjectTable.FindByLayer searches for objects by their layer name (only), not the full path name.
If you have a full path name, then you’ll need to recurse through the File3dmLayerTable until you find the required layer and pass that object to the File3dmObjectTable.FindByLayer override that take a Layer object.