diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Properties/ClassPropertiesExtractor.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Properties/ClassPropertiesExtractor.cs index 333ac8044..8fd6d7052 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Properties/ClassPropertiesExtractor.cs +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Properties/ClassPropertiesExtractor.cs @@ -252,11 +252,6 @@ private void ExtractPartProperties(CDB.Part part, Dictionary di catchmentProperties["featureLineIds"] = GetSpeckleApplicationIdsFromCollection(site.GetFeatureLineIds()); } - if (site.GetParcelIds().Count > 0) - { - catchmentProperties["parcelIds"] = GetSpeckleApplicationIdsFromCollection(site.GetParcelIds()); - } - return catchmentProperties; } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/AlignmentSubentityArcToSpeckleRawConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/AlignmentSubentityArcToSpeckleRawConverter.cs index 5c6d9c563..f7c62dbeb 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/AlignmentSubentityArcToSpeckleRawConverter.cs +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/AlignmentSubentityArcToSpeckleRawConverter.cs @@ -1,6 +1,5 @@ using Speckle.Converters.Common; using Speckle.Converters.Common.Objects; -using Speckle.Sdk; namespace Speckle.Converters.Civil3dShared.ToSpeckle.Raw; @@ -22,37 +21,30 @@ IConverterSettingsStore settingsStore public SOG.Arc Convert(CDB.AlignmentSubEntityArc target) { + // alignment arcs do not have the same properties as autocad arcs. + // we're assuming they are always 2d arcs on the xy plane to calculate the midpoint string units = _settingsStore.Current.SpeckleUnits; - // calculate midpoint of chord as between start and end point - AG.Point2d chordMid = - new((target.StartPoint.X + target.EndPoint.X) / 2, (target.StartPoint.Y + target.EndPoint.Y) / 2); - - // calculate sagitta as radius minus distance between arc center and chord midpoint - double sagitta = target.Radius - target.CenterPoint.GetDistanceTo(chordMid); - - // get unit vector from arc center to chord mid - AG.Vector2d midVector = target.CenterPoint.GetVectorTo(chordMid); - AG.Vector2d unitMidVector = midVector.DivideBy(midVector.Length); - - // get midpoint of arc by moving chord mid point the length of the sagitta along mid vector - // if greater than 180 >, move in other direction of distance radius + radius - sagitta - // in the case of an exactly perfect half circle arc...🤷‍♀️ - AG.Point2d midPoint = chordMid.Add(unitMidVector.MultiplyBy(sagitta)); - try + // calculate the mid vector (center to PI point (intersection of tangents) + // note: what is the PI point for a perfect half circle? + AG.Point2d piPoint = target.PIPoint; + double midVectorX = piPoint.X - target.CenterPoint.X; + double midVectorY = piPoint.Y - target.CenterPoint.Y; + double midVectorMag = Math.Sqrt(Math.Pow(midVectorX, 2.0) + Math.Pow(midVectorY, 2)); + double midScalingVectorX = target.Radius * midVectorX / midVectorMag; + double midScalingVectorY = target.Radius * midVectorY / midVectorMag; + if (target.Delta > Math.PI) { - if (target.GreaterThan180) // this can throw : The property gets an invalid value according to the entity's constraint type. - { - midPoint = chordMid.Add(unitMidVector.Negate().MultiplyBy(2 * target.Radius - sagitta)); - } + midScalingVectorX *= -1; + midScalingVectorY *= -1; } - catch (Exception e) when (!e.IsFatal()) { } // continue with original midpoint if GreaterThan180 doesn't apply to this arc + + double midPointX = target.CenterPoint.X + midScalingVectorX; + double midPointY = target.CenterPoint.Y + midScalingVectorY; // find arc plane (normal is in clockwise dir) var center3 = new AG.Point3d(target.CenterPoint.X, target.CenterPoint.Y, 0); - AG.Plane plane = target.Clockwise - ? new AG.Plane(center3, AG.Vector3d.ZAxis.MultiplyBy(-1)) - : new AG.Plane(center3, AG.Vector3d.ZAxis); + AG.Plane plane = new AG.Plane(center3, AG.Vector3d.ZAxis); // create arc SOG.Arc arc = @@ -74,21 +66,22 @@ public SOG.Arc Convert(CDB.AlignmentSubEntityArc target) }, midPoint = new() { - x = midPoint.X, - y = midPoint.Y, + x = midPointX, + y = midPointY, z = 0, units = units }, plane = _planeConverter.Convert(plane), radius = target.Radius, + angleRadians = target.Delta, length = target.Length, + units = units, // additional alignment subentity props ["startStation"] = target.StartStation, ["endStation"] = target.EndStation, ["startDirection"] = target.StartDirection, ["endDirection"] = target.EndDirection, - ["delta"] = target.Delta, ["deflectedAngle"] = target.DeflectedAngle, ["minumumRadius"] = target.MinimumRadius };