-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,35 @@ | ||
namespace OpenMEPRevit.Geometry; | ||
using Autodesk.Revit.DB; | ||
using Revit.GeometryConversion; | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEPRevit.Geometry; | ||
|
||
public class Point | ||
{ | ||
private Point() | ||
{ | ||
|
||
} | ||
/// <summary> | ||
/// Converts a point from the origin coordinate system to the shared coordinate system in Revit. | ||
/// </summary> | ||
/// <param name="point">The point in the origin coordinate system to be converted.</param> | ||
/// <returns>The converted point in the shared coordinate system.</returns> | ||
public static Autodesk.DesignScript.Geometry.Point ConvertOriginToSharedCoordinate(Autodesk.DesignScript.Geometry.Point point) | ||
{ | ||
Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; | ||
XYZ ofPoint = doc.ActiveProjectLocation.GetTotalTransform().Inverse.OfPoint(point.ToXyz()); | ||
return ofPoint.ToPoint(); | ||
} | ||
/// <summary> | ||
/// Converts a point from the shared coordinate system to the origin coordinate system in Revit. | ||
/// </summary> | ||
/// <param name="point">The point in the shared coordinate system to be converted.</param> | ||
/// <returns>The converted point in the origin coordinate system.</returns> | ||
public static Autodesk.DesignScript.Geometry.Point ConvertSharedCoordinateToOrigin(Autodesk.DesignScript.Geometry.Point point) | ||
{ | ||
Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; | ||
XYZ ofPoint = doc.ActiveProjectLocation.GetTotalTransform().OfPoint(point.ToXyz()); | ||
return ofPoint.ToPoint(); | ||
} | ||
} |