From Screenshot to GH Script with Raven AI

I came across a Post (by @Bogdan_Chipara) using chatGPT and thought: ‘Why not just use Raven?’ - the good thing about Raven is that you actually get a pure grasshopper script for your parametric model. Many people can’t read/write python, but with all native components, they are still able to edit the script afterwards.

This is the result of it:

Hope you like it :slight_smile:

Max

Hi @romtecmax ,
Thanks for checking my post!

Sometimes one might want to reduce the number of GH components used.
Instead of having 10-15 components just have one Python component replacing them.
You can easily copy-paste this component in different projects or parts of your GH definition.

To solve some problems you might need medium-high knowledge of GH or medium-high knowledge of Python. But with ChatGPT you need beginner knowledge of GH and beginner knowledge of Python.

What I dislike doing in GH is data management. Using Python is much more elegant. I am slow in Python, ChatGPT can write the code for me.

Quick example: Entwine tree branches and renumber them.

I asked ChatGPT:
In grasshopper I have 2 data trees with branches numbered {0} {1} {2} {3} {4} {5} each.
I want to weave the paths: {0} {0} {1} {1} {2} {2} {3} {3} {4} {4} {5} {5} and then renumber them: {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11}

It writes the following code, and what’s left to do is to copy-paste it in a Py component and set the inputs accordingly (Tree Access)

import Grasshopper as gh
from Grasshopper import DataTree
from Grasshopper.Kernel.Data import GH_Path

# entwine tree branches
# Output tree
GeoW = DataTree[object]()

# Get all paths from both trees TREE ACCESS
pathsA = GeoA.Paths
pathsB = GeoB.Paths

# Max number of path indices to consider
count = max(len(pathsA), len(pathsB))

new_index = 0  # this will be our new path index: {0}, {1}, {2}, ...

for i in range(count):
    # Take branch i from GeoA (if it exists) and add as {new_index}
    if i < len(pathsA):
        pathA = pathsA[i]
        branchA = GeoA.Branch(pathA)
        GeoW.AddRange(branchA, GH_Path(new_index))
        new_index += 1

    # Take branch i from GeoB (if it exists) and add as {new_index}
    if i < len(pathsB):
        pathB = pathsB[i]
        branchB = GeoB.Branch(pathB)
        GeoW.AddRange(branchB, GH_Path(new_index))
        new_index += 1

Need more examples? Just search this forum for “I asked ChatGPT” :star_struck:

You’re right - for some specific workflows, it makes sense to create custom components. Especially if you’re the only one using them. I was thinking more of broader workflows, like the one in the video. Such basic workflows (voronoi + point attractors) are repeated often, but every time a little different. Creating custom components might make sense for some part, but with Raven you can just create a custom script (more readable, user friendly and maintainable) each time.

Let’s see where the journey goes, I think we’re barely scratching the surface of what’s possible….

I produce examples and recipes for common problems.
Not that I expect everybody to use my solutions, the idea is to show and test how these kinds of problems can be solved using ChatGPT.
I wish I had these tools much sooner. Like many others, I learned GH the hard way, with long working hours and heavy deadlines.

@romtecmax Regarding Raven,
I am already good enough in GH+ChatGPT so I’m not so keen to use a paid solution.
Especially because by now I figured out most architectural elements.

For the reference: massing, m² distribution, slabs and ceilings, light fixtures, facades and panelling, windows, window frames, facade modules, modular structures, parapets, railings, balusters, curtain walls, mullions, louvers, perforated panels, cores, stairs, columns and beams, space trusses, vaults, ramps, topography, pavements, planters and benches, amphitheaters and tiered seating, furniture distributions such as office desk types, kitchen units.

Most of these are by now either custom userobjects or Python scripts which get modified for new designs, but it would be very cool to see them done by Raven.

The only thing missing is automated floorplans especially for housing.
Do you think Raven might work for floorplans somehow? (I don’t know how)

Another thing is that I already have too many subscriptions. I would rather pay for credits, or fixed timeframes like 6 months, 1 year without automated subscription renewal.

Maybe you can add more payment options. (also for students and interns :slight_smile: )

Have a great day!