Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5746

Convert to List

$
0
0

@giacomo_forcina wrote:

Hello,

I am practicing with C# scripting:

What I want to do is to store some branches (which are list of points) inside a List of List
but I get error saying:

  1. Unable to cast object of type ‘System.Collections.Generic.List1[System.Object]' to type 'System.Collections.Generic.List1[Rhino.Geometry.Point3d]’. (line: 69)

Code below

Blockquote

List seriesPts = new List ();
for (int i = 1; i < x.BranchCount - 1; i++)
{
seriesPts.Add((List) x.Branch(i));
}
for (int i = 0; i < seriesPts.Count; i += 2)
{

  List <Point3d> tempA = (List <Point3d>) (seriesPts[i]);    // line 69 error here
  List <Point3d> tempB = (List <Point3d>) (seriesPts[i + 1]);
  List <object> tempCrv = new List <object>();
  int index = 0;
}

Blockquote

How can I make it?

Thanks in advance.

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5746

Trending Articles