<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get point from curve intersection in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864795#M21526</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello, I'm trying to find a point that specifies the intersection of two lines. I have seen that there is a curve.Intersect (curve) that returns a SetComparisonResult. There is a possibility of finding an XYZ of that intersection or how you could do it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public Result Execute(ExternalCommandData commandData,
                              ref string message,
                              ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            UIDocument uiDoc = uiApp.ActiveUIDocument;
            Document doc = uiDoc.Document;

            // Conduit selection 
            ElementId conduitElementId = uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element).ElementId;
            Element conduitElement = doc.GetElement(conduitElementId);

            // Get curve conduit
            LocationCurve conduitCurveLocation = conduitElement.Location as LocationCurve;
            Curve conduitCurve = conduitCurveLocation.Curve;

            // Get points conduit
            XYZ startConduitCurvePoint = conduitCurve.GetEndPoint(0);
            XYZ endConduitCurvePoint = conduitCurve.GetEndPoint(1);       

            // Beam selection 
            ElementId beamElementId = uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element).ElementId;
            Element beamElement = doc.GetElement(beamElementId);

            // Get the beam inferior point y restar la mitad del diametro del elemento
            double beamInferiorPoint = beamElement.get_BoundingBox(doc.ActiveView).Min.Z - conduitElement.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).AsDouble() /2;

            // Get curve beam 
            LocationCurve beamCurveLocation = beamElement.Location as LocationCurve;
            Curve beamCurve = beamCurveLocation.Curve;

            // Get points beam
            XYZ startBeamCurvePoint = beamCurve.GetEndPoint(0);
            XYZ endBeamCurvePoint = beamCurve.GetEndPoint(1);


            // Get points Conduit 
            XYZ startConduitPoint = new XYZ(startConduitCurvePoint.X, startConduitCurvePoint.Y, beamInferiorPoint);
            XYZ endConduitPoint = new XYZ(endConduitCurvePoint.X, endConduitCurvePoint.Y, beamInferiorPoint);

            // Get points Beam 
            XYZ startBeamPoint = new XYZ(startBeamCurvePoint.X, startBeamCurvePoint.Y, beamInferiorPoint);
            XYZ endBeamPoint = new XYZ(endBeamCurvePoint.X, endBeamCurvePoint.Y, beamInferiorPoint);


            // Line to get the point (Z is equal for two Lines)
            Line conduitLine = Line.CreateBound(startConduitPoint, endConduitPoint);
            Line beamLine = Line.CreateBound(startBeamCurvePoint, endBeamCurvePoint);

            // Get the intersection point
            conduitLine.Intersect(beamLine);// TODO: Get the point


            return Result.Succeeded;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jan 2022 17:54:48 GMT</pubDate>
    <dc:creator>Tripler123</dc:creator>
    <dc:date>2022-01-07T17:54:48Z</dc:date>
    <item>
      <title>Get point from curve intersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864795#M21526</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello, I'm trying to find a point that specifies the intersection of two lines. I have seen that there is a curve.Intersect (curve) that returns a SetComparisonResult. There is a possibility of finding an XYZ of that intersection or how you could do it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public Result Execute(ExternalCommandData commandData,
                              ref string message,
                              ElementSet elements)
        {
            UIApplication uiApp = commandData.Application;
            UIDocument uiDoc = uiApp.ActiveUIDocument;
            Document doc = uiDoc.Document;

            // Conduit selection 
            ElementId conduitElementId = uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element).ElementId;
            Element conduitElement = doc.GetElement(conduitElementId);

            // Get curve conduit
            LocationCurve conduitCurveLocation = conduitElement.Location as LocationCurve;
            Curve conduitCurve = conduitCurveLocation.Curve;

            // Get points conduit
            XYZ startConduitCurvePoint = conduitCurve.GetEndPoint(0);
            XYZ endConduitCurvePoint = conduitCurve.GetEndPoint(1);       

            // Beam selection 
            ElementId beamElementId = uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element).ElementId;
            Element beamElement = doc.GetElement(beamElementId);

            // Get the beam inferior point y restar la mitad del diametro del elemento
            double beamInferiorPoint = beamElement.get_BoundingBox(doc.ActiveView).Min.Z - conduitElement.get_Parameter(BuiltInParameter.RBS_CONDUIT_DIAMETER_PARAM).AsDouble() /2;

            // Get curve beam 
            LocationCurve beamCurveLocation = beamElement.Location as LocationCurve;
            Curve beamCurve = beamCurveLocation.Curve;

            // Get points beam
            XYZ startBeamCurvePoint = beamCurve.GetEndPoint(0);
            XYZ endBeamCurvePoint = beamCurve.GetEndPoint(1);


            // Get points Conduit 
            XYZ startConduitPoint = new XYZ(startConduitCurvePoint.X, startConduitCurvePoint.Y, beamInferiorPoint);
            XYZ endConduitPoint = new XYZ(endConduitCurvePoint.X, endConduitCurvePoint.Y, beamInferiorPoint);

            // Get points Beam 
            XYZ startBeamPoint = new XYZ(startBeamCurvePoint.X, startBeamCurvePoint.Y, beamInferiorPoint);
            XYZ endBeamPoint = new XYZ(endBeamCurvePoint.X, endBeamCurvePoint.Y, beamInferiorPoint);


            // Line to get the point (Z is equal for two Lines)
            Line conduitLine = Line.CreateBound(startConduitPoint, endConduitPoint);
            Line beamLine = Line.CreateBound(startBeamCurvePoint, endBeamCurvePoint);

            // Get the intersection point
            conduitLine.Intersect(beamLine);// TODO: Get the point


            return Result.Succeeded;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 17:54:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864795#M21526</guid>
      <dc:creator>Tripler123</dc:creator>
      <dc:date>2022-01-07T17:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get point from curve intersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864877#M21527</link>
      <description>&lt;P&gt;Use the &lt;A href="https://apidocs.co/apps/revit/2020/51961478-fb36-e00b-2d1b-7db27b0a09e6.htm" target="_blank" rel="noopener"&gt;overload of Intersect&lt;/A&gt; that returns an array of intersection results as an out parameter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;// At top of file:
