Grasshopper

algorithmic modeling for Rhino

Hallo,

How to use the Grasshopper cross Reference within a VB.net script component?

Best Richard

Views: 790

Replies to This Discussion

Within?

--

David Rutten

david@mcneel.com

within a VB.net script component ?

you can't refer to Gh components in vb.net or c# components. You can in the latest release of python. But all the cross reference operations can be accomplished with simple nested loops. A simple holistic cross reference between two lists A and B would look like this:

List<Object> AOut = new List<Object>();
List<Object> BOut = new List<Object>();

for (int i=0;i<A.Length;i++){
for(int j=0;j<B.Length;j++){
AOut.Add(A[i]);
BOut.Add(B[j]);
}

}

well that only cross references two lists ...

I would need it with a variable number of lists  

however solved the issue manually:

Can send the code if any interest.

Every additional list will require an additional nested loop.

--

David Rutten

david@mcneel.com

Somehow yes ...

However found this: 

http://www.cut-the-knot.org/do_you_know/AllPerm.shtml

works perfect...

n.m.: it seems the native CrossReference component has the loops switched/swapped:  
for (int j=0;j<B.Length;j++){     
for (int i=0;i<A.Length;i++){     

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service