Grasshopper

algorithmic modeling for Rhino

Working on my Project of CSV Component i found a problem that i dont find solution in the Internet or in the previous Discussions. 

i dont know why a list of suposed data in GH appears like a Iron Python Runtime List. 

here's the Code and a image of that's happening .

Views: 12082

Attachments:

Replies to This Discussion

Hi Toussaint,

Python Component cannot return lists of lists as an output. You should flatten the list, and then assign it to csvData... See Giulio's comment here.

If you want to have the lists separated you may want to use DataTrees and branch the data. Check this.

Mostapha

well lets see what i can do tomorrow cuz its over for tonight have to sleep and go to work tomorrow :( 

List of List 

once again Problem. 

i cant get the right understanding how to deal with list of list in GHPython to a correct solution. 

i Need Somebody Help!!!!!!!!!!!!!!!

make data trees! It's the only way that grasshopper can support lists of lists

 

 


# for accesssing GH classes
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree
dataTree = DataTree[object]()
for i, thing in enumerate(data):
branch_id = branch_ids[i]
path = GH_Path(branch_id)
dataTree.Add(thing, path)
a = dataTree

otra alternativa sería no usar split dentro del script, dejando cada linea como un "string" singular.

entonces, se puede usar el "split string" componente de Grasshopper para crear branches de los lists of lists.

i will see if i can solve it tomorrow 

https://github.com/tussyswat/dhda-it-code/tree/CSV-MANAGER/WIP

here's the code and files of my tools. 

4:33 am head blow off need to rest 

el split lo tengo que utilizar obligatoriamente, porque necesito indexar cada una de la informacion de los strings para poder Sortear por campos

i guess that a DataTree coding explanation for dummies will be so helpfull 

jejejeje who are encourage ?

Hello,

I have found this fantastic trick here:

https://willwang6.wixsite.com/precision/post/2017/12/02/ironpythonr...

It worked for me easily.

Fabio

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service