Not able to get InterSection point between Wall and Column.

Not able to get InterSection point between Wall and Column.

praveen.cMXB2H
Enthusiast Enthusiast
163 Views
1 Reply
Message 1 of 2

Not able to get InterSection point between Wall and Column.

praveen.cMXB2H
Enthusiast
Enthusiast

public XYZ FindLocPoint(Element ele1, Element ele2, Document doc)
{
LocationCurve locCurve = ele1.Location as LocationCurve;
Line curve1 = null;
if (locCurve != null)
{
curve1 = locCurve.Curve as Line;
}
else if (locCurve == null)
{
BoundingBoxXYZ bbox = ele1.get_BoundingBox(doc.ActiveView);
XYZ cp = bbox.Min.Add(bbox.Max).Divide(2.0);
XYZ p1 = new XYZ(cp.X, cp.Y, bbox.Min.Z);
XYZ p2 = new XYZ(cp.X, cp.Y, bbox.Max.Z);
curve1 = Line.CreateBound(p1, p2);

}

LocationCurve locCurve2 = ele2.Location as LocationCurve;
Line curve2 = null;
if (locCurve2 != null)
{
curve2 = locCurve2.Curve as Line;
}
else if (locCurve2 == null)
{
BoundingBoxXYZ bbox = ele2.get_BoundingBox(doc.ActiveView);
XYZ cp = bbox.Min.Add(bbox.Max).Divide(2.0);
XYZ p1 = new XYZ(cp.X, cp.Y, bbox.Min.Z);
XYZ p2 = new XYZ(cp.X, cp.Y, bbox.Max.Z);
curve2 = Line.CreateBound(p1, p2);

}

IntersectionResultArray intersectionResultArray = null;
XYZ point = null;

curve2.Intersect(curve1, out intersectionResultArray);
foreach (IntersectionResult intersectionResult in intersectionResultArray)
{
point = intersectionResult.XYZPoint;
}

return point;
}

 

 

 

 

 

@Mohamed_Arshad

0 Likes
164 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni

If the wall is flat and the column is straight, it might be easiest to just DIY and implement a simple geometric intersection algorithm to intersect a plane with a straight line segment:

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes