Skip to content

Instantly share code, notes, and snippets.

@radzionc
Created October 5, 2017 13:49
Show Gist options
  • Select an option

  • Save radzionc/10efd21422076d4efc314da43b2cc1ba to your computer and use it in GitHub Desktop.

Select an option

Save radzionc/10efd21422076d4efc314da43b2cc1ba to your computer and use it in GitHub Desktop.
rebars
.Select((rebar, rebarIndex) => linesAfterCropping.ElementAt(rebarIndex)
.Select(lines =>
{
var shapeCode = rebar.ShapeCode;
if (shapeCode == ShapeCodes.ANGULAR || shapeCode == ShapeCodes.G_LIKE)
{
if (lines.Count == 1) return new Rebar(rebar, lines) { ShapeCode = ShapeCodes.LINE };
return new Rebar(rebar, lines);
}
if (shapeCode == ShapeCodes.TRANS_VERSE)
{
return SU.Equals(rebar.Polyline.First().Length, lines.First().Length) ? rebar : null;
}
if (shapeCode == ShapeCodes.P_LIKE)
{
return lines.Count == 3 ? new Rebar(rebar, lines) : null;
}
return new Rebar(rebar, lines);
})
.Where(r => r != null)
)
.SelectMany(s => s)
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment