Grasshopper

algorithmic modeling for Rhino

Hello people,

I am writing some codes using PlaneCurveIntersection function.

However, this function does not seem to be fully completed because when given a curve and plane do not intersect, it cannot have a return value. Therefore, I extracted PlaneCurveIntersection from plane.py and added a line to the function so that it can return None value when no intersection occurs. This was fine, but I encountered another problem.

The problem is that PlaneCurveIntersection function sometimes cannot find intersecting points when actually there are intersections. Sample file contains one poly curve and its segment, and the sample code simply finds intersection points with a given curve and world-ZX-plane. However, it cannot find the intersection point of a plolycurve and ZXplane.

Since my codes are heavily rely on the PlaneCurveIntersection function, I am really having hard time to solve this problem. 

All your comments, alternative solutions or explanations will be greatly appreciated!

Views: 1091

Attachments:

Replies to This Discussion

No idea or suggestion?! :{

Hi,

when asking question on forums, it usually helps having your real name, or a picture that refers to you, or signing your question. This reassures people that you show personal interest, so they might invest some of their possibly little spare time on that particular issue. Of course this is no obligation.

Then again, the solution to this problem is pretty simple, yet quite difficult to pinpoint at first for me. It was due to the fact that rs.coercecurve() accepts the subcurve index as second argument, and raise_if_missing is its third argument. This in turn meant that you were intersecting only a subcurve of the original curve, so there were no results.

Attached is the improved version of the script.

I hope this helps,

- Giulio
______________
giulio@mcneel.com

Attachments:

Hi Giulio,

Thank you so much!

I will keep in mind your advice next time when I post question.

I am working on the fabrication script that automatically generates assemblies from a given surface. I will post the script when it is completed.

Your improved script works great, and it really helps a lot!

To understand what you explain about coercecurve, I looked through the definition of coercecurve in utility.py. However, since I am a novice scripter, it was hard to fully understand how cercecurve works with its arguments. I think this was mainly because I do not know the underlying structure of rhino python and what API functions such as Rhino.DocObjects.ObjRef do. Now I feel that I should work on rhino SDK parts to understand these parts.

Once again, thank you!

Yes, very true.

An advantage of rhinoscriptsyntax is also that it is really easier and faster to write.

Cheers,

- Giulio
______________
giulio@mcneel.com

Thx! I will work on SDK, definitely!

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