Issue
I'm using Rebar.CreateCurves() to define a rebar whose curve is composed of two curves: an arc and a straight line. As an example, the curve looks like the picture below:
However, if I try to pass the curves with two segments in one curve array, it throws an error:
"Unable to create a RebarShape based on the given curves."
Could you tell what the part is that Revit does not like?
Solution
The basic problem is that you cannot create a Rebar that ends with an arc; if a Rebar shape includes any straight edges, then its first and last curves must be straight lines (see RebarShapeDefinitionBySegments). The only exception is a Rebar that is completely made up of arcs (see RebarShapeDefinitionByArc). If you add straight line at the both ends of the arc, for example, like the picture below, it should work.
Note: if your intention is to create 180 degree hook, you should only include the straight line in the curves array, and then specify a RebarHookType as one of the arguments in the call to Rebar.CreateFromCurves().