Get left side values from Value List components - Grasshopper2024-03-29T13:23:13Zhttps://www.grasshopper3d.com/forum/topics/get-left-side-values-from-value-list-components?commentId=2985220%3AComment%3A1709617&x=1&feed=yes&xn_auth=noyou need the python plugin fo…tag:www.grasshopper3d.com,2017-03-10:2985220:Comment:17096172017-03-10T19:38:31.049ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>you need the python plugin for Grasshopper. <a href="http://www.food4rhino.com/app/ghpython" target="_blank">http://www.food4rhino.com/app/ghpython</a></p>
<p>you need the python plugin for Grasshopper. <a href="http://www.food4rhino.com/app/ghpython" target="_blank">http://www.food4rhino.com/app/ghpython</a></p> Hi Brian,
When I dragged the…tag:www.grasshopper3d.com,2017-03-10:2985220:Comment:17096112017-03-10T17:46:37.826ZWenyao Jiahttps://www.grasshopper3d.com/profile/WenyaoJia
<p>Hi Brian,</p>
<p></p>
<p>When I dragged the Wombat ghuser file in, it says The User Object could not be created as the base type is missing.</p>
<p>Hi Brian,</p>
<p></p>
<p>When I dragged the Wombat ghuser file in, it says The User Object could not be created as the base type is missing.</p> Hi Wenyao, that's the "Value…tag:www.grasshopper3d.com,2017-03-10:2985220:Comment:17095392017-03-10T17:23:47.886ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>Hi Wenyao, that's the "Value List Selected Value" output shown in the image above, which is available in the *.ghuser download link above.</p>
<p>Hi Wenyao, that's the "Value List Selected Value" output shown in the image above, which is available in the *.ghuser download link above.</p> Hi Brian,
I was searching fo…tag:www.grasshopper3d.com,2017-03-10:2985220:Comment:17095112017-03-10T13:37:11.673ZWenyao Jiahttps://www.grasshopper3d.com/profile/WenyaoJia
<p>Hi Brian,</p>
<p></p>
<p>I was searching for how to extract the data from the left side of the Value list and I bumped into your post here.</p>
<p></p>
<p>I have a more specific request as I only want to extract the <strong>current(or the selected/checked)</strong> value of the left side instead of all the left side values.</p>
<p></p>
<p>I personally don't know much about Python, so I thought I could use the power of all the smart brains on the forum here.</p>
<p></p>
<p>Could anyone help…</p>
<p>Hi Brian,</p>
<p></p>
<p>I was searching for how to extract the data from the left side of the Value list and I bumped into your post here.</p>
<p></p>
<p>I have a more specific request as I only want to extract the <strong>current(or the selected/checked)</strong> value of the left side instead of all the left side values.</p>
<p></p>
<p>I personally don't know much about Python, so I thought I could use the power of all the smart brains on the forum here.</p>
<p></p>
<p>Could anyone help me with that?</p>
<p></p>
<p>Many many thanks in advance!</p> Here's the user object.tag:www.grasshopper3d.com,2015-09-17:2985220:Comment:13638412015-09-17T16:38:39.690ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>Here's the user object.</p>
<p>Here's the user object.</p> Hey everyone thanks for your…tag:www.grasshopper3d.com,2015-09-17:2985220:Comment:13635912015-09-17T16:37:34.531ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>Hey everyone thanks for your help with this - credit given to Matt and Andrew in the script header.</p>
<p>Please see attached for the latest Wombat Value List Data user object.</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769038203?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769038203?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p>
<p>Hey everyone thanks for your help with this - credit given to Matt and Andrew in the script header.</p>
<p>Please see attached for the latest Wombat Value List Data user object.</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769038203?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769038203?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></p> Hey Brain,
I did some tinkeri…tag:www.grasshopper3d.com,2015-06-18:2985220:Comment:13109522015-06-18T00:55:03.594ZMatt McDonnellhttps://www.grasshopper3d.com/profile/MatthewMcDonnell
<p>Hey Brain,</p>
<p>I did some tinkering and found you can call 'SelectedItems' on your obj which will return a list of the currently checked keys. You can use this to get the index(s) that are selected by comparing it to your 'ListItems'.</p>
<p></p>
<blockquote><p>selectedKeys = [item.Name for item in valList.SelectedItems]</p>
<p>keys = [item.Name for item in valList.ListItems]</p>
<p>values = [item.Value for item in valList.Values]</p>
</blockquote>
<p></p>
<p>You should be able to put…</p>
<p>Hey Brain,</p>
<p>I did some tinkering and found you can call 'SelectedItems' on your obj which will return a list of the currently checked keys. You can use this to get the index(s) that are selected by comparing it to your 'ListItems'.</p>
<p></p>
<blockquote><p>selectedKeys = [item.Name for item in valList.SelectedItems]</p>
<p>keys = [item.Name for item in valList.ListItems]</p>
<p>values = [item.Value for item in valList.Values]</p>
</blockquote>
<p></p>
<p>You should be able to put together a dict (key/value) from that.</p>
<p>*Note the values are a mixed bag as they come out as either GH_integers or GH_Numbers but shouldn't matter once you've assigned it to your component output.</p> What would be interesting wou…tag:www.grasshopper3d.com,2015-06-17:2985220:Comment:13107232015-06-17T17:48:56.596ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>What would be interesting would be to limit the output to the selected list index.</p>
<p>Is there a method for the object, like ListItems, that would extract the currently selected index from the component?</p>
<p>Basically I want to be able to use the Value List component as a Key/Value search component because it's a better interface.</p>
<p>Man, someone should really work on some custom UI stuff for Grasshopper...</p>
<p>What would be interesting would be to limit the output to the selected list index.</p>
<p>Is there a method for the object, like ListItems, that would extract the currently selected index from the component?</p>
<p>Basically I want to be able to use the Value List component as a Key/Value search component because it's a better interface.</p>
<p>Man, someone should really work on some custom UI stuff for Grasshopper...</p> Oops I broke it when I saved…tag:www.grasshopper3d.com,2015-06-17:2985220:Comment:13107102015-06-17T15:45:15.886ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>Oops I broke it when I saved it as a user object.</p>
<blockquote><p>Runtime error (MissingMemberException): 'list' object has no attribute 'Add'</p>
</blockquote>
<p>Fixed it by adding "import Grasshopper" on line 1.</p>
<p>Userobj attached.</p>
<p>Oops I broke it when I saved it as a user object.</p>
<blockquote><p>Runtime error (MissingMemberException): 'list' object has no attribute 'Add'</p>
</blockquote>
<p>Fixed it by adding "import Grasshopper" on line 1.</p>
<p>Userobj attached.</p> Cool thanks Andrew. They didn…tag:www.grasshopper3d.com,2015-06-17:2985220:Comment:13105662015-06-17T15:24:22.641ZBrian Ringleyhttps://www.grasshopper3d.com/profile/bringley
<p>Cool thanks Andrew. They didn't work as is. I had to poke the document with a stick on line 1.</p>
<blockquote><p>ghdoc = ghenv.Component.OnPingDocument()</p>
<p></p>
</blockquote>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769005039?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769005039?profile=RESIZE_1024x1024" width="721" class="align-left"/></a></p>
<p></p>
<p></p>
<p></p>
<p>Gh def attached.</p>
<p>Cool thanks Andrew. They didn't work as is. I had to poke the document with a stick on line 1.</p>
<blockquote><p>ghdoc = ghenv.Component.OnPingDocument()</p>
<p></p>
</blockquote>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769005039?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769005039?profile=RESIZE_1024x1024" width="721" class="align-left"/></a></p>
<p></p>
<p></p>
<p></p>
<p>Gh def attached.</p>