Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unpack parameters as Dictionary #344

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
aee97d2
updates constructors and deprecates any unused code & functionality
clairekuang Oct 28, 2024
114356c
updates arcs and polycurves
clairekuang Oct 29, 2024
a400494
removes set only circle props
clairekuang Oct 29, 2024
47be734
updates box conversions
clairekuang Oct 30, 2024
eee9d17
Merge branch 'dev' into claire/cnx-687-purge-unused-classes-from-objects
clairekuang Oct 30, 2024
129395d
Merge branch 'dev' into claire/cnx-687-purge-unused-classes-from-objects
clairekuang Oct 30, 2024
6706def
fixes model curves and transforms
clairekuang Oct 31, 2024
232d859
Update ModelCurveToSpeckleTopLevelConverter.cs
clairekuang Nov 1, 2024
ff221a5
unpack parameters as Dictionnary
KatKatKateryna Nov 3, 2024
4595e35
Merge branch 'dev' into claire/cnx-687-purge-unused-classes-from-objects
clairekuang Nov 4, 2024
2d47837
Merge branch 'dev' into claire/cnx-687-purge-unused-classes-from-objects
clairekuang Nov 5, 2024
ad74743
bumps nugets
clairekuang Nov 5, 2024
a43332e
Merge branch 'claire/cnx-687-purge-unused-classes-from-objects' of ht…
clairekuang Nov 5, 2024
d65d53a
fixes package locks and arc
clairekuang Nov 5, 2024
ae08faa
updates rhino arc test
clairekuang Nov 5, 2024
bfc8807
Merge branch 'claire/cnx-687-purge-unused-classes-from-objects' into …
KatKatKateryna Nov 5, 2024
e8fede2
Merge branch 'dev' into claire_classes_ArcGIS_parameters
KatKatKateryna Nov 5, 2024
7d12302
add lists
KatKatKateryna Nov 5, 2024
9faedac
Merge branch 'dev' into claire_classes_ArcGIS_parameters
KatKatKateryna Nov 5, 2024
5343efc
refactor
KatKatKateryna Nov 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes model curves and transforms
clairekuang committed Oct 31, 2024
commit 6706def65e10fcbf39cd0864790d171b9321c1aa
Original file line number Diff line number Diff line change
@@ -191,7 +191,7 @@ localToGlobalMap.AtomicObject is ITransformable transformable and ICurve
ITransformable? newTransformable = null;
foreach (var mat in localToGlobalMap.Matrix)
{
transformable.TransformTo(new Transform(mat, units), out newTransformable);
transformable.TransformTo(new Transform() { matrix = mat, units = units }, out newTransformable);
}

localToGlobalMap.AtomicObject = (newTransformable as Base)!;
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
using Speckle.Converters.Common;
using Speckle.Converters.Common.Objects;
using Speckle.Converters.RevitShared.Settings;
using Speckle.Objects;
using Speckle.Sdk.Common;
using Speckle.Sdk.Common.Exceptions;
using Speckle.Sdk.Models;

namespace Speckle.Converters.RevitShared.ToSpeckle;

// POC: ModelCurve looks a bit bogus and we may wish to revise what that is and how it inherits
// see https://spockle.atlassian.net/browse/CNX-9381
[NameAndRankValue(nameof(DB.ModelCurve), 0)]
public class ModelCurveToSpeckleTopLevelConverter : BaseTopLevelConverterToSpeckle<DB.ModelCurve, SOBR.Curve.ModelCurve>
public class ModelCurveToSpeckleTopLevelConverter : BaseTopLevelConverterToSpeckle<DB.ModelCurve, Base>
{
private readonly ITypedConverter<DB.Curve, ICurve> _curveConverter;
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;

public ModelCurveToSpeckleTopLevelConverter(
ITypedConverter<DB.Curve, ICurve> curveConverter,
IConverterSettingsStore<RevitConversionSettings> converterSettings
)
public ModelCurveToSpeckleTopLevelConverter(ITypedConverter<DB.Curve, ICurve> curveConverter)
{
_curveConverter = curveConverter;
_converterSettings = converterSettings;
}

public override SOBR.Curve.ModelCurve Convert(DB.ModelCurve target)
public override Base Convert(DB.ModelCurve target)
{
var modelCurve = new SOBR.Curve.ModelCurve()
{
baseCurve = _curveConverter.Convert(target.GeometryCurve),
lineStyle = target.LineStyle.Name,
elementId = target.Id.ToString().NotNull(),
units = _converterSettings.Current.SpeckleUnits
};
ICurve? iCurve = _curveConverter.Convert(target.GeometryCurve);

// POC: check this is not going to set the display value to anything we cannot actually display - i.e. polycurve
// also we have a class for doing this, but probably this is fine for now. see https://spockle.atlassian.net/browse/CNX-9381
modelCurve["@displayValue"] = modelCurve.baseCurve;
switch (iCurve)
{
case SOG.Line line:
return new SOG.Revit.RevitLine(line);

Check failure on line 26 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs

GitHub Actions / test

The type or namespace name 'Revit' does not exist in the namespace 'Speckle.Objects.Geometry' (are you missing an assembly reference?)
case SOG.Ellipse ellipse:
return new SOG.Revit.RevitEllipse(ellipse);

Check failure on line 28 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs

GitHub Actions / test

The type or namespace name 'Revit' does not exist in the namespace 'Speckle.Objects.Geometry' (are you missing an assembly reference?)
case SOG.Curve curve:
return new SOG.Revit.RevitCurve(curve);

Check failure on line 30 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs

GitHub Actions / test

The type or namespace name 'Revit' does not exist in the namespace 'Speckle.Objects.Geometry' (are you missing an assembly reference?)
case SOG.Arc arc:
return new SOG.Revit.RevitArc(arc);

Check failure on line 32 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs

GitHub Actions / test

The type or namespace name 'Revit' does not exist in the namespace 'Speckle.Objects.Geometry' (are you missing an assembly reference?)

return modelCurve;
default:
throw new ConversionException(
$"No Revit class available for ModelCurve of type {target.GeometryCurve.GetType()}"
);
}
}
}
5 changes: 3 additions & 2 deletions Sdk/Speckle.Converters.Common/LocalToGlobalConverterUtils.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Speckle.DoubleNumerics;
using Speckle.DoubleNumerics;
using Speckle.Objects;
using Speckle.Sdk.Common;
using Speckle.Sdk.Common.Exceptions;
using Speckle.Sdk.Models;

