i’am wondering how i could get a List of Point3D out of a List of intersection_events:
# Calculate the intersection intersection_tolerance = 0.001 overlap_tolerance = 0.0 for i in range(0,len(curves)):
_ for j in range(0,len(circle)):_
_ events = rg.Intersect.Intersection.CurveCurve(curves[i],circle[j], intersection_tolerance, overlap_tolerance)_
_ PointA.append(events)_
So the result should be, get a List of Point3D from the Intersections between a list of circles and a list of curves… how can i do that?
You’re using the RhinoCommon API (i.e. import Rhino) these are the RhinoCommon API docs, linking to the class/type that is returned from the Rhino.Geometry.Intersect.Intersection.CurveCurvemethod you are implementing.
Afraid I’m away from a Rhino-system, but you would iterate the events like so:
for i in range(events.Count):
ccx = events.Item[i]
Where ccx is now an instance of the IntersectionEvent class, which enables you to query the intersection type, points, parameters on the curves etc.
since i followed your instructions there is still something missing. (Another problem)
And im very confused what my mistake could be:
So i have 12 “Line Like Curve” but this could be polylines aswell or curves in general! (I exploded them since the Intersect_Method did not seem to find all the intersections:
The reason for me (i think) is clear… if i iterate the events with a different number of Items in the list… this could cause problems… but till now, i dont see my mistake…may you help me again?
You can use type(), help()and dir() to directly inspect variables in code to figure out which type they are, which methods/properties they expose etc. The larger issue is that you appear to jump out of the intersection scope from line 19 to 20 (meaning that events at line 21 will only be that last iteration in the nested loop you start at line 17-18 (i.e. you keep overwriting the events variable here. I might also simply not be getting the logic
Since the Method of CurveCurve intersection does not work with “lists”… i need to iterate the elements… right?
And since i want to get ALL intersections of to sets of curves, in this case curves and circles, i need to somehow bring every element that intersects with one out of the other list together.
My code might be not logic but i dont have a better idea right now!
What would be your solution for that Problem? Intersecting the given geometry?
Hi Simon, managed to have a look at your code now. If I understood what you’re trying to achieve correctly, you could get all the intersection points like so:
There are many other ways of implementing the same base logic here (i.e. that are more traditional C-like by iterating over the indices etc), but this is probably a pretty good (or at least terse) Python-ish approch.
Hope that helps and apologies for adding any confusion
Edit: Note that one would probably add some checks here and there, to ensure that there is actually anything to compute/get before making the calls.