Python derivativeat

I want to simply ‘shuffle’ the list. But the python code does not work in my case (random.shuffle).

And this is jitter component if you did not know.

Try print thing

1 Like

Jezus, I mean Graham, thank you! This took me some time. :smiley:
So stupid of mine.

:slight_smile: it’s like the difference between
a = sorted(3,1,2)
Returns [1,2,3]
And a = [3,1,2].sort()
Returns None

1 Like

Read here for LOTS more of these

3 Likes

@ForestOwl, do you remember the thread you created about vector.unitize()
You’re making the same mistake here. :slight_smile:

shuffle will modify the list and not create another one.
so not print a but rather print thing

1 Like

@stevebaer,

Can this,
image
be somehow fixed with the Rhino embedded python engine?
I can imagine huge problems can emerge if the coder is careless. :crazy_face:

1 Like

Just tried this in CPython 2.7:

True = False
True == False

True

True = not False
True == False

False

Yes, I read that since at the beginning there were no booleans in python in order to make them backportable they derived True and False from the int() class.

This made them mutable in all Python2 versions. Which was also transferred to IronPython.

I assumed since the C# connection they might have fixed that but unfortunately they didn’t. Perhaps this could be fixed somehow with the embedded engine bind it somehow to .net’s booleans. I don’t know. I’m not familiar with low level programming.

I’m not going to change this behavior.

5 Likes

And I think the Ironpython dev will focus on trying to finish 3.4 before he tries to ´fix’ 2.7

1 Like

I tried PointAt this time too, but it seems I am doing something wrong.
I have the curve length of 84, then I have a list of numbers between 0 and 84.

When I use PointAt, my points fly everywhere. Do you might know why?

problem derivativeat 07.gh (20.6 KB)

I find your code difficult to follow. It is good practice if you don’t use good descriptive names for the variables to place comments explaining what you’re trying to do.

Up to the part where you remove the duplate values from the list and you sort it everything is clear, but after that I really don’t get what you’re trying to do.

Thank you for saying, I changed it.

I hope it is more clear now.

I have a curve and I want to place points on it between 0 and the MAX length of the curve.
I made values and somehow by using PointAt, the points fly away. I do not yet understand why. Do you might know why my points are not on that curve?

problem derivativeat 08.gh (27.0 KB)

The parameter values you are randomly generating are outside the domain of the curve:

1 Like

image

Point at takes parameter not distance on the curve

1 Like

One of the components here does what you want.

It will be a good test to see if it works with multiple length values instead of the slider. I do not remember how I intended it to work :smiley:

I can fix it.

1 Like

I need python, does it not exist in python?

@ivelin.peychev @ivelin.peychev
Does one of you might know which places the points by length?

EDIT: never mind, I found it from a former post
Curve.PointAtLength Method

You’ll have to normalize the length if I remember correctly, keep that in mind

1 Like

No it seems it can be used without normalizing the length.

1 Like