Grasshopper

algorithmic modeling for Rhino

Panel-String Guess and Proof in Grasshopper

Hey guys, I wanna share you my research about the type of data from PANEL component. For some Chinese who have read my tutorial file 《Grasshopper完全学习手册》may be familiar with this image:


From this I gave an inequation which I didn’t give a proof that time. My guess was that the type of the data was not “integer” but was “string”. Luckily, the inputs of many components in Grasshopper could automatically convert the type “string” into “integer” or “float”. However the Item Index cannot. I tried to proved this with Python and got a proof.

As you can see now, the type from Panel is always “str” which stands for string. So mark my words, it’s not a good habit to use panel to input data. You will never know which component could automatically convert your type of data into right type and which component doesn’t.

As for the reason why the negative 1 is outputted, I have no clue. From the research of @筑梦Naruto, the principle of Item Index is that it looks for the data’s position in memory. However I cannot tell you why this is “-1” but not “-2,-3”. If you have any idea please share it with me or Facebook me on www.facebook.com/daniel.jin.5817.

Views: 1148

Comment

You need to be a member of Grasshopper to add comments!

Comment by Kemin Liu on January 18, 2019 at 2:38am

Thank you Daniel! I have learnt a lot from your teaching material.

Comment by uiyr7s on February 4, 2016 at 6:51am

我去,你簡直是無處不在!!!

Comment by DanielJin on October 16, 2015 at 6:43am

原来如此,感谢告知!

Comment by Levin on October 15, 2015 at 6:02pm
因为代码里写了找不到,结果就为“-1”,仅此而已

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service