diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToSpeckleConverter.cs similarity index 92% rename from Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToHostConverter.cs rename to Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToSpeckleConverter.cs index a165142a1..c6cdfe407 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/AutocadRootToSpeckleConverter.cs @@ -7,12 +7,12 @@ namespace Speckle.Converters.Autocad; -public class AutocadRootToHostConverter : IRootToSpeckleConverter +public class AutocadRootToSpeckleConverter : IRootToSpeckleConverter { private readonly IConverterManager _toSpeckle; private readonly IConverterSettingsStore _settingsStore; - public AutocadRootToHostConverter( + public AutocadRootToSpeckleConverter( IConverterManager toSpeckle, IConverterSettingsStore settingsStore ) diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ServiceRegistration.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ServiceRegistration.cs index e5ca83c19..3db647bd7 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ServiceRegistration.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ServiceRegistration.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Speckle.Converters.Common; using Speckle.Converters.Common.Registration; @@ -14,7 +14,7 @@ public static void AddAutocadConverters(this IServiceCollection serviceCollectio //register types by default serviceCollection.AddMatchingInterfacesAsTransient(converterAssembly); // add single root converter - serviceCollection.AddRootCommon(converterAssembly); + serviceCollection.AddRootCommon(converterAssembly); // add application converters and context stack serviceCollection.AddApplicationConverters(converterAssembly); diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems b/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems index d303d2d3d..b4966066f 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/Speckle.Converters.AutocadShared.projitems @@ -11,7 +11,7 @@ - + diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs index c86714f4e..bc1b7fb1c 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs @@ -31,11 +31,13 @@ public ADB.Arc Convert(SOG.Arc target) AG.CircularArc3d circularArc = _arcConverter.Convert(target); // calculate adjusted start and end angles from circularArc reference - AG.Plane plane = _planeConverter.Convert(target.plane); - double angle = circularArc.ReferenceVector.AngleOnPlane(plane); - double startAngle = circularArc.StartAngle + angle; - double endAngle = circularArc.EndAngle + angle; + // for some reason, if just the circular arc start and end angle props are used, this moves the endpoints of the created arc + // so we need to calculate the adjusted start and end angles from the circularArc reference vector. + AG.Plane plane = new(circularArc.Center, circularArc.Normal); + double angleOnPlane = circularArc.ReferenceVector.AngleOnPlane(plane); + double adjustedStartAngle = circularArc.StartAngle + angleOnPlane; + double adjustEndAngle = circularArc.EndAngle + angleOnPlane; - return new(circularArc.Center, circularArc.Normal, circularArc.Radius, startAngle, endAngle); + return new(circularArc.Center, circularArc.Normal, circularArc.Radius, adjustedStartAngle, adjustEndAngle); } } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs index 7537a70ed..6a68b43ac 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs @@ -27,16 +27,6 @@ public AG.CircularArc3d Convert(SOG.Arc target) AG.Point3d end = _pointConverter.Convert(target.endPoint); AG.Point3d mid = _pointConverter.Convert(target.midPoint); AG.CircularArc3d arc = new(start, mid, end); - - AG.Vector3d normal = _vectorConverter.Convert(target.plane.normal); - AG.Vector3d xdir = _vectorConverter.Convert(target.plane.xdir); - arc.SetAxes(normal, xdir); - - if (target.startAngle is double startAngle && target.endAngle is double endAngle) - { - arc.SetAngles(startAngle, endAngle); - } - return arc; } }