More explanatory error message for trying to pass PolyCurve curves to Mo...

...delCurve.ByCurve

@ikeough
It's clear that this is a provisional fix.  I've created a separate task
for that (MAGN-3814) - but presently it will require a good deal more work
to get Element rebinding to work correctly for the case you describe.

It's a better approach to give an informative error message now and extend
the method to support PolyCurve creation later.  There are other things
(e.g. real geometry bugs, failed unit tests) that should definitely be
prioritized over this.

On Thu, Jun 26, 2014 at 1:47 AM, Sharad <notifications@github.com> wrote:

> In src/Libraries/Revit/RevitNodes/Elements/ModelCurve.cs:
>
> > @@ -185,6 +188,24 @@ internal static ModelCurve FromExisting(Autodesk.Revit.DB.ModelCurve modelCurve,
> >
> >          #region Helper methods
> >
> > +        private static Autodesk.Revit.DB.Curve ExtractLegalRevitCurve(Autodesk.DesignScript.Geometry.Curve curve)
> > +        {
> > +            // PB:  PolyCurves may have discontinuities that prevent them from being turned into legal Revit ModelCurves.
> > +            // Moreover, a single ModelCurve may not be a composite or multiple curves.
> > +
> > +            // One could add a static method to ModelCurve that is an overload of ByCurve - ModelCurve[] ByCurve(PolyCurve).
> > +            // But, this adds an unnecessary high level of complexity to the Element rebinding code.  Hence, we will go the
> > +            // more straightforward route of just providing an informative error message to the user.
> > +            if (curve is PolyCurve)
> > +            {
> > +                throw new Exception(
> > +                    "Revit does not support turning PolyCurves into ModelCurves.  "
>
> From a collection of curve it won't be possible to identify PolyCurve and
> build a graph to handle PolyCurve separately. I think we need to do the
> explode internally and create multiple ModelCurve from that.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/DynamoDS/Dynamo/pull/1811/files#r14226108>.
>