Creating a Line from Projected Points returns void

I’m trying to construct a Line between the end of a curve and that same point projected onto another plane. Here is the code I am using

Line connection = new Line(crv.PointAtEnd, crv.PointAtEnd.Transform(Transform.PlanarProjection(planeConnection)));

I can’t seem to get this code to work. I get an error on the second crv.PointAtend command saying “Cannot convert from void to Rhino.Geometry.Point3d”

I have also tried this code
Line connection = new Line(crv.PointAtEnd, crv.PointAtEnd * Transform.PlanarProjection(planeConnection));
but I get the error “Operator ‘*’ cannot be applied to operands of type ‘Point3d’ and ‘Transform’”

What would be the correct way to perform this action as a single line?

Hi @cameronbehning ,
The Point3d.Transform() method does not return a Point3d, so it cannot be used as an argument.
You could do something like this:

            Point3d projectedPoint = crv.PointAtEnd;
            projectedPoint.Transform(Transform.PlanarProjection(planeConnection));
            Line connection = new Line(crv.PointAtEnd, projectedPoint);

Or if you really want to perform the action in a single line, you could write a function that returns the Transformed point3d…

            Line connection = new Line(crv.PointAtEnd, GetTransformedPoint(crv.PointAtEnd, Transform.PlanarProjection(planeConnection)));

            Point3d GetTransformedPoint(Point3d point3D,Transform transform)
            {
                point3D.Transform(transform);
                return point3D;
            }
1 Like