I’ve made a function in Python that makes a negative curve parameter “wrap” the curve (so, basically, if t is negative, subtract t from max of curve domain).
For context, I have a working knowledge of Python, but I’m not very experienced, and this is my first attempt at using the Grasshopper library in Python. (I’m also open to solutions using C# if it would be better suited to solving my issue)
The Python script works just fine with item access when the input is a single curve with a number of curve parameter inputs, or with multiple curves when the lists of curves and parameters are made to align before going into the python component.
I’m struggling to get the function to work with tree access for the tree structure I would like to be able to input and would appreciate any help / advice / examples that may be helpful.
Here is my goal data matching, with the colored x’s being items, the left side being the input curves and the right being the parameter values:
The GH definition I’m working in is using this python component to cull points from a curve when they result in an angle that doesn’t meet a set tolerance – the file has three iterations inside it:
The first is taking in one curve and a basic tree of parameters, using item access, getting a working result.
The second is taking in a grafted list of curves, and a more complex tree of parameters, using item access the data does not match in Python as intended.
The third uses a workaround in GH that duplicates data in the list of curves to match the list of parameters before going into Python, so that the Python script will work with item access. This is working fine for what I need it to do, but it would be great to figure out how to solve this problem in Python.
I’ve also left in my attempt at getting the script to work with tree access. It makes sense in my head but I’ve hit a point where I’m struggling to make sense of the errors I’m getting and some alternative opinions could really help.
Thanks
EVAL CURVE WRAP TEST.gh (90.9 KB)