New ghPython with Node-in-Code™ and Multi-threading - Grasshopper2024-03-29T11:31:47Zhttps://www.grasshopper3d.com/forum/topics/new-ghpython-with-node-in-codem-and-multi-threading?commentId=2985220%3AComment%3A974509&feed=yes&xn_auth=noHi there,
I am trying to use…tag:www.grasshopper3d.com,2015-11-09:2985220:Comment:13970822015-11-09T21:32:30.117Zstevedemicolihttps://www.grasshopper3d.com/profile/stevedemicoli
<p>Hi there,</p>
<p>I am trying to use the "Group Points by distance" command with ghpython.<br></br>The ghcomp.PointGroups manages to order the list of points I am feeding it, however it does not create sub-lists (branches) for each group.</p>
<p>In the image below, the panel on the left is from the ghcomp script, while on the right it is using standard gh components. I would like to do this within ghpython if possible. As the image displays, the script is working well, however I need to have…</p>
<p>Hi there,</p>
<p>I am trying to use the "Group Points by distance" command with ghpython.<br/>The ghcomp.PointGroups manages to order the list of points I am feeding it, however it does not create sub-lists (branches) for each group.</p>
<p>In the image below, the panel on the left is from the ghcomp script, while on the right it is using standard gh components. I would like to do this within ghpython if possible. As the image displays, the script is working well, however I need to have nested lists in order to make any use of the command.</p>
<p>Any advice would be greatly appreciated!</p>
<p></p>
<p>I have also posted this same question on the Rhino Forum.</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769055618?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769055618?profile=RESIZE_1024x1024" width="721" class="align-left"/></a></p>
<p></p> I don't know if this is the p…tag:www.grasshopper3d.com,2014-01-10:2985220:Comment:9871872014-01-10T14:18:40.925ZRasmus Holsthttps://www.grasshopper3d.com/profile/RasmusHolst
<p>I don't know if this is the place to post this. I am very exited about this new functions. But I recently noticed that the gh.SurfaceClosestPt seems to be working a lot slower than by using rhinoscriptsyntax, where one has to use 3 commands if you want to get the point and the distance.</p>
<p>(That's how I do it any way - rs.SurfaceClosestPoint - rs.EvaluateSurface - rs.Distance)</p>
<p>There might be a really good explanation, but I was just wondering if it might be a bug?</p>
<p>I don't know if this is the place to post this. I am very exited about this new functions. But I recently noticed that the gh.SurfaceClosestPt seems to be working a lot slower than by using rhinoscriptsyntax, where one has to use 3 commands if you want to get the point and the distance.</p>
<p>(That's how I do it any way - rs.SurfaceClosestPoint - rs.EvaluateSurface - rs.Distance)</p>
<p>There might be a really good explanation, but I was just wondering if it might be a bug?</p> Agree with that. There should…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9778592013-12-23T15:22:35.431Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Agree with that. There should be an error message, that supplied data is not of a required type.</p>
<p></p>
<p>@ Arturs Tols:<br/>Thank you. You too.</p>
<p>Agree with that. There should be an error message, that supplied data is not of a required type.</p>
<p></p>
<p>@ Arturs Tols:<br/>Thank you. You too.</p> Awesome, thank you. It's not…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9777782013-12-23T15:00:45.380ZArturs Tolshttps://www.grasshopper3d.com/profile/ArtursTols
<p>Awesome, thank you. <br/>It's not easy to find tutorials on this subject as google mostly churns out info on python in general.<br/><br/>Have a great holiday, djordje!</p>
<p>Awesome, thank you. <br/>It's not easy to find tutorials on this subject as google mostly churns out info on python in general.<br/><br/>Have a great holiday, djordje!</p> Hi Arturs,You are using a rhi…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9779212013-12-23T14:37:55.977Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Hi Arturs,<br></br><br></br>You are using a rhinoscriptsyntax function <a href="http://4.rhino3d.com/5/ironpython/functions/addline.htm" target="_blank">AddLine()</a> to generate your line. This function returns a guid (an object identifier), whereas your ghpythonlib.component function EvaluateLength requires curve object, as it's first argument. Take a look at <a href="http://www.grasshopper3d.com/xn/detail/2985220:Comment:971771" target="_blank">this discussion</a>, somewhat similar questions…</p>
<p>Hi Arturs,<br/><br/>You are using a rhinoscriptsyntax function <a href="http://4.rhino3d.com/5/ironpython/functions/addline.htm" target="_blank">AddLine()</a> to generate your line. This function returns a guid (an object identifier), whereas your ghpythonlib.component function EvaluateLength requires curve object, as it's first argument. Take a look at <a href="http://www.grasshopper3d.com/xn/detail/2985220:Comment:971771" target="_blank">this discussion</a>, somewhat similar questions appeared there.<br/>So what needs to be done is to feed the guid of your _line curve into the rs.coercecurve() function, in order to create a curve object. Then feed that into ghcomp.EvaluateCurve:<br/><br/></p>
<blockquote><p>import rhinoscriptsyntax as rs<br/>import scriptcontext<br/>import ghpythonlib.components as ghcomp<br/><br/>_line = rs.AddLine(y,z)<br/>line_object = rs.coercecurve(_line)<br/><br/>b = ghcomp.EvaluateLength(u,0.5).point<br/><br/>a = _line<br/><br/>c = ghcomp.EvaluateLength(line_object,0.3).point<br/><br/><br/></p>
</blockquote>
<p>You can also try not to puzzle yourself whether you are supplying guid or an object, by simply using a ghcomp function for creating a line, instead of rhinoscriptsyntax AddLine one:</p>
<blockquote><p>import rhinoscriptsyntax as rs<br/>import scriptcontext<br/>import ghpythonlib.components as ghcomp<br/><br/>_line = ghcomp.Line(y,z)<br/><br/>b = ghcomp.EvaluateLength(u,0.5).point<br/><br/>a = _line<br/><br/>c = ghcomp.EvaluateLength(_line,0.3).point<br/><br/></p>
</blockquote>
<p>Please attach your files for future questions.</p> Here I am again,I'm sorry I'm…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9777742013-12-23T13:47:37.028ZArturs Tolshttps://www.grasshopper3d.com/profile/ArtursTols
<p>Here I am again,<br></br><br></br>I'm sorry I'm hijacking the thread to solve this, but it really seems bizarre as I can't explain what's going on. The line I generate inside the python script seems fine but it doesn't generate any output compared to a line I supply in the inputs?? Is there some generic typecast I am missing?…<br></br><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768857576?profile=original" target="_self"><img class="align-left" src="http://storage.ning.com/topology/rest/1.0/file/get/2768857576?profile=RESIZE_1024x1024" width="721"></img></a></p>
<p>Here I am again,<br/><br/>I'm sorry I'm hijacking the thread to solve this, but it really seems bizarre as I can't explain what's going on. The line I generate inside the python script seems fine but it doesn't generate any output compared to a line I supply in the inputs?? Is there some generic typecast I am missing?<br/><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768857576?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768857576?profile=RESIZE_1024x1024" width="721" class="align-left"/></a></p> Yes, there are but mostly rel…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9778482013-12-23T12:10:10.280Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Yes, there are but mostly related to scripting in Rhino Python Editor.<br/>Check the <a href="http://www.rhino3d.com/download/IronPython/5.0/RhinoPython101" target="_blank">Rhino Python primer</a> and <a href="http://wiki.mcneel.com/developer/python" target="_blank">tutorials</a> from Mcneel's wiki website.</p>
<p>Yes, there are but mostly related to scripting in Rhino Python Editor.<br/>Check the <a href="http://www.rhino3d.com/download/IronPython/5.0/RhinoPython101" target="_blank">Rhino Python primer</a> and <a href="http://wiki.mcneel.com/developer/python" target="_blank">tutorials</a> from Mcneel's wiki website.</p> Works great, thanks!
I had no…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9777662013-12-23T12:00:05.643ZArturs Tolshttps://www.grasshopper3d.com/profile/ArtursTols
<p>Works great, thanks!</p>
<p>I had no idea I had to do that. Are there any sources I could read to get to know more about python scripting in Rhino?<br/><br/>Cheers</p>
<p>Works great, thanks!</p>
<p>I had no idea I had to do that. Are there any sources I could read to get to know more about python scripting in Rhino?<br/><br/>Cheers</p> Seems like you did not change…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9778232013-12-23T09:39:15.804Zdjordjehttps://www.grasshopper3d.com/profile/djordje
<p>Seems like you did not change the "x" input's object type from "ghDoc object" to "Curve".<br/>Does that solve the problem?</p>
<p>Seems like you did not change the "x" input's object type from "ghDoc object" to "Curve".<br/>Does that solve the problem?</p> Hi!I was very excited to star…tag:www.grasshopper3d.com,2013-12-23:2985220:Comment:9777252013-12-23T05:39:08.101ZArturs Tolshttps://www.grasshopper3d.com/profile/ArtursTols
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768857465?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768857465?profile=RESIZE_1024x1024" width="721" class="align-full"/></a>Hi!<br/><br/>I was very excited to start using the new scripts, but for some reason it just doesn't work for me.<br/>Any ideas what I might be doing wrong? <br/><br/>Thanks</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2768857465?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2768857465?profile=RESIZE_1024x1024" width="721" class="align-full"/></a>Hi!<br/><br/>I was very excited to start using the new scripts, but for some reason it just doesn't work for me.<br/>Any ideas what I might be doing wrong? <br/><br/>Thanks</p>