DynamoDS/Dynamo — pull request #2017 by pboyer (2014-07-22 20:12:59+00:00)
Title: Fix for MAGN-3916: Straight, non-Line argument to ModelCurve.ByCurve causes failure

### Issue

All ModelCurve's require a host SketchPlane in order to exist. For non-straight curves, ModelCurve.ByCurve determines this plane using a best fit plane. A Line argument is a special case and was previously correctly handled.

Straight, non-Line arguments (e.g. a NURBS curve with aligned control points) were NOT correctly handled and would cause the best fit plane code to be invoke. The best fit plane for a straight line is non-determinate so this code was failing.

### Fix

The fix was to do a check before hand to determine if the curve was straight, even if it's not a Line. This is done by tesselating the curve, forming a line between the end points, and looking for any tessellation point that is not along this line.

This code is located in a new utility class called `CurveUtils` in the `Revit.GeometryConversion` namespace in RevitNodes. The code for determining the plane from a Revit Curve was also moved here so that it can be reused more easily.

### Unit tests

Before discovering the source of this issue, I added several unit tests for `ProtoToRevitCurve.ToProtoType(NurbsCurve)`. I've also added unit tests for `ModelCurve.ByCurve` and `CurveUtils.IsLineLike` testing the above functionality.

@ikeough.