# Convert grasshopper script into python

**URL:** <https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293>\
**Category:** Grasshopper\
**Tags:** rhinopython, help, python, rhino6, grasshopperrhino\
**Created:** [May 16, 2021, 7:03pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293 "2021-05-16T19:03:50Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 7:03pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/1 "2021-05-16T19:03:50Z")

</div>

Could anyone help me convert a grasshopper script into python? Its a short and simple script. i can compensate! Thanks so much!

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [May 16, 2021, 8:53pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/2 "2021-05-16T20:53:02Z")

</div>

What does your Grasshopper script look like?

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 9:07pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/3 "2021-05-16T21:07:12Z")

</div>

[Panels Grasshopper Script Final.gh](https://discourse.mcneel.com/uploads/short-url/yT3j5WKjp4iD8JY6Fwm81Gklk7y.gh) (16.7 KB)  
Doesnt let me post a ong of it but here it is

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 9:07pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/4 "2021-05-16T21:07:46Z")

</div>

its a very simple script, need help urgently ☹

---

<div class="post-metadata">

**Author:** ![Rickson](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/rickson/32/690545_2.png) [@Rickson](https://discourse.mcneel.com/u/Rickson)\
**Post date:** [May 16, 2021, 9:14pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/5 "2021-05-16T21:14:32Z")

</div>

You didn’t internalize your geometry.

What have you started in Python already? Is the intent to run from Rhino or Grasshopper? This would require scripting a lot of already scripted components, any particular part that you are looking for?

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 9:30pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/6 "2021-05-16T21:30:44Z")

</div>

[Panels Reference Lines on Rhino.3dm](https://discourse.mcneel.com/uploads/short-url/wGtQUpH8BimxWt4ts0qdUWAIhwU.3dm) (42.0 KB)  
I have nothing in python, I don’t know how to use it, but my partner wants to visualize the script in ghpython component. It might not be efficient or something, but I just need to get it translated to python

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 9:49pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/8 "2021-05-16T21:49:13Z")

</div>

I just googled and managed to internalize all data, here it is! I started using rhino a week ago and grasshopper 2 days go so sorry, I’m learning  
[Panels Grasshopper Script Final.gh](https://discourse.mcneel.com/uploads/short-url/qXVNDNwRHvklbdyofNm2mwpuH60.gh) (16.7 KB)

---

<div class="post-metadata">

**Author:** ![Konrad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/konrad/32/765650_2.png) [@Konrad](https://discourse.mcneel.com/u/Konrad)\
**Post date:** [May 16, 2021, 10:01pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/9 "2021-05-16T22:01:15Z")

</div>

Hi,  
is there a special reason for rewriting it in python? I will be a lot of work, basically you’ll have to rebuild the logic one to one with the [python functions](https://developer.rhino3d.com/api/RhinoScriptSyntax/)

edit:

> wants to visualize the script in ghpython component.

the script should be visualized? I would say grasshopper is a better visual scripting environment than python or does this refer to the output of the script?

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 10:18pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/10 "2021-05-16T22:18:38Z")

</div>

[Panelization.gh](https://discourse.mcneel.com/uploads/short-url/hC3FV0mUpIrI2pTw1a4LHJHKEV4.gh) (548.5 KB)  
here is an example of what I I’m trying to do with my file. I’m just learning rhino and grasshopper so I don’t really understand much, that why I’m looking for help to do it

---

<div class="post-metadata">

**Author:** ![Konrad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/konrad/32/765650_2.png) [@Konrad](https://discourse.mcneel.com/u/Konrad)\
**Post date:** [May 16, 2021, 10:38pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/11 "2021-05-16T22:38:24Z")

</div>

you could always use a cluster for packaging multiple gh compontens into one element, if it’s that what you want (still not sure)

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/d/2/d/d2d00de9dd3f239aa5b85c606dfc4d4631fb47ac.png)  
[Panels Grasshopper Script Final\_konrad.gh](https://discourse.mcneel.com/uploads/short-url/zNorcizMwA0pEPKFVdGIsyDpMNX.gh) (249.1 KB)  
to do this select the components you want to cluster \> right click \> cluster

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 10:49pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/12 "2021-05-16T22:49:39Z")

</div>

No, the grasshopper file is complete how it is, my partner wants to visualize it in python, like the last GH file I sent you, as a way of exploring programming software, not about efficiency or productivity.

---

<div class="post-metadata">

**Author:** ![Konrad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/konrad/32/765650_2.png) [@Konrad](https://discourse.mcneel.com/u/Konrad)\
**Post date:** [May 16, 2021, 10:57pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/13 "2021-05-16T22:57:08Z")

</div>

You want to explore programming software but ask here for others to do it for you. If you are interested in exploring / learning the software I would suggest looking at the [developer docs](https://developer.rhino3d.com/). If on the other hand there is a specific problem you are struggeling with, have a look here: [Help Us Help You](https://discourse.mcneel.com/t/help-us-help-you/50034/1)

---

<div class="post-metadata">

**Author:** ![sxs3285](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/sxs3285/32/183782_2.png) [@sxs3285](https://discourse.mcneel.com/u/sxs3285)\
**Post date:** [May 16, 2021, 11:40pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/14 "2021-05-16T23:40:46Z")

</div>

Yes I was just tasked to get the file converted to python, but I don’t know how to use that so I’m looking for someone to help me do it. Not to learn myself. You think you or someone can help? Thanks!

---

<div class="post-metadata">

**Author:** ![Gijs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/gijs/32/769882_2.png) [@Gijs](https://discourse.mcneel.com/u/Gijs)\
**Post date:** [May 17, 2021, 7:37am UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/15 "2021-05-17T07:37:27Z")

</div>

You can post your request in the jobs section of the forum, just put it in the right category.

---

<div class="post-metadata">

**Author:** ![jordi.arcas](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/jordi.arcas/32/575651_2.png) [@jordi.arcas](https://discourse.mcneel.com/u/jordi.arcas)\
**Post date:** [May 17, 2021, 10:44am UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/16 "2021-05-17T10:44:57Z")

</div>

Are you looking for something like this in python? We could then do a simple offset or extrusion.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/e/1/2e1c83bafe0bb55446e051ef81c9452a2b6df105.jpeg)

---

<div class="post-metadata">

**Author:** ![vectorabc](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vectorabc/32/345219_2.png) [@vectorabc](https://discourse.mcneel.com/u/vectorabc)\
**Post date:** [May 17, 2021, 2:19pm UTC](https://discourse.mcneel.com/t/convert-grasshopper-script-into-python/124293/17 "2021-05-17T14:19:22Z")

</div>

This looks fun but I’m at work full time so have little extra time.

The first issue I notice is that the Populate node has no equivalent in Rhinocommon so cannot simply be recreated in Python without an algorithm so you’ll get a random pattern instead really, if you do it simply, whereas Grasshopper Populate is a slow algorithm that spaces things out much more evenly than just random points do.

> [@Populate geometry in rhinocommon?](https://discourse.mcneel.com/t/populate-geometry-in-rhinocommon/75724):
>
> Hi all. I need to populate a mesh with points in a c# script. (just on the surface, not the volume) There is a way to access the “Populate geometry” function from a script? Thanks in advance Riccardo
