Files
speckle-sharp-connectors/Converters/Revit/Speckle.Converters.RevitShared/ReferencePointConverter.cs
T
Adam Hathcock 8d0d7a89f7 Change conversion stack to better usage for products. (#215)
* fix: Push to sync with Jedd

* Jedd's record suggestions

* cleanup stack

* Revit settings converted

* more settings changes

* fix unit of work and scope registration

* rename

* fix more settings

* Use a generic factory to create settings contexts

* fix ArcGIS

* generic sending

* fix ArcGIS

* remove extras

* fix crs scoping

* fix autocad

* fix units for arcgis

* civil3d conversions

* rhino mostly works

* Rhino and recieve changed

* fix revit tests

* fix rhino tests

* fix merge

* make settings a record again

* fixes from reversion

* merge fixes

* ArcGIS reverts

* more senders reverted

* remove added reference

* clean up locks and files

* update nunit

* make things proper records

* fix test

* Merge fixes

* merge fixes

* Initialize the settings instead of push empty

* scan things consistently

---------

Co-authored-by: Alan Rynne <alan@speckle.systems>
Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2024-09-17 14:42:00 +02:00

33 lines
1.1 KiB
C#

using Speckle.Converters.Common;
using Speckle.Converters.RevitShared.Settings;
namespace Speckle.Converters.RevitShared.Helpers;
/// <summary>
/// POC: reference point functionality needs to be revisited (we are currently baking in these transforms into all geometry using the point and vector converters, and losing the transform).
/// This converter uses the transform in the reference point setting and provides methods to transform points
/// </summary>
public class ReferencePointConverter(IConverterSettingsStore<RevitConversionSettings> converterSettings)
: IReferencePointConverter
{
public DB.XYZ ConvertToExternalCoordinates(DB.XYZ p, bool isPoint)
{
if (converterSettings.Current.ReferencePointTransform is DB.Transform transform)
{
return isPoint ? transform.Inverse.OfPoint(p) : transform.Inverse.OfVector(p);
}
return p;
}
public DB.XYZ ConvertToInternalCoordinates(DB.XYZ p, bool isPoint)
{
if (converterSettings.Current.ReferencePointTransform is DB.Transform transform)
{
return isPoint ? transform.OfPoint(p) : transform.OfVector(p);
}
return p;
}
}