algorithmic modeling for Rhino
Hi all,
I'm wondering if I'm doing something wrong... The Grasshopper documentation outlines a few properties and methods, but I can't seem to make use of them. For example, the property "DataList" on an object of type GH_Structure:
http://developer.rhino3d.com/api/grasshopper/html/T_Grasshopper_Ker...
Tags:
i think it means you're missing that namespace. Are you using the GH Assembly template for visual studio? It doesn't have all the namespaces there by default. According to your link that class needs this namespace: using Grasshopper.Kernel.Data; so add that line to your namespaces.
HI Michael, I forgot to mention in my initial question, these are my references in that file:
using System;
using System.Linq;
using System.Collections.Generic;
using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;
using Rhino.Geometry;
Visual Studio code hints for the object (see screenshot), it just won't suggest/ can't find certain methods and properties.
It's a property with an indexer. That only works in VB, not C#. You can probably access the get_DataList() method though which is C#'s way of dealing with this.
Ah, okay, thanks David.
This didn't work for me - but looking at the documentation it appears this DataList property in vb is covered by the [ ] accessor in c# - so instead of structure.DataList[i] or structure.get_DataList(i) you just call structure[i]. See how it's indicated with keyword "this" in the C# representation:
public List<T> this[int index ] { get; }
On the other hand, the other property accessor "DataItem" does appear to work as david is describing in c# - meaning you have to call structure.get_DataItem(i).
Thanks Andrew, I've been experimenting
Posted a screenshot of findings, in case it helps anyone in the future
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson.
Powered by