Graph mapper in Python?


hi ,everyone, I was trying to implement graph mapper in python via
the latest ghpythonlib , however, I could not find the functions in the
library , so I wondering where I could find it or any extra library I need to add.
the current solution I have is : I have to go through the graph mapper component in
grasshopper, and give it a predefined amount of values which will be used for later calculation in
my scripting component. the shortage is when it comes to a situation with random amount,
this method would never work, it only works with fixed amount of values.
thank you all for help!!!

(Giulio Piacentino) #2

Hi dtw707

the technical limitation is that a graphmapper is not a GH_Component, that’s why it does not show up.
But even if it did, the useful functionality is only accessible after clicking a few times, so it would be difficult to really make it available as one function.

What were you trying to achieve? What functions where you trying to map?
It probably will not take very long to map sin, line, and a few of these functions just by using their equations?


Giulio Piacentino
for Robert McNeel & Associates


Hi Giulio, thank you so much for your reply, I agree equations would be the best way to solve it,just a bit intimidating, that’s why I was looking for something is more straightforward and graphic, thx again.

(Giulio Piacentino) #4

For example, the sin curve could be used like this:

import math
input = 10.0

def function_to_use(x):
    return math.cos(x * 0.2 + math.pi * 0.1) * 0.4 + 2.0

mapper  = function_to_use(input)
a = mapper```

Does it help?


Giulio Piacentino
for Robert McNeel & Associates


thank you, man, for sin or cos, the equation is not so hard, any ideas where I
can find the equation for something like Bezier or Sinc ? THX