I’m currently working on creating a custom Grasshopper (GH) component aimed at seamlessly importing floor elements from Revit into Rhino. To facilitate this process, I’ve developed a class library where I’ve defined wrapper classes such as AreaElement, FrameElement, and ColumnElement.
One of the core classes within this library is the AreaElement class, structured as follows:
csharpCopy code
public class Area
{
// Region properties
public List<Point> Vertices { get; set; }
public List<string> Groups { get; set; }
public ElementId RevitElementId { get; set; }
public string Section { get; set; }
public string Type { get; set; }
public List<Rhino.Geometry.Curve> CrvList { get; set; }
}
However, during the implementation of my Grasshopper component in C#, I encountered an issue. Despite defining the crvList property within the Area class, attempting to access it resulted in a runtime error indicating that no such property existed within the class.
Here’s a snippet of the method where the problem arises:
csharpCopy code
public static void GetRevitAreas2(
UIDocument uidoc, Document doc, ForgeTypeId dis, ref List<ClassesDefintions.Area> areas)
{
// Collecting structural floors
List<Floor> structuralFloors = new List<Floor>();
FilteredElementCollector collector = new FilteredElementCollector(doc);
ICollection<Element> elementsOfType = collector.OfClass(typeof(Floor)).ToElements();
foreach (Element elem in elementsOfType)
{
Floor floor = elem as Floor;
Area a = new ClassesDefintions.Area();
var analyModel = floor.GetAnalyticalModel();
if (analyModel != null)
{
structuralFloors.Add(floor);
a.Section = floor.FloorType.ToString();
a.RevitElementId = floor.Id;
Sketch s = doc.GetElement(floor.SketchId) as Sketch;
CurveArrArray crvArray = s.Profile;
List<Rhino.Geometry.Curve> rhinoCrvs = RhinoInside.Revit.Convert.Geometry.GeometryDecoder
.ToCurveMany(crvArray)
.ToList();
a.CrvList = rhinoCrvs;
areas.Add(a);
}
}
}
I’m seeking guidance on resolving this runtime error.