Grasshopper

algorithmic modeling for Rhino

Hi guys, 

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!

Best,

Guan

Views: 1247

Attachments:

Replies to This Discussion

Hi Guan,

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.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Attachments:

Dear David,

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..

Guan

This might also be a question for the Rhino.Python forum. Did you post there, too?
Could you also please upload the file?

Thanks,

- Giulio
_________________
giulio@mcneel.com

Hi Giulio,

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

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,

- Giulio
_________________
giulio@mcneel.com

Hi,

have the points, have the curves, but still no split.

is it an accuracy or a parametrization problem?

shehzad

Attachments:

Hi Shehzad,

this would probably make a good candidate for a new discussion.

From a quick look, it seems that there are different points coming from different routes attempting to divide each curve, and so the process is failing.

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Hi, 

I thought it related to this topic hence i put it here. sure, will start a new discussion. 

I don't get ""points from different routes", i hope to understand more.. 

Thanks for taking the time... 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service