Created
October 7, 2020 16:53
-
-
Save chuongmep/83b5a8fcb250e571b69254abc35d9ec9 to your computer and use it in GitHub Desktop.
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
public static XYZ Intersection(this Autodesk.Revit.DB.Plane plane, Autodesk.Revit.DB.Line line) | |
{ | |
UV uv1, uv2; | |
plane.Project(line.Origin, out uv1, out double d); | |
plane.Project(line.Origin + line.Direction, out uv2, out double b); | |
XYZ xyz1 = plane.Origin + (uv1.U * plane.XVec) + (uv1.V * plane.YVec); | |
XYZ xyz2 = plane.Origin + (uv2.U * plane.XVec) + (uv2.V * plane.YVec); | |
Line projectedLine = Line.CreateUnbound(xyz1, xyz2 - xyz1); | |
IntersectionResultArray iResult = new IntersectionResultArray(); | |
SetComparisonResult setComparisonResult = line.Intersect(projectedLine, out iResult); | |
if (setComparisonResult != SetComparisonResult.Disjoint) | |
return iResult.get_Item(0).XYZPoint; | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment