GHPython: Converting the results of an intersection event to a Polyline

Hello,

In several components that I am working with right now, I keep having the same problem. The results of one one a given set of operations will only become usable as geometry when they leave the component as an output.

In the example gh file that I have attached. The points of intersection between sets of lines have been located via rhino common. I can pass these points to another component and get the desired polyline, but if I work with it inside the component, there are 19 null results. 19 is the total number of points.

I have internalized the data and the cropped out non-relevant portions of the script. Thanks so much for any help in advance.

I have included (2) files:

intersection_component.gh which is just the points and works fine

intersection_component_error.gh. Which includes the rs.AddPolyline() and fails.

Here is the code:

import rhinoscriptsyntax as rs
import Rhino as rh
import ghpythonlib.components as gh

x=section
y=projection

intersect curves and flatten list of lists
if x != y:
j=rh.Geometry.Intersect.Intersection.CurveCurve(x,y,0.001,0.001)
a=
for yy in j:
tt=yy.PointA
a.append(tt)
m=gh.FlattenTree(a)
points=m

#Add points to document and construct a polyline through the points.
for i in m:
points2=
points2.append(rs.AddPoint(m))
r=rs.coerce3dpointlist(points2)
curves=rs.AddPolyline(r)

Mark

Intersection_Component_error.gh (85.5 KB)

Intersection_Component.gh (83.4 KB)

Blockquote

I think that I figured this out while waiting. The intersection portion of the script requires item access and the polyline portion requires list access. I guess they cannot coexist within the same component.

Hi, I think this worksintersection_event_to_polylineIntersection_event_to_polyline.gh (83.9 KB)