generative modeling for Rhino
I have a bunch of curves in a list and a bunch of 3dpoints in a list.
some of the 3dpoints are on the curve and some are not.
I am writting a script that whenever the point is on the curve, it will split the curve.
Somehow the splitcurve in python doesnt work in the nested list i have, I tried working it out without the nested list and it works.
Attached are images on the problem I am encountering and I hope someone can help me!
I have tested that the curves and parameters are right, but they just wont split.
I tried using the rs.command to utilize split the conventional rhino way, buts its tough to select the points after running the command with split.
Please help me!! S.O.S!!
Thanks in advance!
python isn't my strong suit, what you need to do is measure the distance from each point to each curve, if that distance is less than, say, 1e-6 then the point can be said to be coincident with the curve. You should also check to make sure that the point isn't near the end of the curve, as splitting there won't make a difference. Once you've decided that the point needs to split the curve, perform a split and modify your curve list to include the two new curves and not the old curve. Repeat until all points and all curves have been handled.
I wrote a C# example, but it still has a bug. It will create an extra split point at the seam for closed curves. Perhaps it is smarter to collect all splitting parameters first, then be smart about where and how to split curves.
Thank you so much for your reply, unfortunately i do not know how to use C++. Thanks a lot for your input. I guess its the split command in python for rhino that is not working fine as I am pretty confident that there is no problem with the script.
What the script does is that it checks if each point are on 1 curve that is currently on the loop and if they are intersection they will split it, and the split command doesnt work at this instance eventhough the intersection is there.
Thank you very much for your help. I really appreciate it! I guess I have to find another way of doing it..
This might also be a question for the Rhino.Python forum. Did you post there, too?
Could you also please upload the file?
Many thanks! I'm going to post it over there and hopefully get a feedback.
I found out that this command works when you instantiate a 'false' statement for creating a copy of the newly spitted curve instead of splitting the original curve.
It it was left as 'True', the loop will only run once because of the change in list due to the splitted original curve.
To my understanding it is the (splitting from the original curve) that amends and fucks up the whole list.
I wonder if there is a way to change the list of curves 'before splitting' to the newly 'splitted curves' while iterating in the loop. Which means as the loop runs the original list of curves slowly updates from its 'before split curve' to its 'splitted curves'.
Guan, I'll be glad to take a look, but I'm having trouble trying. I'd have to retype the whole script from the picture. Could you post it?
Please also state what you would like to do in general and comment the part that is not working.
Thanks for your cooperation,