Skip to content

Commit

Permalink
removes start angle and end angle reliance in revit arc converter (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
clairekuang authored Nov 4, 2024
1 parent 54ce865 commit 8cfe0bf
Showing 1 changed file with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Speckle.Converters.Common.Objects;
using Speckle.Converters.RevitShared.Services;
using Speckle.Sdk.Common;

namespace Speckle.Converters.RevitShared.ToHost.Raw.Geometry;

Expand All @@ -23,31 +22,13 @@ public ArcConverterToHost(

public DB.Arc Convert(SOG.Arc target)
{
double startAngle;
double endAngle;

if (target.startAngle > target.endAngle)
{
startAngle = (double)target.endAngle;
endAngle = (double)target.startAngle;
}
else
{
startAngle = (double)target.startAngle.NotNull();
endAngle = (double)target.endAngle.NotNull();
}

var plane = _planeConverter.Convert(target.plane);

// Endpoints coincide, it's a circle.
if (SOG.Point.Distance(target.startPoint, target.endPoint) < 1E-6)
{
// Endpoints coincide, it's a circle.
return DB.Arc.Create(
plane,
_scalingService.ScaleToNative(target.radius ?? 0, target.units),
startAngle,
endAngle
);
double radius =
target.radius ?? _scalingService.ScaleToNative(target.plane.origin.DistanceTo(target.startPoint), target.units);
var plane = _planeConverter.Convert(target.plane);
return DB.Arc.Create(plane, _scalingService.ScaleToNative(radius, target.units), 0, Math.PI * 2);
}

return DB.Arc.Create(
Expand Down

0 comments on commit 8cfe0bf

Please sign in to comment.