using System.Linq;

var intersects = conduitLine.Intersect(beamLine, out var intersections);
if(intersects == SetComparisonResult.Disjoint)
{
	// They don't intersect;
	return Result.Failed;
}
var intersection = intersections.Cast&amp;lt;IntersectionResult&amp;gt;().First();

var point = intersection.XYZPoint;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 18:33:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864877#M21527</guid>
      <dc:creator>mhannonQ65N2</dc:creator>
      <dc:date>2022-01-07T18:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get point from curve intersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864905#M21528</link>
      <description>&lt;P&gt;Thanks,&amp;nbsp;reading the information well I realized and solved it in the following way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;IntersectionResultArray intersectionResults = new IntersectionResultArray();

            List&amp;lt;XYZ&amp;gt; points = new List&amp;lt;XYZ&amp;gt;();

            SetComparisonResult result = conduitLine.Intersect(beamLine, out intersectionResults);

            if (result == SetComparisonResult.Overlap)
            {
                foreach (IntersectionResult intersectionResult in intersectionResults)
                {
                    XYZ point = intersectionResult.XYZPoint;
                    points.Add(point);
                }
            }

            TaskDialog.Show("title", points.Count.ToString() + $"{points[0]}");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jan 2022 18:43:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/10864905#M21528</guid>
      <dc:creator>Tripler123</dc:creator>
      <dc:date>2022-01-07T18:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get point from curve intersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/11254129#M21529</link>
      <description>&lt;P&gt;sir,&lt;/P&gt;&lt;P&gt;can apply to linked element?&amp;nbsp; such as linked wall&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 14:36:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/11254129#M21529</guid>
      <dc:creator>leungkahocityu</dc:creator>
      <dc:date>2022-06-23T14:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: Get point from curve intersection</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/12414692#M21530</link>
      <description>&lt;P&gt;How can i find intersection point of wall and column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4729529"&gt;@Tripler123&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Dec 2023 05:39:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-point-from-curve-intersection/m-p/12414692#M21530</guid>
      <dc:creator>praveen.cMXB2H</dc:creator>
      <dc:date>2023-12-02T05:39:11Z</dc:date>
    </item>
  </channel>
</rss>

