Hi, everyone.
I have a little problem about divide curve in dynamo
First, id like to divide curve in segments by point, it is simple actually.
but i want to set some segment in different distance like that. ↓
and then i want to control the position value of a, b. ↓
Does anyone have an idea?
Thank you.
Best.
Thank you for reply
Actually the most import thing is control the position.
i want to change the position of a / b as shown above.
Thank you.
@ijka.junsuk
Can you post what you have done so far?
I’m not sure what you mean by changing the position of a/b?
i’m sorry for the poor explanation.
this is what i hav doing…
and this is what i want.but i want to control each length value(there are only 2 value),
(↓pic)which mean is i can change first a length to b length…(↓pic)
yes!!!
can you share for this code?
# by Alexander Berg | 2020-02-25 | Automated Design Solutions
def Repeat(count,item):
e = []
for i in range(0,count):
e.append(item)
return e
def Replace(data, indices, replacement):
return [replacement if i in indices else e for i, e in enumerate(data)]
# Accumulate credited to stackoverflow.com/a/33034961
def Accumulate(a):
return reduce(lambda c, x: c + [c[-1] + x], a, [0])[1:]
count,a,b,indices = IN
data = Repeat(count,a)
values = Replace(data,indices,b)
lengths = Accumulate(values)
lengths.insert(0,0)
OUT = lengths
2 Likes
pls help smt wrong… T.T
im not familiar with python script
You feeding a float (number with decimal points), but the repeat function utilizes range which works only with whole numbers (integers). The first input needs to be a whole number (1,4,6,10,2420 e.t.c.)
@ijka.junsuk if this solves your issue, please choose the solution so the topic can be closed.
1 Like