@@ -27,7 +28,7 @@ public Base TransformObjects(Base atomicObject, List<Matrix4x4> matrix)
}

List<Speckle.Objects.Other.Transform> transforms = matrix
.Select(x => new Speckle.Objects.Other.Transform(x, "none"))
.Select(x => new Speckle.Objects.Other.Transform() { matrix = x, units = Units.None })
.ToList();

if (atomicObject is ITransformable c)

Unchanged files with check annotations Beta

break;
case SOG.Arc arc:
// POC: possibly endAngle and startAngle null?
double measure = arc.measure;

Check failure on line 49 in Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/PolycurveToHostPolylineRawConverter.cs

GitHub Actions / build

'Arc' does not contain a definition for 'measure' and no accessible extension method 'measure' accepting a first argument of type 'Arc' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 49 in Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/PolycurveToHostPolylineRawConverter.cs

GitHub Actions / build

'Arc' does not contain a definition for 'measure' and no accessible extension method 'measure' accepting a first argument of type 'Arc' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 49 in Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/PolycurveToHostPolylineRawConverter.cs

GitHub Actions / build

'Arc' does not contain a definition for 'measure' and no accessible extension method 'measure' accepting a first argument of type 'Arc' could be found (are you missing a using directive or an assembly reference?)
if (measure <= 0 || measure >= 2 * Math.PI)
{
throw new ArgumentOutOfRangeException(nameof(target), "Cannot convert arc with measure <= 0 or >= 2 pi");
SOG.Plane plane = _planeConverter.Convert(acadPlane);
SOG.Box box =
new()

Check failure on line 36 in Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/BoxToSpeckleRawConverter.cs

GitHub Actions / build

Required member 'Box.basePlane' must be set in the object initializer or attribute constructor.

Check failure on line 36 in Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/BoxToSpeckleRawConverter.cs

GitHub Actions / build

Required member 'Box.basePlane' must be set in the object initializer or attribute constructor.
{
plane = plane,

Check failure on line 38 in Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/BoxToSpeckleRawConverter.cs

GitHub Actions / build

'Box' does not contain a definition for 'plane'

Check failure on line 38 in Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/BoxToSpeckleRawConverter.cs

GitHub Actions / build

'Box' does not contain a definition for 'plane'

Check failure on line 38 in Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Raw/BoxToSpeckleRawConverter.cs

GitHub Actions / build

'Box' does not contain a definition for 'plane'
xSize = xSize,
ySize = ySize,
zSize = zSize,
units = units
};
return new SOG.Box()

Check failure on line 51 in Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/EnvelopBoxToSpeckleConverter.cs

GitHub Actions / build

Required member 'Box.basePlane' must be set in the object initializer or attribute constructor.
{
plane = plane,

Check failure on line 53 in Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/Raw/EnvelopBoxToSpeckleConverter.cs

GitHub Actions / build

'Box' does not contain a definition for 'plane'
xSize = new Interval { start = minPtSpeckle.x, end = maxPtSpeckle.x },
ySize = new Interval { start = minPtSpeckle.y, end = maxPtSpeckle.y },
zSize = new Interval { start = minPtSpeckle.z, end = maxPtSpeckle.z },
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, target.units), 0, Math.PI * 2);

Check failure on line 30 in Converters/Revit/Speckle.Converters.RevitShared/ToHost/Raw/Geometry/ArcConverterToHost.cs

GitHub Actions / test

Argument 1: cannot convert from 'double?' to 'double'
}
return DB.Arc.Create(
transform.BasisY.Normalize()
);
var box = new SOG.Box()

Check failure on line 39 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Raw/Geometry/BoundingBoxXYZToSpeckleConverter.cs

GitHub Actions / test

Required member 'Box.basePlane' must be set in the object initializer or attribute constructor.
{
xSize = new Interval { start = min.x, end = max.x },
ySize = new Interval { start = min.y, end = max.y },
zSize = new Interval { start = min.z, end = max.z },
plane = _planeConverter.Convert(plane),

Check failure on line 44 in Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/Raw/Geometry/BoundingBoxXYZToSpeckleConverter.cs

GitHub Actions / test

'Box' does not contain a definition for 'plane'
units = _converterSettings.Current.SpeckleUnits
};